This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void screenshot(char filename[160], int x, int y) | |
{ | |
// get the image data | |
long imageSize = x * y * 3; | |
unsigned char *data = new unsigned char[imageSize]; | |
glReadPixels(0,0, x,y, GL_BGR, GL_UNSIGNED_BYTE, data); | |
// split x and y sizes into bytes | |
int xa= x % 256; | |
int xb= (x - xa) / 256; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
import std.conv; | |
import std.string : toStringz; | |
import gl; | |
import glut; | |
class ShaderException : Exception |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DATA |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.intrinsic; | |
pure uint pop(ref const(uint)[] stream) | |
{ | |
auto res = bswap(stream[$-1]); | |
stream.length -= 1; | |
return res; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
immutable(uint[256]) crc32_lookup_table = | |
{ | |
uint[] table; | |
foreach (ref i; 0 .. 256) | |
{ | |
uint crc = i; | |
foreach (_; 0 .. 8) | |
crc = crc & 1 ? (crc >> 1) ^ 0xEDB88320 : crc >> 1; | |
table ~= crc; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <qdebug.h> | |
template <typename T> class Runner; | |
template <typename T> Runner<T> Closure(T t) { return Runner<T>(t); } | |
template <typename T> class Runner | |
{ | |
friend Runner<T> Closure <> (T t); | |
Runner(T t) : _t (t) {} | |
T _t; | |
public: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import std.stdio; | |
struct Bind(alias F, T1...) | |
{ | |
static | |
Bind!(F, T1) opCall(T1...)(T1 t1) | |
{ | |
Bind!(F, T1) self; | |
self.t1 = t1; | |
return self; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Qt | |
#include <QMap> | |
#include <QtAlgorithms> | |
// QMF | |
#include <qmfclient/qmailstore.h> // QMailStore | |
// project | |
#include "folderlistmodel.h" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Typedef(T) | |
{ | |
T _; | |
alias _ this; | |
} | |
alias Typedef!int myInt; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string> | |
#include <sstream> | |
#include <map> | |
#include <fstream> | |
class Convert | |
{ | |
public: | |
template <typename T> |