[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: Key pressed/released actions for games
From:       Andreas Zehender <az () azweb ! de>
Date:       2000-05-05 19:42:20
[Download RAW message or body]

David Faure wrote:
> 
> On Fri, May 05, 2000 at 07:03:08PM +0200, Andreas Zehender wrote:
> > Hi!
> >
> > I use the following in my game kspaceduel: A ship rotates when a special
> > key is pressed. To make this smooth I have to catch keyPressed and
> > keyReleased events of single keys.
> >
> > How can this be done with KActions?
> >
> > What I would need is an action with a "bool pressed( )" method, that is
> > restricted to single keys without modifiers (shift, ctrl, alt).
> >
> > At the moment I have two key configuration dialogs: The standard
> > configure key bindings and a dialog for game keys. It would be nice if
> > all can be configured with the standard one.
> 
> Hmm, that would be using a KAccel, no ?
> 
> A KAction is meant to be plugged into a menubar/toolbar/...
> A KAccel is more what you're looking for I think.
> 

Ok, but the original problem still remains.

A KAccel sends only a signal if the key is pressed, but not if the key
is released.
I could compare the key of the key event with the accel key. But since
key bindings can have modifiers (shift...), this will not work.

Hmmm, a intelligent user will not choose modifiers, but I don't want to
get mails that the ships cannot rotate any more :-)

Any possibility to prevent this?
Any more ideas?

I am making my game more kde compliant at the moment (toolbar, xml-gui,
actions, kdialogbase...), so I looked for a solution to get rid of the
game key configuration dialog.

Greetings, Andreas

---------------------------------------------------------
 Andreas Zehender                    http://www.azweb.de
 BA-Stuttgart                        mailto:az@azweb.de
 6. Semester                ////         
 Informationstechnik       (o o)
-----------------------oOO--(_)--OOo---------------------

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic