If you manage to compile it, be kind and upload it to the GP2X archiveyaustar posted on Aug 26 2006 at 11:11 AM said:That explains why my sprites like to 'shiver'. Hmm .. I need to to see if I can compile from the latest source.
Alex. posted on Aug 26 2006 at 06:25 PM said:Thanks DJ, unfortunately the flickering problem persists. The executable however is about 400kb smaller.
#define WIDTH 320
#define HEIGHT 240
#define BPP 16
int main(int argc, char **argv)
{
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO | SDL_INIT_TIMER);
SDL_Rect coords = {0, 83};
SDL_Rect location = {0, 67, 320, 72};
SDL_Surface* screen = NULL;
SDL_Surface* loadedSprites = NULL;
SDL_Surface* sprites = NULL;
screen = SDL_SetVideoMode(WIDTH, HEIGHT, BPP, SDL_HWSURFACE);
loadedSprites = IMG_Load("gfx.png");
sprites = SDL_ConvertSurface(loadedSprites, screen->format, SDL_HWSURFACE);
SDL_FreeSurface(loadedSprites);
SDL_SetColorKey(sprites, SDL_SRCCOLORKEY, SDL_MapRGB(sprites->format, 255, 78, 207));
SDL_Joystick* joystick = SDL_JoystickOpen(0);
SDL_ShowCursor(SDL_DISABLE);
while(!status.exit) {
SDL_BlitSurface(sprites, &location, screen, &coords);
SDL_Flip(screen);
}
SDL_FreeSurface(sprites);
SDL_FreeSurface(screen);
SDL_Quit();
chdir("/usr/gp2x");
execl("/usr/gp2x/gp2xmenu", "/usr/gp2x/gp2xmenu", NULL);
return 0;
}
Alex. posted on Aug 26 2006 at 02:27 PM said:Thanks for the link Yaustar, got it!
DJWillis, while I know next to nothing about this hardcore side of coding, I'd love to learn about it. I use WinXP with DevKitGP2X and CodeBlocks, with a setup step by step from this Wiki article.
- Alex
Edit: I just gave those a try, and while the speed boost is bloody fantastic, the display flickers a lot. I read some more in that thread and it seems like that's a problem with the libs built for firmware 1.4.
Never mind that, it was caused by my effects not tailored for double buffering. Everything works ace, with a 30+ FPS boost over GPH's SDL.Alex. posted on Aug 26 2006 at 02:23 PM said:sometimes when I blit a graphic over a background, flip, and then blit another graphic over everything else, flip, it gives a sort of incomplete blit (horizontally) and some weird opacity effect
Alex. posted on Aug 27 2006 at 01:19 AM said:Never mind that, it was caused by my effects not tailored for double buffering. Everything works ace, with a 30+ FPS boost over GPH's SDL.Alex. posted on Aug 26 2006 at 02:23 PM said:sometimes when I blit a graphic over a background, flip, and then blit another graphic over everything else, flip, it gives a sort of incomplete blit (horizontally) and some weird opacity effect
- Alex