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: Tue, 26 Oct 2010 21:41:34 +0200

On Sun, Oct 24, 2010 at 9:40 PM, Kai Sterker <address@hidden> wrote:

> That would be good. I've seen that there is code that tries to convert
> repeated events as you might get from keeping a button pushed into a
> single event. Maybe something is fishy with that. Have a look at
> src/input/sdl/manager_sdl.cc, starting from line 561. Should be simple
> to debug with a gamepad around to trigger the events as needed.

Here's my suspicion (src/input/sdl/manager_sdl.cc:566):

    int axisnbr = (event.jaxis.axis << 1) + (event.jaxis.value > 0);

SDL itself references each axis with a number from 0 to n. We,
however, split that into two numbers (left/right, up/down). And here's
the flaw. If you have a digital gamepad, then I'd imagine that you
always get a value of 0 for the neutral position. In that case, the
axis number calculated above is only right in one direction. Since the
state of the wrongly calculated axis is already released, no event is
fired and the state of the correct axis is not reset. So when you
press again, we look into our table and see that the axis is already
pressed, hence we do not fire another event. And that explains exactly
the behaviour you are seeing. On pushed event, then silence ...

Now as to a fix ... I guess a value of 0 will have to check both axis
(and release the one that is pushed, if any).

Would be cool if you could try the new implementation. Sorry if I was
too fast to give you a chance to debug. But the issue suddenly was
clear to me (I hope!) and I just had to give it another look.

Kai



reply via email to

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