Lots of poking around in the guts of events today. Most notable is that I threw out all the keyboard integer constants, as I was talking about a week ago. No more
Likewise for mouse integer constants; I changed them to
:mouseN where N is the mouse button number. So, the left mouse is
:mouse1, middle is
:mouse2, right is
:mouse3, wheel-up is
:mouse4, and wheel-down is
:mouse5. I'm torn between the mouse numbers and the mouse button names.
:mouse_left might be nice. The nice thing about the numbered scheme is that it supports an arbitrary number of buttons (got any 10-buttoned mice lying around? It'll probably work!). Also, it doesn't make any assumptions about which button is where (e.g., mouse buttons 4 & 5 are usually, but sometimes not, mouse wheel-up and wheel-down).
Next I'll probably get rid of the Surface/Screen integer flags, as I also mentioned. Death to the integer constants! Long live the symbol!
And now for something completely different...
I had an idea for making it even more convenient to add an event hook to sprites/scenes. I figure that, by and large, most event hooks that developers will create are of the form "press this -> character does that". So, why not have a factory function to create new event hooks that call a method in the sprite? Something like this:
Wolud be equivalent to:
sprite.append_hook( :owner => sprite, :trigger => KeyDownTrigger(:up), :action => MethodAction(:jump) )
Which means "when the user presses the up arrow, call sprite#jump".
Of course, there wolud be similar factory functions for mouse clicks, etc.