Zeit-100 / grafx2

Automatically exported from code.google.com/p/grafx2
0 stars 0 forks source link

Improved joystick handling and key combos #175

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The gp2x has only 18 buttons. To have a sufficient number of actions, it's 
needed to use key-combos. Currently this is done by having L, R and stick 
click button acting as Shift, Ctrl and Alt.

First problem is we are using the same variable for keyboard and joystick 
and Alt is using a bit in this table that interferes with the buttons. It 
still works, but the keyname display is broken in the helpscreens.

Second problem is there is no point in calling these keys Ctrl, Shift and 
Alt. They should appear as R, L and stick.

Third problem is we should allow "any" key combo to be mapped to an 
action. This is quite complex to do because
a) There is no way to store the info in the current system. We would have 
to use a 18-bit bitfield (it could be made to fit in 16bit by encoding up/
down/left/right/stickclick in only 3 bits, as you can't get two of them 
used at the same time)
b) If the user choose an action for B, and another one for A+B, the one 
triggered by A+B will be recognised only if A is pressed first. There is 
no way to take the order of actions into account right now
c) If the user select an action for A and another one for A+B, this will 
mean no action would be taken until A is released and no other button has 
been pressed. If he chose A as "mouse click", he can't draw anymore !
d) When you use R+(up down left right) to scroll arountd the picture, once 
you move, R is mistakenly marked as released. So if you want to move, you 
have to keep moving the stick back and forth to get where you want to.

So, to sum up :
-Actions have to be started when the user press the last key of the combo
-This mean we must not allow A and A+B to be defined at the same time, nor 
A+B and A+B+C. However A+B and A+C is valid.
-If the user does A+B, release B, then press C, both A+B and A+C are 
trigered. State of A must not be reset when the action is launched.
-If the user does A+B, releases A, then press C, do we launch B+C ?

Original issue reported on code.google.com by pulkoma...@gmail.com on 9 Jun 2009 at 8:09

GoogleCodeExporter commented 8 years ago
1> Alt is using a bit in this table that interferes with the buttons
It must be a bug, because the values are not supposed to intersect. See the 
docs at
top of keyboard.h: We can use values up to 0x07FF (2047).  SDLK_LAST is 322 on
Windows and Linux, even if you add 4 + 18, there's still much room left. Maybe
SDLK_LAST has a different value on the gp2x ? But then, can a USB keyboard 
really
work on it ?

2> There is no point in calling these keys Ctrl, Shift and Alt. They should 
appear as
R, L and stick.
The point is that you said people can plug a USB keyboard to those consoles, so 
I
shouldn't eliminate keyboard support.
If you prefer to show button names instead of shift, control etc, then on GP2X 
you
can choose to display the label of the button whose number is in 
"Joybutton_shift"
variable, etc.

3> we should allow "any" key combo to be mapped
I would really recommend against it.
The idea that some buttons are RESERVED as modifiers makes things much more 
sane, and
we can already handle 4-key combinations. Such system can be very powerful: I 
played
the Genesis version of Syndicate, and it had a very unique control system where 
A and
the joystick directions had a different behavior depending on the states of B 
and C
(which were only modifiers). It allowed everything, with no cursor-driven menu
anywhere: from moving and shooting to altering the 3 stats and managing the 
inventory
(pick up, browse, drop, wield weapon or conceil it), and selecting any 
combination of
the 4 agents you can control at the same time.

In short, before spending more time on it, I'd recommend to think exactly what 
config
you would set if the program allowed it.

Original comment by yrizoud on 9 Jun 2009 at 10:21

GoogleCodeExporter commented 8 years ago
1>
SDLK_Last can be any value and it will not affect an usb keyboard, even if not 
all 
the keycodes are used.
What I see is Shift + [UP], but Alt + "mac command symbol" + a weird number

2>
Right, we need to differenciate more between keyboard and stick. What happens 
now is 
that some buttons are intercepted and translated as keyboard events, and the 
function that writes the name of keys to the screen doesn't differenciate them

3>
Ok, we may reserve some buttons as modifiers, but at least make them settable 
in the 
helpscreen.
And then, what happens if someone decide to change the modifier ? Do we have to 
go 
trough all the shortcuts and swap occurences of the new modifier to put the old 
one 
instead ?

Last note :
The stick is intercepted as mouse event as hardcoded setup, it could go trough 
the 
shortcuts system. We should actually provide joystick shortcuts for some things 
as 
primary shortcut on the gp2x (keyboard would then be the secondary one). So 
here 
again we need a slightly different config for the gp2x...

Original comment by pulkoma...@gmail.com on 10 Jun 2009 at 9:34

GoogleCodeExporter commented 8 years ago

Original comment by pulkoma...@gmail.com on 2 Sep 2009 at 9:43

GoogleCodeExporter commented 8 years ago

Original comment by pulkoma...@gmail.com on 15 Sep 2009 at 7:13

GoogleCodeExporter commented 8 years ago

Original comment by pulkoma...@gmail.com on 15 Jan 2010 at 7:34