Sdl / Cross Compiling Question, Sdl_Rect


maiden

Member
Joined
Jul 28, 2009
Messages
120
Age
35
Location
Västerås Sweden
Website
mybot.se
when i compile and run the following code on a computer, the white rect shows on black background.
but if i compile it on a Wiz / Gp2x / Dingoo, i only gets an black screen, what am i doing wrong?

i have had this problem before, with rects that show up some times and some times not. do i have to lock the screen?
Code:
#include <SDL/SDL.h>

SDL_Surface* screen = NULL;

int main()
{
  if(SDL_Init(SDL_INIT_EVERYTHING) == -1)
     return 0;
  screen = SDL_SetVideoMode(320, 240, 16, SDL_SWSURFACE | SDL_DOUBLEBUF);

  SDL_Rect rect;
  rect.x = 10;
  rect.y = 10;
  rect.w = 10;
  rect.h = 10;

  SDL_FillRect(screen, &rect, SDL_MapRGB(screen->format,255,255,255));

  SDL_Flip(screen);

  SDL_Delay(2000);

  return 0;
}
 
Why would that be needed? does the Pandora SDL support SDL_DOUBLEBUF? I'm asking because I'm writing something with the hope of porting it to the Pandora but I am using SDL_DOUBLEBUF and while it isn't critical, it would affect my code somewhat...
 
maiden said:
Thanks, removing doublebuf did it for me!

@centus good question, it seams to not be supported on gp2x / wiz / dingoo

Exactly thats why I suggested it. Although it should work for the gp2x/pandora. For the wiz last time I checked it would run but have a flickering effect.
 
Last edited by a moderator:
Back
Top