Skip to content

Instantly share code, notes, and snippets.

Quick Reference for SDL2
========================
Includes both prototypes and short examples of using the call.
int SDL_Init(Uint32 flags)
SDL_Init(SDL_INIT_VIDEO|SDL_INIT_AUDIO);
void SDL_Quit(void)
atexit(SDL_Quit);
const char* SDL_GetHint(const char* name)
@kulp
kulp / dehex.c
Created April 21, 2009 20:56
Convert a hex string into integer or character buffer
static inline char _hexify(const char c)
{
return (((c | ('A' ^ 'a')) - '0') % 39);
}
/// Converts a len-digit hex number into its unsigned native representation.
unsigned int dehex_to_int(int ilen, const char ibuf[ilen])
{
unsigned int result = 0;
@kulp
kulp / tree_macro.pl
Created March 30, 2010 22:54
Generates CPP macros for mapping arbitrary integer sets to small integer sets
#!/usr/bin/env perl
use strict;
use List::Util qw(max);
my $name = "b";
# for each significant bit position, where the sequence through the bit
# positions is chosen such that each bit chosen divides the remaining
# search space as nearly evenly as possible, construct an array that
# looks like this:
@Proplex
Proplex / DHT_Servers
Last active June 23, 2016 08:00
Tox Bootstrap servers
You can pick anyone of these servers, they all are linked together.
192.81.133.111 33445 8CD5A9BF0A6CE358BA36F7A653F99FA6B258FF756E490F52C1F98CC420F78858
66.175.223.88 33445 B24E2FB924AE66D023FE1E42A2EE3B432010206F751A2FFD3E297383ACF1572E
192.184.81.118 33445 5CD7EB176C19A2FD840406CD56177BB8E75587BB366F7BB3004B19E3EDC04143
192.210.149.121 33445 F404ABAA1C99A9D37D61AB54898F56793E1DEF8BD46B1038B9D822E8460FAB67
81.224.34.47 443 48F0D94C0D54EB1995A2ECEDE7DB6BDD5E05D81704B2F3D1BB9FE43AC97B7269
198.46.136.167 33445 728925473812C7AAC482BE7250BCCAD0B8CB9F737BF3D42ABD34459C1768F854
95.47.140.214 33445 F4BF7C5A9D0EF4CB684090C38DE937FAE1612021F21FEA4DCBFAC6AAFEF58E68
54.215.145.71 33445 6EDDEE2188EF579303C0766B4796DCBA89C93058B6032FEA51593DCD42FB746C
@OrangeTide
OrangeTide / bitfield.h
Created April 7, 2011 17:47
bitfield macros
/* bitfield.h - bitfield macros */
/*
* PUBLIC DOMAIN - NO COPYRIGHT CLAIMED - Jonathan Mayo - July 2005
*
* Updated January 2010
*/
#ifndef BITFIELD_H
#define BITFIELD_H
#include <limits.h>
@OrangeTide
OrangeTide / cube_vbo.c
Created April 25, 2015 04:56
Drawing a cube in OpenGL using VBOs. (required SDL2)
/* cube_vbo.c - demo of drawing a cube in GL using VBOs.
*
* PUBLIC DOMAIN - Jon Mayo - April 24, 2015
*
* Requires SDL2
*
* To build:
* gcc -Wall -W -o cube_vbo cube_vbo.c `pkg-config --libs --cflags sdl2 gl`
*
*/
@nezumisama
nezumisama / glxgears_rgba.c
Created December 28, 2013 17:36
Modified glxgears showing how to create alpha-enabled OpenGL rendering contexts on X11.
/* building:
gcc glxgears_rgba.c -o glxgears_rgba -lGL -lX11 -lm -lXrender
*/
/*
* Copyright (C) 1999-2001 Brian Paul All Rights Reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
@DeMarko
DeMarko / 00_netrunner_inserts.md
Last active April 28, 2019 23:59
Netrunner Data Pack and Expansion Inserts
Title Have It? Transcribed Content
What Lies Ahead X X Whizzard
Trace Amount X Not transcribing Excerpt from Android: Free Fall
Cyber Exodus X X Chaos Theory
A Study in Static X Not transcribing Excerpt from Android: Golem (The Identity Trilogy)
Humanity's Shadow X X Andromeda
Future Proof X Not transcribing Excerpt from Android: Strange Flesh
Creation and Control X X / X Thomas Haas / Rielle "Kit" Peddler
Opening Moves X X Press Release / For Immediate Release
@OrangeTide
OrangeTide / bananabread.md
Last active April 2, 2020 03:31
Banana Bread recipe

Banana Bread

Ingredients

  • 2 c flour
  • 1 c sugar
  • 1 1/2 tsp baking powder
  • 1/2 tsp baking soda
  • 1/4 tsp salt
@BlockoS
BlockoS / openDisplay.c
Created December 9, 2009 20:57
Smallest possible raw X11 init
//// TODO :: 3. Clean up
//// 4. Events
//// 5. Create a colormap
//// 6. glx ?
#ifdef DEBUG
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <sys/un.h>
#include <sys/select.h>