Demo Program
Contents |
Before You Begin
Before you begin compiling and installing a demo program, you need a few other things first.
- Find extra batteries or have a power supply. This will save frustration.
- Install the SDL library files on your GP2X. See page 13 of the [GP2X User Guide] for instructions. This will involve copying some files to your SD card, running a program on the GP2X, and then deleting those files off your SD card. (While this isn't necessary for the example below, which uses libraries bundled into a single executable, this will come in handy later.)
- Install the SDL and the MinSys for your development environment. See Getting started with GP2X development
Replacing Demo.C
The demo.c file that came with the development environment is specific to the SDL, but not the GP2X. Look at Source code to a Demo Program for a better version. Copy this new demo.c over your previous devkitGP2x/demo/demo.c version.
Find an image file
You will need an image file, named image.bmp, for the program to display. You may take this one (but it needs converting to bmp and renaming).
http://wiki.gp2x.org/images/d/db/GP2X_320_240.jpg
Todo: Check if possible to link BMP. Add some detail as to how big the image should be - maybe 320 x 240?.
This is how my directory now looks:
C:\devkitGP2X\demo>dir Volume in drive C has no label. Volume Serial Number is 23B3-EBFB Directory of C:\devkitGP2X\demo 01/25/2006 06:01 PM <DIR> . 01/25/2006 06:01 PM <DIR> .. 01/25/2006 05:05 PM 5,909 demo.c 01/24/2006 02:01 PM 30,054 image.bmp 11/30/2005 02:52 PM 588 Makefile 3 File(s) 36,551 bytes 2 Dir(s) 30,098,501,632 bytes free Make the demo.gpe fileTime to compile. Go to the demo directory, and type make. You should see something like this:
|