Switching From A Game Engine To C++


Kicy

Still Fresh
Joined
Mar 25, 2006
Messages
11
Hi, I was working on a rpg (in Gamemaker; I have experience in some basic languages such as Bbasic, Visual Basic, Scar Divi) and I thought it would be great to get this on the gp2x.

So, so far I got the gp2x sdk pack (found on the wiki) and set up Dev-C++. Unfortunately, I could not find away to add a path.. only variables. Nontheless I compiled the test program ( I don't know if it works I'm getting gp2x tomorrow, my first one broke).

Now that I'm wondering where I could find a list of "functions" (display images on the screen, or reading user input) I can use with c++, or do I have to make my own functions some how?
 
So would those tutorials also apply to programs for the gp2x?


Thanks very much for the help.
 
The difference between a pc program and a gp2x program is the resolution of the display you can output to and the speed it runs at. You develop it on the pc in a little window and then just switch compilers, link static and copy it to an sd card to stick in the gp2x.
 
Ok, so thanks a lot this is enough information to get me started. I have more questions but they would be probably be answered by further research.

oh god c++ is cap sensitive ><
 
I tried using the pre-made devkit as is and i got a bunch of errors while doing the second lesson from Lazy Foo. I'm thinking this has to do with the settings it came with.. I looked at the wiki and they set up code blocks and I looked at the one the dev-kit came with. So should I change the dev-kit and use the wiki settings?


PC\obj\Debug\main.o:: In function `load_image(std::string)':
C:\gp2x\gp2xtest\Test\main.cpp:26: undefined reference to `SDL_RWFromFile'
C:\gp2x\gp2xtest\Test\main.cpp:26: undefined reference to `SDL_LoadBMP_RW'
C:\gp2x\gp2xtest\Test\main.cpp:32: undefined reference to `SDL_DisplayFormat'
C:\gp2x\gp2xtest\Test\main.cpp:35: undefined reference to `SDL_FreeSurface'
PC\obj\Debug\main.o:: In function `apply_surface(int, int, SDL_Surface*, SDL_Surface*)':
C:\gp2x\gp2xtest\Test\main.cpp:52: undefined reference to `SDL_UpperBlit'
PC\obj\Debug\main.o:: In function `main':
C:\gp2x\gp2xtest\Test\main.cpp:58: undefined reference to `SDL_Init'
C:\gp2x\gp2xtest\Test\main.cpp:64: undefined reference to `SDL_SetVideoMode'
C:\gp2x\gp2xtest\Test\main.cpp:73: undefined reference to `SDL_WM_SetCaption'
C:\gp2x\gp2xtest\Test\main.cpp:86: undefined reference to `SDL_Flip'
C:\gp2x\gp2xtest\Test\main.cpp:92: undefined reference to `SDL_Delay'
C:\gp2x\gp2xtest\Test\main.cpp:95: undefined reference to `SDL_FreeSurface'
C:\gp2x\gp2xtest\Test\main.cpp:96: undefined reference to `SDL_FreeSurface'
C:\gp2x\gp2xtest\Test\main.cpp:99: undefined reference to `SDL_Quit'
:: === Build finished: 13 errors, 0 warnings ===
 
i didn't -lSDL_main because I received the error, but just with -lSDL it let me compile it but then I get this error errorfo8.th.jpg

I didn't imagine I would be asking this many questions, but thanks for your help.

Am I getting this because I'm doing this tutorial with a gp2x set up?

Goodnight, kicy
 
Well Yaustar's premade devkit has two compilers, one with Windows target, one with GP2X target. You need to switch between the two to run the built file on the respective platforms.

Were you able to compile Guyfawkes' SDL Test program?
 
no >< I should of tried that first. Well I got some error saying that "sdl.h" was missing so I added C:\devkitGP2X\include\SDL to the compiler paths and ended up with this instead:

