Skip to content

Instantly share code, notes, and snippets.

@NakedMoleRatScientist
Created May 14, 2009 21:06
Show Gist options
  • Select an option

  • Save NakedMoleRatScientist/111922 to your computer and use it in GitHub Desktop.

Select an option

Save NakedMoleRatScientist/111922 to your computer and use it in GitHub Desktop.
Rubygame should crash not keep going!
require"rubygems"
require"rubygame"
include Rubygame
class LoopThrough
include Rubygame::EventHandler::HasEventHandler
def initialize
@screen = Screen.new([800,600],0,[Rubygame::HWSURFACE,Rubygame::DOUBLEBUF])
@q = Rubygame::EventQueue.new()
@q.enable_new_style_events()
end
def quit
exit
end
def queue_through
@q.each do |ev|
handle(ev)
end
end
def mode
hook_move()
hook_quit()
catch(:quit) do
loop do
queue_through()
end
end
exit
end
def left
puts"success"
let_fail()
end
def hook_move
move = {
:left => :left
}
make_magic_hooks(move)
end
def hook_quit
quit = {
:escape => :quit
}
make_magic_hooks(quit)
end
end
test = LoopThrough.new()
test.mode()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment