Skip to content

Instantly share code, notes, and snippets.

@sojastar
sojastar / haskell_sdl2_setup.md
Created February 19, 2024 10:28
Setting up a basic Haskell SDL2 application on MacOS

1. Install SDL2 with homebrew:

$> brew install sdl2

and optionally:

$> brew install sdl2_image
$> brew install sdl2_mixer
$> brew install sdl2_gfx
$> brew install sdl2_ttf
CC=gcc
CFLAGS=-std=c99 -lm
MRUBY_INCLUDE=../../mruby-3.1.0/include
MRUBY_LIB=../../mruby-3.1.0/build/host/lib/libmruby.a
SOURCE=c_from_ruby
all:
$(CC) $(CFLAGS) -I$(MRUBY_INCLUDE) $(SOURCE).c -o $(SOURCE) $(MRUBY_LIB)
clean:
@sojastar
sojastar / keymap.rb
Created May 26, 2020 07:52
Key mapping swap for DragonRuby
module KeyMap
def self.set(mapping)
mapping.each_pair do |command,key|
GTK::KeyboardKeys.send :alias_method, command, key
end
end
def self.unset(mapping)
mapping.each_pair do |command,key|
GTK::KeyboardKeys.send :undef_method, command