Author Topic: Help with ESC->GP2X  (Read 2248 times)

Offline equinox

  • Mc. Print
  • *
  • Posts: 19
    • View Profile
Help with ESC->GP2X
« on: 2010-Feb-27 »
I have this code but when I press A on the gp2x demo crashes and I have to turn off&on the GP2.

Where am I wrong?

Someone can 'help me?

Tnk1000.
Code: GLBasic [Select]
 SETSCREEN 320,240,0
 LIMITFPS 60
 LOADFONT "media/gfx/FONT.bmp", 0
 
 main()
 END

FUNCTION main:
 WHILE KEY(30) = 0 OR KEY(44) = 0
  DRAWRECT 0,0,318,238,RGB(0,128,255)
  SETFONT 0
  PRINT "Move JACK (THE BABY) con le frecce",10,10
  FINE();
  SHOWSCREEN
 WEND
ENDFUNCTION

FUNCTION FINE:
 IF KEY(44) = 1
  END;
 ENDIF
 IF KEY(30) = 1
  END;
 ENDIF
 
ENDFUNCTION

 

//-----------
GP2X     Key(s)              PC-Key
--------------------------------------------
DPad     203,205,200,208,57  Cursor Keys/Space
Volume   201,209             PageDn/PageUp
Shoulder 42, 54              LShift/RShift
Start    28                  Enter
Select   15                  Tab
A,B,X,Y  44,45,29,58         A,D,S,W
         30,32,31,17         Y,X,LCtr,CapsLock
Vol +&-  01                  ESC
« Last Edit: 2010-Feb-27 by BumbleBee »

Offline Ian Price

  • Administrator
  • Prof. Inline
  • *******
  • Posts: 4141
  • On the shoulders of giants.
    • View Profile
    • My Apps
Re: Help with ESC->GP2X
« Reply #1 on: 2010-Feb-27 »
I wouldn't use a function just to detect keys - this can be done in the main loop, and make a proper condition for the WHILE loop.

Eg

Code: GLBasic [Select]
WHILE quit=0

IF  (KEY(XX) OR KEY(YY) THEN quit=1

...
...
...

SHOWSCREEN

WEND
 

GLBasic doesn't exit properly on GP2X - Gernot did post some code that might help the situation, but I haven't tried it yet, so it's most likely not your code causing your problem.
I came. I saw. I played.