Skip to content

Instantly share code, notes, and snippets.

Bruno Van de Velde texus

Block or report user

Report or block texus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@texus
texus / toLower.cpp
Last active May 9, 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 http://stackoverflow.com/a/15912824/3161376 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
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
#endif
#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
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;
}
You can’t perform that action at this time.