Skip to content

Instantly share code, notes, and snippets.

View armornick's full-sized avatar

Nick Arnoeyts armornick

  • Belgium
View GitHub Profile
@armornick
armornick / supertux-freetype.cs
Created January 8, 2012 10:56
Binding C-Libraries to .NET (C#) -- Copyright SuperTux#
/* WARNING: Automatically generated file */
using System;
using System.Runtime.InteropServices;
using System.Security;
using System.Collections;
namespace FreeType {
[StructLayout(LayoutKind.Sequential)]
@armornick
armornick / jquery.mustache.js
Created May 20, 2012 18:04
Mustache.js jQuery
/*
Shameless port of a shameless port
@defunkt => @janl => @aq
See http://github.com/defunkt/mustache for more info.
*/
;(function($) {
/*!
@armornick
armornick / openicon.c
Created August 23, 2012 08:47
Draw an Image with SDL2
#include <stdio.h>
#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#define WIDTH 800
#define HEIGHT 600
#define IMG_PATH "exit.png"
int main (int argc, char *argv[]) {
@armornick
armornick / playwav.c
Created August 24, 2012 07:31
Play a sound with SDL2 (no SDL_Mixer)
#include <SDL2/SDL.h>
#define MUS_PATH "Roland-GR-1-Trumpet-C5.wav"
// prototype for our audio callback
// see the implementation for more information
void my_audio_callback(void *userdata, Uint8 *stream, int len);
// variable declarations
static Uint8 *audio_pos; // global pointer to the audio buffer to be played
@armornick
armornick / pygame2exe.py
Created August 27, 2012 19:19
Pygame Py2exe Setup Script
# This will create a dist directory containing the executable file, all the data
# directories. All Libraries will be bundled in executable file.
#
# Run the build process by entering 'pygame2exe.py' or
# 'python pygame2exe.py' in a console prompt.
#
# To build exe, python, pygame, and py2exe have to be installed. After
# building exe none of this libraries are needed.
#Please Note have a backup file in a different directory as if it crashes you
#will loose it all!(I lost 6 months of work because I did not do this)
@armornick
armornick / sdl2mixer.c
Created August 28, 2012 10:40
Using SDL_Mixer with SDL2
#include <SDL2/SDL.h>
#include <SDL2/SDL_mixer.h>
#define WAV_PATH "Roland-GR-1-Trumpet-C5.wav"
#define MUS_PATH "HR2_Friska.ogg"
// Our wave file
Mix_Chunk *wave = NULL;
// Our music file
Mix_Music *music = NULL;
@armornick
armornick / gist:3600378
Created September 2, 2012 15:17
Love2d Resource Manager
-- exporting table
local exports = {}
-- table containing the resources
local resources = {}
local imagepath = "image"
local soundpath = "sounds"
local fontpath = "fonts"
-- add image to resource manager
@armornick
armornick / .hxcpp_config.xml
Created December 9, 2012 19:38
HxCpp config for Mingw
<!--
This file will get included twice - once at the beginning - once at the end.
The first time though, the "vars" section is parsed, and this is where you can
set variables to control the setup of the standard compilers and install paths etc.
The second time, the "exes" section is parsed, and you can modify the linkers/compilers
by adding flags to these executables.
@armornick
armornick / parser.lua
Last active December 21, 2015 15:58
Kaleidoscope parser made with LPeg
-- debug helper function
function _dump (t)
local ttype = type(t)
if ttype == "table" then
local vals = {}
for k,v in pairs(t) do
table.insert(vals, _dump(k) .. " = " .. _dump(v))
end
return "{"..table.concat(vals, " , ").."}"
elseif ttype == "string" then
//// seed.c ///////////////////////////////////////////////////////////////////
// seed is a lua executable which loads data and lua code embedded in the
// executable. Specifically, it loads from a zip file concatenated to its
// executable. Initially /init.lua from the zip file is run, and a loader is
// added to package.loaders so that 'require' searches inside the zip file. If
// a module is not found in the archive, then the default loaders are used.
//
// In addition to using 'require', lua files can be loaded with seed.loadfile,
// which is like loadfile except that it gets the file from inside the archive.
// Basic reading of arbitrary files from the archive is supported.