Created
May 14, 2009 21:06
-
-
Save NakedMoleRatScientist/111922 to your computer and use it in GitHub Desktop.
Rubygame should crash not keep going!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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