Skip to content

Instantly share code, notes, and snippets.

View Voldrix's full-sized avatar

Ben Goriesky Voldrix

View GitHub Profile
@CoryBloyd
CoryBloyd / SDLblit.cpp
Last active June 8, 2024 09:24
Minimal code to set up a window in SDL and blit from CPU RAM to the window
// This work (SDLblit.cpp, by Cory Bloyd) is free of known copyright restrictions.
// https://creativecommons.org/publicdomain/zero/1.0/
#include <SDL.h>
inline uint32_t argb(uint8_t a, uint8_t r, uint8_t g, uint8_t b) { return (a<<24) | (r << 16) | (g << 8) | (b << 0); }
int main(int argc, char *argv[]) {
SDL_Init(SDL_INIT_VIDEO);
SDL_Rect screenRect = { 0,0,1024,1024 };
@pkulak
pkulak / gist:61de475a74d824a9d875
Created February 10, 2015 23:41
Roku BIF File JavaScript Parser
// Takes an ArrayBuffer; returns an array of these objects:
// {
// seconds: *number of seconds into the video of this image*,
// bytes: *the bytes of this image, as an ArrayBuffer*
// }
var parseBif = function(buffer) {
var data = new Uint8Array(buffer);
// Make sure this really is a BIF.
var magicNumber = [0x89, 0x42, 0x49, 0x46, 0x0d, 0x0a, 0x1a, 0x0a];