Skip to content

Instantly share code, notes, and snippets.

@progschj
progschj / gist:5868976
Created June 26, 2013 16:30
WiP orbital mechanics code
#include <iostream>
#include <cmath>
#include <utility>
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
const double G = 6.674e-11; // gravitational constant
const double PI = 3.14159265358979323846;
@progschj
progschj / on_destroy.hpp
Created April 8, 2013 00:14
Helper class to use "RAII" with nonpointer objects
#ifndef ON_DESTROY_H
#define ON_DESTROY_H
#include <functional>
#include <utility>
class on_destroy {
public:
on_destroy() { }
template<class F, class... Args>
@progschj
progschj / TwinStick.cpp
Created March 26, 2013 10:05
A simple multiplayer "twin stick shooter" done during 3h hours at a gamespace.ch meet and make. I started with this: https://github.com/progschj/OpenGL-Examples/blob/master/02indexed_vbo.cpp and just added stuff from there. It has only been tested with two wireless xbox360 controllers.
/* 3h Twin stick shooter
* Autor: Jakob Progsch
*/
#include <GL3/gl3w.h>
#include <GL/glfw.h>
#include <iostream>
#include <string>
#include <vector>
#include <iostream>
#include <memory>
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <LuaBridge/LuaBridge.h>
@progschj
progschj / A.cpp
Last active December 11, 2015 07:09
Testcase for Luabridge Placing luabridge "registration" into different translation units can lead to types not being recognized correctly
#include "A.hpp"
#include <iostream>
#include <string>
#include <LuaBridge/LuaBridge.h>
std::string A::getName() const { return std::string("A"); }
void A::register_lua(lua_State *L)
@progschj
progschj / glwt_event.h
Created November 10, 2012 14:47
GLWT event prototype
#define GLWT_EVENT_INPUT 1
#define GLWT_EVENT_WINDOW 2
#define GLWT_EVENT_HOTPLUG 3
#define GLWT_EVENT_INPUT_KEY 1
#define GLWT_EVENT_INPUT_BUTTON 2
#define GLWT_EVENT_INPUT_ABS 3
#define GLWT_EVENT_INPUT_REL 4
#define GLWT_EVENT_WINDOW_RESIZE 1
@progschj
progschj / vorbisplay.c
Created October 13, 2012 19:54
A Simple Ogg Vorbis Player using libvorbisplay and OpenAL
#include <stdlib.h>
#include <stdio.h>
#include <AL/alut.h>
#include <vorbis/codec.h>
#include <vorbis/vorbisfile.h>
char pcmout[16*1024];
void check_error()
{