Where To Go Now


Drak

fff
Joined
Mar 29, 2005
Messages
1,225
Age
36
Location
Canada!
Website
Visit site
Yeah I decided to dedicate myself to do some of this stuff to make my dream rpg. Like 1 hour a day and ill increase that once I can write the code on the gp2x with a mini keyboard or sumthing like that.

I know it takes alot of work. I'm fine with that. As long as I know some c++/c before the gp3x comes out :)

So basically what I have done so far is the Guyfawkes demo compile. Now what im pondering is whats next? Im learning basic C++ at the moment from one site, but now am in need of simpler guides per say. The one I got isnt for noobs thats all I can say :(

Ive also tried to Use the compile thing for kicks with the C++ visual Express that used arm-linux.rules but the sad thing is I dont know how to do this step:
http://wiki.gp2x.org/wiki/Using_Visual_C_2...Express_Edition
22.Create a new text file with the extension .link to the project. This is to trigger the arm-linux-link build rule.
I dont know how to do that sadly. So all I gotta say is LOL to that. This is a very important step... i think, since it says thats what gets it to use the custom linux.rules. Any support for that would be cool :p [was trying to compile my hello world with it.]


Anything free would be helpfull. Like a complete noob guide to C++/C. Also, I want to know how to make a Makefile for just plain C/C++. I already know how to make one for SDL but that wont help me much now will it.

Ive also learned some python and did a simple game but it wasnt too neat so ya.. Abandoned that since everyone seems to use the hip c++/c stuff.

:wub: noob coding !
 
there are plenty of free c++ tutorials on the internet, try google ;) But maybe you should stick to Python anyway, guess that's easier to learn. I don't know how much processor power the gp2x has though, so maybe you won't be able to write your dream rpg in python.

edit: And by the way: I'm not sure if "1 hour a day" will be enough to learn programming. And besides that, why do you want to write code on a gp2x with a mini keyboard :blink: Just write code the way your mother taught you: On a PC (or mac), and after compiling, transfer it to your gp2x and run it.
 
nites posted on Feb 12 2006 at 01:08 AM said:
there are plenty of free c++ tutorials on the internet, try google ;) But maybe you should stick to Python anyway, guess that's easier to learn. I don't know how much processor power the gp2x has though, so maybe you won't be able to write your dream rpg in python.

edit: And by the way: I'm not sure if "1 hour a day" will be enough to learn programming. And besides that, why do you want to write code on a gp2x with a mini keyboard :blink: Just write code the way your mother taught you: On a PC (or mac), and after compiling, transfer it to your gp2x and run it.

Ya google just gives me the same stuff I got which isnt too easy. Oh and for my computer, I dont go on it that much :D Since its my parents. I dont got a personal one so ya... plus its really hot in here because of the monitor and i cant stand it.
 
Last edited by a moderator:
Forget about C++ at the moment, go to just plain C. It is a smaller language and you will get a lot more out of it in a smaller timeframe then C++.

Concerntate on learning the language first with the console/dos prompt, then SDL then start thinking about porting to GP2X. At the moment you trying to run before even knowing how to crawl (harsh but true).

Programming eBooks here: http://programmingebooks.tk/
 
nites posted on Feb 12 2006 at 11:08 AM said:
there are plenty of free c++ tutorials on the internet, try google ;) But maybe you should stick to Python anyway, guess that's easier to learn. I don't know how much processor power the gp2x has though, so maybe you won't be able to write your dream rpg in python.

Enough for game logic done in Python. The blitting and such will be handled by SDL lib and it's compilled C. Eventually there will be hardware acceleration for it so the speed will increase. So for 2d platfom like/puzzle/rpg game what doesn't have to push to much pixel it's ok.

nites posted on Feb 12 2006 at 11:08 AM said:
edit: And by the way: I'm not sure if "1 hour a day" will be enough to learn programming. And besides that, why do you want to write code on a gp2x with a mini keyboard :blink: Just write code the way your mother taught you: On a PC (or mac), and after compiling, transfer it to your gp2x and run it.

Actually keyboard for gp2x could be very beneficial. It'd allow to much faster debugging and learning of machine. How it's now it is not efficient nor comfortable.
But of course coding whole application on gp2x could be somewhat futile because at least 80 columns of text is really needed. It's a pity that there no RGB vga output of gp2x as it's a complete computer with full os. I remember when my PC have just 8MB of ram and 486DX cpu. It was enough so was the Atari ST before (1MB and 68K@8MHz). With display of 640x480 I could imagine using the gp2x for more tasks like text editing, coding, midi sequencing, some bitmap processing (for sprites), diary, calendar, etc.
 
