$> brew install sdl2
and optionally:
$> brew install sdl2_image
$> brew install sdl2_mixer
$> brew install sdl2_gfx
$> brew install sdl2_ttf
| 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 |
| 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: |
| module Collisions | |
| def self.aabb_rect_vs_rect(rect1,rect2) | |
| rect1[0] < rect2[0] + rect2[2] && | |
| rect1[0] + rect1[2] > rect2[0] && | |
| rect1[1] < rect2[1] + rect2[3] && | |
| rect1[1] + rect1[3] > rect2[1] | |
| end | |
| def self.resolve_collisions_with_rects(position,size,velocity,rects) | |
| # First round of collision testing that will teel us ... |