Rubygame 3: Days 31 & 32

Not much to report for Day 31 (yesterday) except that I checked in the updated demo that I posted a screenshot of. As I mentioned last time, work deadlines took priority yesterday, so no time for Rubygame.

Today, I made several enhancements to the "magic_hooks" method:

  1. The left value in each pair (the trigger) can now be a class to magically create a hook which matches events of that class.
  2. The right value in each pair (the action) can now be a Proc (or Method) to make a hook that calls the Proc, passing in the hook owner and the event that triggered it. This was suggested by a comment in the previous post. Thanks, Brian!

I also tweaked MethodAction so that methods don't have to take the event as an argument; if you want, they can take no arguments at all, and it'll work just fine now.

And lastly, I've converted Screen and Surface to use :symbols instead of integer constants for its flags (:fullscreen, :noframe, etc.). Although there's something suspicious going on, as certain flags never seem to stick (like :hardware and :colorkey) while others do fine (like :resizable and :fullscreen). Will have to poke at it more tomorrow.


Have something interesting to say about this post? Email your thoughtful comments to