Joystick And Touchscreen Not Working


Quiest

I like turtles!
Joined
Sep 2, 2004
Messages
3,411
Age
41
Location
Dteuschland ;)
EDIT:
Problem with the filesize and button input solved!
I was calling SDL_JoystickOpen( 0 ); before SDL_Init(); :p
Worked fine on PC but not on the 2X.
The filesize came from including iostream.h, and now i could work down the
filesize to 930kb using -s compiler flag and the gpe comp tool!

My remaining problem is, the touchscreen still does not work, not with events,
nor with using:

CODE

SDL_GetMouseState( &mx, &my );
//and
SDL_GetMouseState( NULL, NULL ) & SDL_BUTTON( SDL_BUTTON_LEFT )



Can someone shed some light on what to do? How do others use it?
I updated to paeryns newest lib (23/11/07), so touchscreen should definately work!
 
I couldn't see anything wrong with the code but I haven't had anything more than a quick look.

I mainly replied in order to answer:
Quiest said:
Also, my compiled .gpe is extremely big (5+ mb) what can I do bout that?
Use UPX to compress it. You can get it from http://upx.sourceforge.net/. You just download the version for your development machine (Linux, Windows, whatever) and run:

CODE

upx -9 filename.gpe



and it will compress the executable (usually 40-50% for GP2X ARM executables) but still leave it as a normal program that you can run. When run on the GP2X, the compressed executable extracts itself into RAM (and in such a way that it doesn't take any more RAM to do it than your uncompressed program would) and runs as normal.

You might also find that compiling without debug flags would help immensely, running "strip" on the executable before you compress it, and making sure that you don't link in anything that you don't need will all help reduce the executable size.
 
Last edited by a moderator:
I already am using the gpe-comp tool from the archive, which compresses it to roughly 2,4mb, which still is pretty much...

edit:
I found out that thats the result of including the iostream.h so i can use

CODE

chdir( "/usr/gp2x" );
execl( "...themenublabla" );



at exit. It bloated it up by over 2mb!
I now use fstream.h, which gives me a nice filesize of 2,5mb,
and compressed its only 1,2mb!

edit2:
See first post, please!
 
What the colour depth are you using? I think the touchscreen only works with 8 or 16 bit.

Also you don't have to bother with

chdir( "/usr/gp2x" );
execl( "...themenublabla" );

Just call the program from a script

./program
cd /usr/gp2x
exec ./gp2xmenu
 
Parkydr said:
What the colour depth are you using? I think the touchscreen only works with 8 or 16 bit.

Also you don't have to bother with

chdir( "/usr/gp2x" );
execl( "...themenublabla" );

Just call the program from a script

./program
cd /usr/gp2x
exec ./gp2xmenu
Like you're going to run it somewhere else without themenublabla?
 
Last edited by a moderator:
I considered using a script, but that would be just another file to bother with, and this works as well, so why not leave it that way?
 
Sphinxter said:
Like you're going to run it somewhere else without themenublabla?
I do it all the time, when debugging using telnet.

I sometimes do other things in the script like changing to a sub directory to reduce the files at the top level or run multiple programs or kill a process on exit (e.g. the X server).

If you hard code the menu code, you have no flexibility, once you've run your program that's it.
 
Last edited by a moderator:
It can be a bit of a pain for me when working on Open2x if people hardcode the menu launch code since GMenu2x handles that already :p.
 
Back
Top