Skip to content

Instantly share code, notes, and snippets.

View cdave1's full-sized avatar
💭
I may be slow to respond.

David Petrie cdave1

💭
I may be slow to respond.
View GitHub Profile
@cdave1
cdave1 / gist:10563386
Created April 13, 2014 00:21
Play an mp3 with SDL2
#include "SDL2/SDL.h"
#include "SDL2/SDL_mixer.h"
static const char *MY_COOL_MP3 = "cool_tunes.mp3";
int main(int argc, char **argv) {
int result = 0;
int flags = MIX_INIT_MP3;
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
@cdave1
cdave1 / ftglesGlueAndroid.c
Created March 29, 2011 23:58
Changes to ftglBegin and ftglEnd on android...
GLvoid ftglBegin(GLenum prim)
{
if (!ftglesQuadIndicesInitted)
{
for (int i = 0; i < FTGLES_GLUE_MAX_VERTICES * 3 / 2; i += 6)
{
int q = i / 6 * 4;
ftglesGlueArrays.quadIndices[i + 0] = q + 0;
ftglesGlueArrays.quadIndices[i + 1] = q + 1;
ftglesGlueArrays.quadIndices[i + 2] = q + 2;
@cdave1
cdave1 / gist:801522
Created January 29, 2011 04:10
Dot product shadow intensity lookup table...completely broken and slow
static bool hasGeneratedLookup = false;
#define DOT_LOOKUP_SIZE 1024
#define DOT_LOOKUP_BITMASK 1023
static uint8 colorDotLookup[DOT_LOOKUP_SIZE];
/*
* Below code - waste of time; too slow.
*/
inline uint8 hdColorDot(float color, float normal)
{
unsigned i;
@cdave1
cdave1 / Poker tool pseudocode
Created November 26, 2010 07:14
Noodling around with an idea, code is unfinished...
struct card { short suit, short value }
struct player { card first, card second }
struct middle { card flop1, card flop2, card flop3, card turn, card river }
player players[ ]
int my_position
card cards[52]