adonthell-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Adonthell-devel] GUI question


From: Kai Sterker
Subject: Re: [Adonthell-devel] GUI question
Date: Sat, 16 Oct 2010 13:06:03 +0200

On Fri, Oct 15, 2010 at 11:55 PM, James Nash <address@hidden> wrote:

> Can we have multiple keys / buttons point to the same action?

In theory yes. In practice, I'll have to check how the configuration
data is stored. If it's kept in a hash map, then we have no way to
configure it that way right now.

> If so perhaps we could reserve the arrow keys (and I suppose D-pad on a 
> controller) to always do directions and not be re-configurable. That way, 
> even if players have also assigned other buttons to duplicate the arrow keys 
> (e.g. WSAD) we can override that in special cases like a text field and use 
> the letter keys for typing. Since the arrow keys are reserved they're still 
> able to navigate around the text field then.

I'd avoid special cases just for textfields, since the focus
handling/movement is outside the textfield itself. The way I'd like to
implement it right now is to convert gamepad input into the matching
control action as a first step. Then this action (if any) will be
converted to the default key on the keyboard for that action. That has
the following benefits:

* there is already a default key mapping used to generate the initial
configuration. We can reuse it for that purpose.
* Mapping gamepad buttons not directly to keyboard keys makes us
independent of differences between individual controllers. Once the
user configured that left is this button and right that and action is
that and cancel this, etc. it'll be the same buttons for in game
controls and the GUI.

The implementation is very simple then. For every gamepad event the
GUI receives, we do the two-way conversion (2 method calls) and if a
valid key comes out, fire a fake keyboard event. All in all, 4 lines
of code.

Of course, we'd need somebody with a gamepad to actually test :-).

Kai



reply via email to

[Prev in Thread] Current Thread [Next in Thread]