Skip to content

Instantly share code, notes, and snippets.

View icculus's full-sized avatar

Ryan C. Gordon icculus

View GitHub Profile
#!/bin/bash
#
# SDL 2.0.4 Bug-"Count" Checker for Mac OS X or KDE
# Version 1.6
#
# Requirements:
# - any one of the following command-line notification tools:
# - Growl and growlnotify, for Mac OS X, available at http://growl.info
# - kdialog, for KDE
# - notify-send, for generic Linux notifications
@icculus
icculus / sdl-vulkan-explanation.cpp
Created September 3, 2017 18:47
SDL vulkan explanation...
/*
Ok, I answered too quickly, and Twitter is terrible for this, so have a gist.
You call this function twice: the first time with a NULL and it just sets
extension_count to the number of strings it plans to give you, so you can
allocate space for them and call the function again.
*/
// (you should check return values for errors in all this, but whatever.)
unsigned int count = 0;
@icculus
icculus / mame-emscripten-errors.txt
Created October 26, 2017 18:41
Running out of memory linking Emscripten MAME...
Linking mame.bc...
WARNING:root:emcc: cannot find library "util"
WARNING:root:emcc: cannot find library "SDL2_ttf"
Running post-build commands
/Users/icculus/Desktop/emsdk_portable/emscripten/1.37.9/emcc -O3 -s USE_SDL=2 -s USE_SDL_TTF=2 --memory-init-file 0 -s ALLOW_MEMORY_GROWTH=0 -s TOTAL_MEMORY=268435456 -s DISABLE_EXCEPTION_CATCHING=2 -s EXCEPTION_CATCHING_WHITELIST='["__ZN15running_machine17start_all_devicesEv","__ZN12cli_frontend7executeEiPPc"]' -s EXPORTED_FUNCTIONS="['_main', '_malloc', '__ZN15running_machine30emscripten_get_running_machineEv', '__ZN15running_machine17emscripten_get_uiEv', '__ZN15running_machine20emscripten_get_soundEv', '__ZN15mame_ui_manager12set_show_fpsEb', '__ZNK15mame_ui_manager8show_fpsEv', '__ZN13sound_manager4muteEbh', '_SDL_PauseAudio', '_SDL_SendKeyboardKey', '__ZN15running_machine15emscripten_saveEPKc', '__ZN15running_machine15emscripten_loadEPKc', '__ZN15running_machine21emscripten_hard_resetEv', '__ZN15running_machine21emscripten_soft_resetEv', '__ZN15running_machine15
# This is the complete source code to Flappy Dragon:
# https://dragonruby.itch.io/flappydragon
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class FlappyDragon
attr_accessor :grid, :inputs, :game, :outputs
@icculus
icculus / basicgorillas.rb
Last active June 21, 2023 02:10
DragonRuby Basic Gorillas
# This is the complete source code to Basic Gorillas:
# https://dragonruby.itch.io/basicgorillas
#
# You can tinker with this by getting a copy of DragonRuby Game Toolkit:
# https://dragonruby.org/
#
# Amir Rajan wrote this game, catch him at https://twitter.com/amirrajan !
class YouSoBasicGorillas
attr_accessor :outputs, :grid, :game, :inputs
@icculus
icculus / dragonruby-html5-loader-little-piece.js
Created May 20, 2019 04:59
Choose WebAssembly or asm.js at runtime
var hasWebAssembly = false;
if (typeof WebAssembly==="object" && typeof WebAssembly.Memory==="function") {
hasWebAssembly = true;
}
//console.log("Do we have WebAssembly? " + ((hasWebAssembly) ? "YES" : "NO"));
var buildtype = hasWebAssembly ? "wasm" : "asmjs";
var module = "dragonruby-" + buildtype + ".js";
$gtk.reset
class TetrisGame
# This is just to get GTK to not complain in the console for now.
def serialize ; { args: '' } ; end
def inspect ; serialize.to_s ; end
def to_s ; serialize.to_s ; end
def render_cube_pixelpos x, y, r, g, b, a=255
@args.outputs.solids << [ x, y, @boxsize, @boxsize, r, g, b, a ]
@icculus
icculus / main.rb
Created March 23, 2020 20:44
Tetris in DragonRuby, code at the end of Part 1
# This is the code as it stands at the end of
# "Let's make Tetris with DragonRuby Game Toolkit!" Part 1:
# https://www.youtube.com/watch?v=xZMwRSbC4rY
$gtk.reset
class TetrisGame
def initialize args
@args = args
@next_move = 30
@icculus
icculus / main.rb
Created March 24, 2020 07:22
Tetris in DragonRuby, code at the end of Part 2
$gtk.reset
class TetrisGame
def initialize args
@args = args
@next_piece = nil
@next_move = 30
@score = 0
@gameover = false
@grid_w = 10
@icculus
icculus / fnsince.txt
Created October 26, 2021 16:15
SDL/build-scripts/fnsince.pl output on Oct 26 2021...
SDL_AddEventWatch: 2.0.0
SDL_AddHintCallback: 2.0.0
SDL_AddTimer: 2.0.0
SDL_AllocFormat: 2.0.0
SDL_AllocPalette: 2.0.0
SDL_AllocRW: 2.0.0
SDL_AndroidGetActivity: 2.0.0
SDL_AndroidGetExternalStoragePath: 2.0.0
SDL_AndroidGetExternalStorageState: 2.0.0
SDL_AndroidGetInternalStoragePath: 2.0.0