Status update
| Published: | Comments: 5 | Filed under: Development
I just wanted to make a quick post about where Rubygame is now.
I finished the changes I mentioned last time about :left_shift and :right_shift being matched by :shift for keyboard triggers. Here's how I wrote the code, if you're curious:
# @mods is the array of modifiers for the trigger.
# evmods is the array of modifiers for the event.
def _mods_match?( evmods )
@mods.all? { |mod|
case mod
when :alt, :ctrl, :meta, :shift
evmods.include?("left_#{mod}".intern) or
evmods.include?("right_#{mod}".intern)
else
evmods.include?(mod)
end
}
end
In addition to supporting general modifiers (vs left/right specific), this code is a lot more forgiving than before. Originally, I had just checked evmods == @mods, which was rather stupid of me, because [:shift, :ctrl] == [:ctrl, :shift] would fail, even though they are equivalent in this context.
All the work that remains for 2.4 is writing documentation and specs for the event actions, event hook, and the HasEventHandler mixin. Unfortunately, that's not the kind of work that motivates me to take time out of my day to finish it. I've got the 2 hours per week scheduled, but I may need to increase that and push hard until 2.4 is done.
Comments