Last edited by a moderator:
Thanks guys. Ill look into C first then, but can anyone help me with that Visual C++ thing I mentioned, I want to compile my hello world with it. [the .link thing]
 
I am having trouble with a really simple SDL program that has supposed to mean I can move an image around the screen with the cursor keys. I am just too embarassed to ask what I am doing wrong as it is going to be something very easy I know it is.
 
Hanz™ posted on Feb 13 2006 at 01:17 AM said:
I am having trouble with a really simple SDL program that has supposed to mean I can move an image around the screen with the cursor keys. I am just too embarassed to ask what I am doing wrong as it is going to be something very easy I know it is.

i am in the same state as you guys...except i am taking a class in java and finding it pretty beneficial to have a nice thick book in front of me. where i get hung up is trying to get mingw or cygwin going...at the moment the only compilers i can "work" right are python and the jdk :)

hanz...i had some luck with python/pygame getting an sdl app going. pygame comes with some decent example programs...easy to follow clones of asteroids, arkanoid, space invaders, etc
 
Last edited by a moderator:
Drak posted on Feb 12 2006 at 04:17 AM said:
Ive also tried to Use the compile thing for kicks with the C++ visual Express that used arm-linux.rules but the sad thing is I dont know how to do this step:
http://wiki.gp2x.org/wiki/Using_Visual_C_2...Express_Edition
22.Create a new text file with the extension .link to the project. This is to trigger the arm-linux-link build rule.

it looks like you might just have to create a dummy file with extension .link and import it into your project's list of files? i don't know though as i haven't used visual c++ very much.
 
Last edited by a moderator:
yaustar posted on Feb 13 2006 at 07:37 PM said:
Post it anyway, we were all beginners once..
I did warn you. A mish mash of various tutorials and misunderstandings in a SDL program.
There are lots of things that I really don't understand about it, so.
The problem I have is that despite having the two bmp files in the root, I just get a black screen with a cursor on top of it in the top-left.
I am using the HW-accelerated SDL, but do not use HW surfaces as, as soon as I did I noticed there was scanlines, and for some strange reason the cursor would flicker if I pressed a button on the GP2X.
 
Last edited by a moderator:
Just something that leaps out straight away, the paths are wrong.
"/mount/sd/bg.bmp" should be "/mnt/sd/gb.bmp". I'll have a more in depth look as soon as work calms down :)
 
fishybawb posted on Feb 14 2006 at 12:46 PM said:
Just something that leaps out straight away, the paths are wrong.
"/mount/sd/bg.bmp" should be "/mnt/sd/gb.bmp". I'll have a more in depth look as soon as work calms down :)
Feck that is so retarded. :lol: Well that explains why I was just seeing a black screen, doesn't explain all of the other stuff I have done wrong though. :p
 
Last edited by a moderator:
Trust me, I've done worse myself before :D

Anyway, my GP2X is out of action until I get a new SD card now, so I could only test your program using Winblows and with keys instead of a joystick...

You need a "case" statement at line 168 in your code - at the minute it's just two "switch" statements next to each other, which isn't going to work. You want
case SDL_JOYBUTTONDOWN:
on that line (168) in order for the next "switch" to be able to detect what button was pressed.

While you're in that region of code, delete the "SDL_WaitEvent(&event);" line, it'll delay the drawing until a button is pressed, which I doubt you intended.

Apart from that, it looks OK to me. You'll probably want to add some repeating to the directions, so it continues to move when you hold the stick down. Take a look at the sterm source in the archive for one way of doing it :)
 
You should convert the surfaces before using them or strange things might happen :)

you do that by adding the line

Code:
backSurface = SDL_ConvertSurface(backSurface, screenSurface->format, SDL_SWSURFACE);

also, your program probably exits becasue of some error, but it won't write it down nor exit to the menue. (Well, the stdout and stderr does not work for me, even if i flush it, so i just created another file stream stream, and wrote my errors to that stream instead (using fputs).

to help this, create a function and put the ending code in it, like this:
Code:
void cexit()  //short for CleanExit
{
SDL_Quit();  // Shut down the SDL library, freeing resources.
chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
}

now, you can, if you want to, delete the same code before main returns 0 and add a function call to cexit() instead..
But that's just a matter of taste :)

