GP32 Newbie Blitting Help


EvilBoB

Still Fresh
Joined
Dec 21, 2004
Messages
21
I have been working on a bit of code for my shiny new GP32 and am having a problem.

Thing is I have never used C/C++ before to do anything - I'm from a 68k ASM background.

I have a basic screen setup and it displays nicely (I'm using devkitadvance btw). Got some basic drawing and loading of images displaying correctly - however I have an issue as I want to be able to continuously move a block of the screen.

eg.

do
move x,y to x-1,y
loop

I know this is not in C/C++ but it gives the idea. I have tried using GpBitBlt but I just get garbage back. I assume this is because the output needs to be designed on one flip and then blitted to the other?!

My best guess was to use a command like :
GpBitBlt (NULL, &gpDraw[1], sx, 210, 150, 10, &gpDraw[0], 0, 210, 150, 10);

but this doesn't appear to work. I'm guessing the Bolded part is wrong

I have been fiddling for a couple of hours now. Any help/pointers would be greatly appreciated.

In the mean time I'll persevere
 
UPDATE : OK... I can do it with graphics that have been loaded in from a .h file :

GpBitBlt(NULL, &gpDraw[nflip], 0 , 0, 60 , 40, (unsigned char*)gfx, 0, 0, 100, gfx_height);

But this is not what I want :-( I want to be able to move a chunk of the screen that has already been drawn....
 
Your gpDraw variable is a structure containing, among other things, the screen buffer. You need to change the code to this -

GpBitBlt (NULL, &gpDraw[1], sx, 210, 150, 10, gpDraw[0].ptbuffer, 0, 210, 320, 240);

(note there is no & before the second gpDraw, and I think the last width and height need to be the width and height of the screen buffer). You should also use something like [backbuf] and [backbuf^1] instead of [1] and [0] to make sure you are always copying from the front buffer to the back.
 
Your gpDraw variable is a structure containing, among other things, the screen buffer. You need to change the code to this -

GpBitBlt (NULL, &gpDraw[1], sx, 210, 150, 10, gpDraw[0].ptbuffer, 0, 210, 320, 240);

:) AWESOME! Thanks - looks like its working... On with the rest of it now
 
Last edited by a moderator:
The SDK manual comes with some good examples.

I'm about at the same point in C as you are. I learned something now. Hehehe

GpBitBlt (NULL, &gpDraw[1], sx, 210, 150, 10, gpDraw[0].ptbuffer, 0, 210, 320, 240);
Learned!
 
Back
Top