GP2X Gp2x Sdl/coding - Getting Graphics, Joysticks & Sound


DavidBeoulve

GP2X by EvilDragon OC's to 280-300MHz
Joined
May 10, 2006
Messages
427
Age
48
Location
USA
Website
www.gamersgonebad.com
The Premise:
All that is needed for the most rudimentary of games is to get joystick input, write graphics to the display, and play sound. Of course, using that other ARM chip is good too ;)

I'm putting together these resources to get folks where they can start something basic (myself included) as much of the information seems to be laid out in a developer mindset - that is to say, if you are one, you know where the goods are, if you aren't, you don't. That's just because the GP2X hasn't been out long.

Developer Links:Developing for the GP2X introduction
GP2X User Guide Version 2.0.0b page 41, Authored by: Guyfawkes
www.emuholic.com - Latest version available here.

"Note: I will rewrite this section shortly to use Hardware Accelerated SDL.

First download DevkitGP2X from http://archive.gp2x.de/ in the Development Utilities section. Run the file that was downloaded and install it to c:\devkitgp2x\. You will also need MinSys installed which you can download from http://www.devkitpro.org/. Don’t forget to include a PATH to the MinSys folder, more information can be found at
http://www.devkitpro.org/setup.shtml

Next download Theoddbot’s GP2X SDL libraries at http://archive.gp2x.de/cgi-bin/cfiles.cgi?0,0,0,0,19,1207
. Extract this file to a temporary location on your PC. Now locate the extracted folder and select and copy all the folders as follows:
  • bin
  • etc
  • include
  • info
  • lib
  • main
  • share
Now go to your c:\devkitgp2x\ folder and paste the above folders. You will be asked if it is OK to overwrite some files and folders, choose Yes for all of these prompts.

Please refer to the GP2X Wiki for more information on how to set up your development environment for various compilers and IDEs.

I have provided a SDL Test Program project for you to test your development setup; you can download it here. Extract this file to a folder on your PC and from the command prompt type ‘make’ and press return.

The demo project should now start to compile and after a few seconds will finish. You should now have a new file named sdltest.gpe, copy this file and the /sdltest/ folder to the
root folder of your GP2X and from the Game menu select sdltest. After a few seconds while the program is loading, a menu containing the tests should appear. Use the joystick to navigate the options and press the [X] button to select."

To Do:
I will be adding things as I go and learn...
 
Last edited by a moderator:
Thank you both. My plan is to make my source available as I go, and comment everything I do with the idea that - not only is my code open-source - I expect people to read it.

I updated the "Using Windows .NET Visual C++ 2005 Express Edition as a development environment" Wiki page, mostly with reformatting, but also clarifying a few things. Whoever wrote the page first is a minor guru at least.

I won't actually be getting a GP2X until the Mk2's arrive and can be shipped - so currently, all I can do is gather research. That's not actually a very bad thing.
 
I'm looking forward to starting my first port in a few weeks (when I get my GP2X), and I bet this will save me a few hours of searching around. Cheers! :)
 
Tile-Based Map Editing
Thanks to a tip from EvilDragon, I hope to use Mappy, an open-source tile-graphics editor.I put these three files into my Visual Studio C++.NET SDL project and it compiled without errors on the first go. You will notice that the code to pick up input assumes the use of a keyboard (which the GP2X doesn't have) and the screen size is 800x600, not 320x240.

At 16*16, there would be 20 tiles across and 16 tiles down:

As you can see by this overlay of Secret of Mana 2 / Seiken Densetu 3, that's actually not bad for how much detail you can fit in.

You will notice that the characters are 3 tiles or 16*3 = 48 pixels high and generally 1 tile wide. I have no idea if I'll do this or the original Zelda style.

For now, it's good to have Mappy available as an option.

Scripting
For basic scripting, check this thread.

To write your scripts, TelcoLou pointed to this: "Programmer's Notepad is a powerful text editor featuring syntax highlighting, project management, a great user interface and much more." because, as he said "The line endings need to be set as Unix, so the GP2X can read then correctly."
 
Last edited by a moderator:
GPL or Open Source ResourcesHopefully a moderator will move this thread to DEVELOPERS area ;) (Thanks TelcoLou!)
 
Last edited by a moderator:
Moving topic, and thanks for this ... very helpful stuff for us n00bs :)
 
EdgeLib looks promising for non-commercial game development on the GP2X. I haven't gotten a chance to play with it yet, so I can't reccommend for or against it, but I'm going to set aside some time to do so.
 
Yup. I naturally thought it might have some use to script, so to speak, some simple stuff for games. I couldnt find any decent info to add here yet though.
 
Back
Top