and then lastly, insert "atexit(cexit);" just after the codeblock
Code:
if(SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK)<0)
{
blah
}

this will return you to the menu even if your program exites in an abnormal way.

also this function will write a string to the file error.txt (usefull if you cant get fprintf to work )

Code:
int writef(char *string)
{
FILE *f_temp;
f_temp=fopen("/mnt/sd/error.txt","a");
fputs(string,f_temp);
fflush(f_temp);
sync();
fclose(f_temp);
return 0;
}

hope that helps!
and good luck with your programming!
 
Thanks guys. I finally worked it all out. (well most of it) : )
Why exactly is it that I needed 2 switches for the joystick code? The event.type one and the event.jbutton.button one?
I see why I was stupid for using no case statement though... Is there any particular reason that it should be case SDL_JOYBUTTONDOWN:confused:

---

Okay. Something that stands out straight away if I move the image left or up it does not draw black where the image once was so instead the image gets longer and longer etc...

I also need to work out how to get it so that it continues to move when I hold the stick down, I shall check the sterm source as you said earlier, but it will probably just confuse me.

Need to get rid of the cursor too. It shouldn't be there, but for some reason it is.

Anyone wanna have a look? Nasty code.
 
For the showcursor, try SDL_DISABLE instead of 0. Also, when you're blitting the background, try DrawBG() instead of DrawIMG, and see how that works.
 
Okay I see why the background wasn't getting updated properly, its because I didn't want to redraw black over the whole screen each time.
If I write:
DrawIMG(backSurface, xpos+2, ypos+2, 320, 240, xpos+2, ypos+2);
Then it fixes the smearing of the image if I move left or up.
While:
DrawIMG(backSurface, xpos-2, ypos-2, 320, 240, xpos-2, ypos-2);
Fixes it if I move right or down.

So now I need to think again. Damn thinking.
I did a n00b fix:
Code:
if (xpos > 0)
        if (ypos > 0)
            DrawIMG(backSurface, xpos-2, ypos-2, 320, 240, xpos-2, ypos-2); 
        else
            DrawIMG(backSurface, xpos-2, ypos+2, 320, 240, xpos-2, ypos+2);
    else
        if (ypos > 0)
            DrawIMG(backSurface, xpos+2, ypos-2, 320, 240, xpos+2, ypos-2);
        else
            DrawIMG(backSurface, xpos+2, ypos+2, 320, 240, xpos+2, ypos+2);
How embarassing, but it works.
Can someone tell me the difference between src and dst in here:
SDL_BlitSurface(imageSurface, &src, screenSurface, &dst);

---
Another problem I find is that if I close the program, put the new file into my SD card and then reload the program again, it loads the old program even though the old program is rewritten on the SD card. I have to restart the GP2X for it to be able toload the new program. This drives me insane!

Got the cursor to dissappear btw. Thank god. :lol:
 
Hanz™ posted on Feb 19 2006 at 10:11 PM said:
Can someone tell me the difference between src and dst in here:
SDL_BlitSurface(imageSurface, &src, screenSurface, &dst);

src is a rectangle describing the area of imageSurface that you wan to copy to screen, dst is a rectangle describing what area of the screen you want to copy it to.

e.g. src could be (0,0,7,7), and 8x8 area in the top left corner of your picture, maybe holding a letter 'A' and dst could be (8,8,7,7), which would put a copy of this 'A' on the screen a little to the south east of the top left corner.
Another problem I find is that if I close the program, put the new file into my SD card and then reload the program again, it loads the old program even though the old program is rewritten on the SD card. I have to restart the GP2X for it to be able toload the new program. This drives me insane!

Just ejecting the card is a nono, as it will confuse linux, and it will use its cached copy of the files on it instead. Tell linux to unmount the card, then eject it. Use the terminal connection, make sure there is nothing using the card anymore (including your terminal connection stuff!!), and use the 'umount' (spelled that way!) command. See a linux-for-noobs tutorial to learn more about this, and what arguments to use with the command..

P.
 
Last edited by a moderator:
For anyone that knows even basic C/C++ I recommend SoL's SDL tutorials... it walks you through 3 multi-chapter sections and by the end you will have a working monkey-ball style game. It also showed me more about splitting my code into multiple files... because until then I didn't understand how or why that worked.

the link:
http://iki.fi/sol/gp/

Seriously... Check it out... it will help alot.
 
Back
Top