Skip to content

Instantly share code, notes, and snippets.

@bagobor
bagobor / vsync.txt
Created December 2, 2015 05:36 — forked from dwilliamson/vsync.txt
Windows vsync
VSync under Windows, revisited
http://www.virtualdub.org/blog/pivot/entry.php?id=157
Windowed mode, vsync stutter, DWM (Vista+)
http://armageddongames.net/showthread.php?96793-Windowed-mode-vsync-stutter-DWM-(Vista-)
DwmFlush function
https://msdn.microsoft.com/en-us/library/windows/desktop/dd389405(v=vs.85).aspx
Bug 856427 - Add vsync support on windows
@bagobor
bagobor / lua_chunk.hpp
Created December 5, 2015 19:00
lua chunk
#pragma once
#include <string>
#include <lua/lua.hpp>
#include <luabind/luabind.hpp>
#include <luabind/detail/policy.hpp>
#include <luabind/out_value_policy.hpp>
#include <luabind/operator.hpp>
@bagobor
bagobor / carray_streambuf.hpp
Created January 20, 2016 13:41
std::streambuff derived class for mem optimisations
class carray_streambuf : public std::streambuf {
public:
carray_streambuf(char *data, unsigned int len) {
setp(data, data+len);
setg(data, data, data + len);
}
// amount of stored (written!) data in bytes
size_t saved_bytes() const { return pptr() - pbase(); }
};
@bagobor
bagobor / edtaa3func.h
Created March 7, 2018 06:59 — forked from Flix01/edtaa3func.h
A Signed Distance Font Builder for Dear ImGui
/*
* edtaa3()
*
* Sweep-and-update Euclidean distance transform of an
* image. Positive pixels are treated as object pixels,
* zero or negative pixels are treated as background.
* An attempt is made to treat antialiased edges correctly.
* The input image must have pixels in the range [0,1],
* and the antialiased image should be a box-filter
* sampling of the ideal, crisp edge.