开发者

Dealing with simultaneous button presses and changing shift states

I am currently working on a (Python2.5) application which handles input from a game controller. We've designated a button as a shift button to change the mapping (inputtype,value->function) of the other buttons on the fly. The mapping also depends on the mode our application is running in. We are running into lots of hairy edge cases (e.g. how to handle press shift, press button x, release shift, release button x) and I was wondering if开发者_开发百科 there are any known good structures/architectures/patterns for dealing with this kind of input?


Satemachines are a good pattern to handle complex inputs.

Here is a machine that handle the above sequence.

Dealing with simultaneous button presses and changing shift states

You can implement statemachines with switch or state pattern (see Python state-machine design )

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