PC\obj\Debug\sdltest.o:: In function `Shutdown()':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:42: undefined reference to `SDL_FreeSurface'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:43: undefined reference to `SDL_FreeSurface'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:44: undefined reference to `SDL_FreeSurface'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:45: undefined reference to `Mix_FreeChunk'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:46: undefined reference to `Mix_FreeMusic'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:47: undefined reference to `Mix_CloseAudio'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:48: undefined reference to `TTF_CloseFont'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:49: undefined reference to `TTF_Quit'
PC\obj\Debug\sdltest.o:: In function `LoadFont(unsigned char)':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:63: undefined reference to `TTF_OpenFont'
PC\obj\Debug\sdltest.o:: In function `drawText(SDL_Surface*, char*, int, int, int, int, int)':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:69: undefined reference to `TTF_RenderText_Blended'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:71: undefined reference to `SDL_UpperBlit'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:72: undefined reference to `SDL_FreeSurface'
PC\obj\Debug\sdltest.o:: In function `drawTextInt(SDL_Surface*, int, int, int, int, int, int)':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:80: undefined reference to `TTF_RenderText_Blended'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:82: undefined reference to `SDL_UpperBlit'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:83: undefined reference to `SDL_FreeSurface'
PC\obj\Debug\sdltest.o:: In function `drawSprite(SDL_Surface*, SDL_Surface*, int, int, int, int, int, int)':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:100: undefined reference to `SDL_UpperBlit'
PC\obj\Debug\sdltest.o:: In function `WaitForKey()':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.h:110: undefined reference to `SDL_PollEvent'
PC\obj\Debug\sdltest.o:: In function `TestSDLTTF()':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:37: undefined reference to `SDL_MapRGB'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:37: undefined reference to `SDL_FillRect'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:43: undefined reference to `SDL_Flip'
PC\obj\Debug\sdltest.o:: In function `TestSDLImage()':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:54: undefined reference to `SDL_MapRGB'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:54: undefined reference to `SDL_FillRect'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:57: undefined reference to `IMG_Load'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:58: undefined reference to `SDL_ConvertSurface'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:61: undefined reference to `SDL_MapRGB'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:61: undefined reference to `SDL_SetColorKey'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:65: undefined reference to `IMG_Load'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:66: undefined reference to `SDL_ConvertSurface'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:69: undefined reference to `SDL_MapRGB'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:69: undefined reference to `SDL_SetColorKey'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:73: undefined reference to `IMG_Load'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:74: undefined reference to `SDL_ConvertSurface'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:79: undefined reference to `IMG_Load'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:80: undefined reference to `SDL_ConvertSurface'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:82: undefined reference to `SDL_MapRGB'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:82: undefined reference to `SDL_SetColorKey'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:83: undefined reference to `rotozoomSurfaceXY'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:84: undefined reference to `SDL_MapRGB'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:84: undefined reference to `SDL_SetColorKey'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:88: undefined reference to `SDL_Flip'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:92: undefined reference to `SDL_FreeSurface'
PC\obj\Debug\sdltest.o:: In function `TestInput()':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:106: undefined reference to `SDL_MapRGB'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:106: undefined reference to `SDL_FillRect'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:110: undefined reference to `SDL_Flip'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:114: undefined reference to `SDL_PollEvent'
PC\obj\Debug\sdltest.o:: In function `TestSDLMixerWAV()':
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:234: undefined reference to `SDL_MapRGB'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:234: undefined reference to `SDL_FillRect'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:236: undefined reference to `SDL_Flip'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:238: undefined reference to `SDL_RWFromFile'
C:\gp2x\gp2xtest\sdltest-v151\sdltest.cpp:238: undefined reference to `Mix_LoadWAV_RW'
:: More errors follow but not being shown.
:: Edit the max errors limit in compiler options...
:: === Build finished: 50 errors, 0 warnings ===
 
If you used Yaustar's premade dev package, then maybe you extracted something in the wrong place. The DevKitGP2X folder has to be in the C:\ root for example. Maybe it would be easier to delete everything and make a clean setup. Also, for the beginning, add the .c and .h files from Guyfawkes' test program to the sample .cbp project, and try to compile it that way. Good luck :)
 
Read the readme.txt. it tells you everything to get started. There is even a project template folder to get you started.
 
Ok, after re extracting, I was still unable to build and run projects. Then I read the readme.txt which I have failed to notice earlier, and somewhere in there it stated to debug the program instead of running it.

And it works :)

Thanks for you help. Final, question When starting a new project.. what kind of project do I start? sdl? empty project?
 
Make another copy of the SDL_Template folder and use that.

Edit: In fact, in the readme:
QUOTE
- GP2X Template
- This is a simple Hello world template that you can copy the entire directory
to start a brand new project
. It has been preconfigured for 3 bulid targets:
- PC Debug: You main development build
- PC Release: Optimised build to release to peers/users
- DevKitGP2x GPL Release: Optimised build for GP2X platform using the
DevkitGP2x SDK and GPLed SDL_mixer library
- DevKitGP2x LGPL Release: Optimised build for GP2X platform using the
DevkitGP2x SDK and LGPLed SDL_mixer library

- The executables are built to the built sub directory.

- You can change all the settings, output file names etc in Project->Properties.
 
Well that was very subtly mentioned in there (i took a look at the read me again to make sure i didn't miss anything else ;)

Thank you, everyone for answering my questions.
 
Back
Top