Skip to content

Instantly share code, notes, and snippets.


Bruno Van de Velde texus

View GitHub Profile
texus / physicalMonitorSizeFromHMONITOR.cpp
Created Nov 29, 2019
Finding physical screen size from HMONITOR using EDID
View physicalMonitorSizeFromHMONITOR.cpp
#include <Windows.h>
#include <SetupApi.h>
#include <cfgmgr32.h> // MAX_DEVICE_ID_LEN
#include <iostream>
#include <vector>
#include <string>
#include <map>
#pragma comment(lib, "setupapi.lib")
texus / toLower.cpp
Last active Dec 14, 2019
String to lowercase at compile time
View toLower.cpp
// This file contains code on how to convert a string to lowercase at compile time.
// A large part of the imlementation was taken from which solved the problems that I had in the old implementation.
// The string struct will hold our data
// The declaration of our string struct that will contain the character array
template<char... str>
struct string
// The characters are immediately converted to lowercase when they are put in the array
texus / Transparent.cpp
Last active Jun 4, 2019
Translucent per-pixel alpha window on Windows
View Transparent.cpp
#include <SFML/Graphics.hpp>
#if _WIN32_WINNT < 0x0501
#define _WIN32_WINNT 0x0501
#include <windows.h>
// Set part of the window that can be clicked by removing fully transparent pixels from the region
void setShape(HWND hWnd, const sf::Image& image)
texus / BindingAnyVariable.cpp
Last active Aug 29, 2015
Bind a function parameter without even knowing which variable you are going to bind (type has to be known in advance). A pointer to any variable is bound and dereferenced on the fly when calling the function.
View BindingAnyVariable.cpp
#include <functional>
#include <iostream>
// The function that we are going to call, it just prints out the variable here.
// This function can even receive a reference to the variable and change it!
template <typename T>
void print(T& obj)
std::cout << obj << std::endl;