Hi all, i have an SDL game that i've made for pc, now im doing a port to DC, XBOX and GP2X. Im porting to psp and the graphics dont show correctly. The res its 320x240x16 and the tiles 32x32, ¿any idea of whats happening?
Im using png format and converting to .h, the game runs perfect in other platforms, with the same code, i dont know why in psp i see all the tiles corrupted. ¿I need any special size for the tiles to show them correctly?
Heres a link to an image to see the problem www.telefonica.net/web2/eskematico/corrupted.JPG
Problem with SDL and graphics
It looks like your images are at the wrong bits-per-pixel depth.
Sadly I don't know what pixel depth SDL uses, but presumably it's in the documentation somewhere.
Sadly I don't know what pixel depth SDL uses, but presumably it's in the documentation somewhere.
Got a v2.0-v2.80 firmware PSP? Download the eLoader here to run homebrew on it!
The PSP Homebrew Database needs you!
The PSP Homebrew Database needs you!
i think if the images are at the wrong depth its due a psp limitation, ¿isn't it? in the xbox or dc the game runs without any trouble, even in gp2x.
Maybe its any lack of functionality in the SDL port or maybe im a noob thinking that i can port any of my SDL games without change anything in the code
Maybe its any lack of functionality in the SDL port or maybe im a noob thinking that i can port any of my SDL games without change anything in the code
-
- Posts: 8
- Joined: Sun Nov 13, 2005 7:23 am
Ok i've used 32bpp and now works, but its too slow, and ¿why the SRCCOLORKEY doesnt work?pensoffsky wrote:hi,
i also ran into some problems with sdl on the psp
i had to learn that the psp doesn't like small 16bit surfaces
you could try to initialize sdl with 32bpp, just to see if it works
pensoffsky
Code: Select all
SDL_SetColorKey(image->image, SDL_SRCCOLORKEY, SDL_MapRGB(image->image->format, R, G, B));
If you want a speed increase, use 16 bit mode as your graphics mode.
You have to convert all surfaces to 16 bit mode as well to realize a speed beneift. Also, when converting you need to make sure you convert the surfaces to Software surfaces. By default it will convert them to HARDWARE surafces (at least it will if that is what your screen mode is set to, which it should be).
If some of the images use an alpha channel for transparency, you will lose that transparnecy when you got to 16bit mode. Those graphics you will have to leave in 32 bit mode and suffer a small speed hit. If the image just uses a tranparent color, you shoudl not have any troubles once you set your image to 16bit mode and make it a sofdtware surface.
These rules worked for me using an older PSP SDL port. I think most of the above is still true for the latest builds.
Garak
You have to convert all surfaces to 16 bit mode as well to realize a speed beneift. Also, when converting you need to make sure you convert the surfaces to Software surfaces. By default it will convert them to HARDWARE surafces (at least it will if that is what your screen mode is set to, which it should be).
If some of the images use an alpha channel for transparency, you will lose that transparnecy when you got to 16bit mode. Those graphics you will have to leave in 32 bit mode and suffer a small speed hit. If the image just uses a tranparent color, you shoudl not have any troubles once you set your image to 16bit mode and make it a sofdtware surface.
These rules worked for me using an older PSP SDL port. I think most of the above is still true for the latest builds.
Garak
So are u telling me that i need to change thisGarak wrote:If you want a speed increase, use 16 bit mode as your graphics mode.
You have to convert all surfaces to 16 bit mode as well to realize a speed beneift. Also, when converting you need to make sure you convert the surfaces to Software surfaces. By default it will convert them to HARDWARE surafces (at least it will if that is what your screen mode is set to, which it should be).
Garak
Code: Select all
SDL_SetVideoMode(320, 240, 32, SDL_HWSURFACE | SDL_DOUBLEBUF);
Code: Select all
SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE | SDL_DOUBLEBUF);
Im using a function like this to manage all images
Code: Select all
void LoadImage(tObjeto *image, tObjeto *tmp, unsigned char *name, int size,int R, int G, int B)
{
tmp->tmp=IMG_Load_RW(SDL_RWFromMem(name,size),0);
image->image=SDL_DisplayFormat(tmp->tmp);
SDL_FreeSurface(tmp->tmp);
if(R>-1 && G>-1 && B>-1){
SDL_SetColorKey(image->image, SDL_SRCCOLORKEY, SDL_MapRGB(image->image->format, R, G, B));
}
}