GP32 Blitting Only Part Of An Image...


nerd of nerds

w00t!!!!
Joined
Feb 25, 2003
Messages
838
hello, i am just now starting to get "serious" about gp32 programming...doing more things with gfx and such...

how do blit just part of a bitmap to the screen? so i can make a sprite engine and whatnot...i will be blitting from C files FYI

thanks!

edit: mega gp mania w00t!!! :lol:
 
GpBitBlt(NULL,&gpDraw[backbuf], spritex, spritey, spritewidth, spriteheight, (unsigned char*)image_with_sprites, spritexoffset, spriteyoffset, spriteimagewidth, spriteimageheight);

spriteimagewidth and spriteimageheight are the width and height of your image containing all the sprites, not the width and height of the individual sprite.
 
sooo, if i had a, say, 30x60 size image and it had 2 parts of a sprite (each part being 30x30) and i told it spriteimagewidth and spriteimageheight were 30 and 30 it would blit the first part, then what would i do for the other half? (an example would be perfect ;) )
 
ok, let me explain...i am not an experienced coder...i have just done pretty simple things... drawing a perfect circle of dots, hello world...stuff like that, so i really need an example of code...
 
sooo, if i had a, say, 30x60 size image and it had 2 parts of a sprite (each part being 30x30) and i told it spriteimagewidth and spriteimageheight were 30 and 30 it would blit the first part, then what would i do for the other half? (an example would be perfect )
No, spriteimagewidth and height are the width and height of your original image with both sprites in it (in this case 30 and 60). To blt the first sprite to a position of xpos and ypos you'd do this -

GpBitBlt(NULL,&gpDraw[backbuf], xpos, ypos, 30, 30, (unsigned char*)image_with_sprites, 0, 0, 30, 60);

or to blt the second sprite to the same position -

GpBitBlt(NULL,&gpDraw[backbuf], xpos, ypos, 30, 30, (unsigned char*)image_with_sprites, 0, 30, 30, 60);
 
Back
Top