shoes / shoes3

a tiny graphical app kit for ruby
http://walkabout.mvmanila.com
Other
180 stars 19 forks source link

keypress doesn't handle non-modifier combination keys #47

Open IanTrudel opened 9 years ago

IanTrudel commented 9 years ago

Keypress currently handles keys and modifier combination keys well. It is possible to make all kind of combinations with ctrl/cmd, alt and shift or all of those together. Normal key combinations is however impossible to catch, such as pressing left and up key at the same time, or two or more letters.

Why should we care? Games sometimes require handling such key combinations.

Shoes.app {
   keypress { |n| para n }
}
ccoupe commented 6 years ago

Perhaps some games may poll the native keyboard using the plaftorm API for raw keys. Shoes would need a very clever state machine (aka buggy and untestable for all situations and platforms). The best you can expect is to write your own with #383. Very difficult to do.

IanTrudel commented 6 years ago

Perhaps some games may poll the native keyboard using the plaftorm API for raw keys.

That could work with raw keys. A poll with an iterator, e.g. next. It would certainly prevent losing keys.

The best you can expect is to write your own with #383.

It would be acceptable as long as the key event doesn't loose key. Perhaps it would be more work on the game programmer side but it is customary in game programming world to do such things.