Keyboard Triggers

Just posting a reminder to myself to improve keyboard triggers to be better about modifier keys. Right now you have to specify (as one example) either :left_shift or :right_shift, but there's no way to say "I don't care which shift it is, as long as shift is being pressed. So I need to make it able to take :shift and have that match either the right or left versions. The same applies for ctrl, alt, etc. (I was writing the documentation for KeyPressTrigger, and I noticed I couldn't write an example of a trigger that matches Ctrl+Shift+A, without caring about left/right, without using two triggers nested in an AnyTrigger.)

I also want to improve magic hooks so that you can specify "Ctrl+Shift+A" and it will translate that into KeyPressTrigger.new( :a, [:ctrl, :shift] ). Because that would be really handy. But maybe that can wait until after 2.4? Dunno.

Update: Finished the docs for the event triggers, and pushed them to Github in the event_handler branch.


Comments

atiaxi submitted a comment on #

My solution, thus far, has been to treat the symbol as a string and search for ‘ctrl’ or ‘shift’.

But I’m not using magic hooks yet :)

kiba submitted a comment on #

so you’re still alive!

shawn42 submitted a comment on #

rubygoo checks both for its text widget, it will be great to have these shortcuts available. Keep up the good work, but I do wish we’d see you in IRC more often; if not just to answer questions (no off topic stuff).

sparkymat submitted a comment on #

string-search for ctrl/shift wouldn’t be very efficient or clean right? :something_shift would match as well …

if :shift is present, then check for either of :left_shift or :right_shift

Have something interesting to add to the discussion? Email your thoughtful comments to comments@rubygame.org.