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

List:       kde-games-devel
Subject:    [Kde-games-devel] Fwd: help needed
From:       Josef Spillner <dr_maux () maux ! de>
Date:       2001-09-25 18:37:41
[Download RAW message or body]

The following just came in:

-snip-

hi
i'm new to qt and this might look stupid but i'm stuck
i'm writing a star control (melee) like game and ran
into this problem
i have to repeat a function while a key is pressed
like the up arrow when i move the ship .. all than came to my mind was to
put a bool variable for every key i watch for .. and a keypress/release
event to set.. then a timerevent of 50ms .. who checks these bool
variables and moves the ship ... it works but takes all if the idle CPU
resources
any ideas .. or just if you can tell me sources of games that handle such
long keypress events?

regards
-- sodo

-snap-

This mail had "help" as the subject so mailman thought it got a help request, 
anyway, let me take the chance to give the first answer (might be incorrect 
though) :-)

I think this is the correct way of handling this, although the graphics 
should be tied to the timer event and not the inputs (which are always 
present from keyPressEvent).
Make sure that no method is called recursively.

You should look at kasteroids as an example.

And, welcome on board :)

Josef

-- 
The MindX Open Source Project: Fighting proprietary games
GGZ now! - The GGZ Gaming Zone: http://ggz.sourceforge.net
ggz.morat.net | ggz.snafu.de | jzaun.com | mindx.sourceforge.net/europeone
_______________________________________________
Kde-games-devel mailing list
Kde-games-devel@mail.kde.org
http://mail.kde.org/mailman/listinfo/kde-games-devel

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

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