JyCet
Member
Hi all,
Another pb with sdl on gp2x (i dont know how many pb i've with this api )
I use paeryn hw sdl lib
and i've ~110fps to display a 8bits bmp picture on the lcd
and only ~22fps to diplay a 24bits bmp picture on the lcd
I think I do something wrong ... it's not possible to have this big (big) difference ?!
Here my code (it's the same for the 2 picture 8b or 24b)
Do I miss something ?
Thanks
Another pb with sdl on gp2x (i dont know how many pb i've with this api )
I use paeryn hw sdl lib
and i've ~110fps to display a 8bits bmp picture on the lcd
and only ~22fps to diplay a 24bits bmp picture on the lcd
I think I do something wrong ... it's not possible to have this big (big) difference ?!
Here my code (it's the same for the 2 picture 8b or 24b)
Code:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <SDL/SDL.h>
#define GP2X_BUTTON_START (8)
SDL_Surface *bg;
SDL_Surface *screen;
void drawSprite(SDL_Surface* imageSurface, SDL_Surface* screenSurface, int srcX, int srcY, int dstX, int dstY, int width, int height)
{
SDL_Rect srcRect;
srcRect.x = srcX;
srcRect.y = srcY;
srcRect.w = width;
srcRect.h = height;
SDL_Rect dstRect;
dstRect.x = dstX;
dstRect.y = dstY;
dstRect.w = width;
dstRect.h = height;
SDL_BlitSurface(imageSurface, &srcRect, screenSurface, &dstRect);
}
int main(int argc, char *argv[])
{
int done = 0;
SDL_Event event;
SDL_Init(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO);
screen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE);
SDL_ShowCursor (0); //desactive souris
SDL_JoystickOpen(0);
bg = SDL_LoadBMP("./bg.bmp");
while (!done)
{
drawSprite(bg, screen, 0, 0, 0, 0, 320, 240);
SDL_UpdateRect(screen, 0, 0, 0, 0);
SDL_PollEvent(&event);
if (event.type & SDL_JOYBUTTONDOWN ){
if (event.jbutton.button==GP2X_BUTTON_START)
done = 1;
}
}
SDL_JoystickClose(0);
chdir("/usr/gp2x");
execl("gp2xmenu","gp2xmenu",NULL);
SDL_Quit();
return 0;
}
Do I miss something ?
Thanks