KEY() and GETJOY...() commands slow on PocketPC

Previous topic - Next topic

AndyH

Hi Gernot

Is there any reason why KEY() and GETJOY...() commands are slow on the Pocket PC?

I'm finding in my game, with a fair bit going on graphically I can get 28 FPS on my slowest Pocket PC.  If I do a "IF KEY(57) OR KEY(28)" twice in the game loop, I loose 2 FPS.  If I do "IF KEY(203) OR KEY(205) OR KEY(200) OR KEY(208)" I loose 1 FPS.  Finally if I do:

Code (glbasic) Select
xx=GETJOYX(0)
yy=GETJOYY(0)
FOR i=0 TO 3
IF GETJOYBUTTON(0,i) THEN ff=1
NEXT
I loose a lot.  With all the above tests it goes from 28 FPS down to 15 FPS.  Seems a steep drop.  I get the best improvement if I take the Joystick tests out.  I don't think the PocketPC is returning any values back from this anyway as the PPC's joypad+buttons seem to be detectable by keys only.  Doing the keyboard tests only (the cursor keys and fire) brings the FPS down to 22.

Can the speed of this be improved?

Windows versions run fine.  I'd assume that GP2X is running fine too as there's a quite a few people owing one here and no one has brought it up before.

Kitty Hello

Yes. The reason is, PocketPCs slow down, when you press a button or touch the screen. It's the WindowsCE OS that causes these problems. Very annoying.
About 2x slowdown for me, too.
Try any emulator, you get the same results.

bigsofty

I used eVB amongst other languages, the best way to get button input is GetAsyncKeyState via GAPI on WinCE. Im pretty sure this is a non-blocking key scan with no effect on program run speed.

I may fuzzy here as its been a while... :P
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello


bigsofty

OK, any advantage on running the keyscan in a different thread?

Never used it but have you tried GxOpenInput() Gernot?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)

Kitty Hello

I use GxOpenInput for disabling the default-keys. Did you not notice any slowdown with eVB? My C64 emulator has the same problem.

bigsofty

eVB is not the fastest to begin with but no, no slowdown that I can recall?
Cheers,

Ian.

"It is practically impossible to teach good programming style to students that have had prior exposure to BASIC.  As potential programmers, they are mentally mutilated beyond hope of regeneration."
(E. W. Dijkstra)