GP32 Something Wrong With Sprites


coRp

Still Fresh
Joined
Apr 15, 2004
Messages
40
Age
33
Location
North East England
Website
www.corp-com.tk
woo.. new smilie gp32_console gp32_console gp32_console gp32_console

...anyway, I've finally worked out how/ managed to put a sprite in, but something is going horribly wrong. for example:

.bmp image
image in geepee32

...as you can see, not very nice.

this is my c file:
Code:
#include <gp32.h>

#include "gbasp.h"
       
unsigned short *framebuffer;

void main ( void )
{
	framebuffer = (unsigned short*) FRAMEBUFFER;
	
	gp_SetScreen(framebuffer, 16);
	
	gp_ScreenClear16(framebuffer, 0x0000);
	
	gp_SpriteBlitT(gbasp, 0xFFFF, gbasp_width, gbasp_height, 10, 10, framebuffer);
	
	while(1)
	{
	}
}

I am getting this compile error - I think this may have something to do with it:
gpmain.c(11): warning: passing arg1 of 'gp_SetScreen' makes integer from pointer without a cast

... i think the pointer it refers to is 'framebuffer', and as this is integral to the actual display, I think this may be the problem.
anyone have any idea what's wrong?
 
I doubt that compile warning has anything to do with it.

Usually when an image displays skewed like that, its an alignment problem, either your image width and height are not proper or your passing a bad pointer (not really bad...just...not correct).

Check to make sure you have your height and width proper (not swapped either).

Also try using (unsigned char*)gbasp instead of just gbasp in the drawing function (or whatever datatype its declared as), you might be pointing to the wrong spot (i.e. the first element in the array rather than the array descriptor, or vise versa). I dont know the functions you are using or their actual declarations so I cant tell you if you are passing bad values or using the functions wrong.

You might also want to make sure that the program that is outputting the image array, works with the image drawing functions you are using.
 
well, I have tried the things you said... i tried swapping the height and width in the function, and while it made it better, it hasn't fixed it (it is now possible to see how it is actually getting that from the picture, it is basically skewing it very badly and repeating it).

also, I am not sur about the tool thing, as Rico used the official SDK version of the blitting function with the GP32 Converter, and this is just doing the same thing, but with a different sdk...
 
I had this same problem.
I think the problem is in GPConverter.
Try using Mirko's tools and then add 4 to the picture when you pass it into the blitting function.
Code:
gp_SpriteBlitT((u16 *)gbasp+4, 0xFFFF, gbasp_width, gbasp_height, 10, 10, framebuffer);

I was able to get it to work without adding 4 when I made the height and width the same. I don't know if that means anything.
 
Back
Top