Yes I am using converted surfaces. I’m using hardware surfaces too. Forgot to mention I’m using SDL_image libs…
Here’s some code…
Screen = SDL_SetVideoMode(SCREEN_WIDTH,SCREEN_HEIGHT,16,SDL_HWSURFACE|SDL_DOUBLEBUF);
if (Screen==NULL)
{
printf("Can't set video mode: ", SDL_GetError(), "\n");
return 0;
}
// load up some graphics...LoadGraphic converts surfaces using SDL_DisplayFormat...
Background = LoadGraphic("graphics/bgnd.tga");
Temp = LoadGraphic("graphics/strip.tga");
DrawImage(Background,0,0,SCREEN_WIDTH,SCREEN_HEIGHT,Screen,0,0,255);
SDL_Rect DstRect;
SDL_Rect SrcRect;
DstRect.x = 165;
DstRect.y = 245;
DstRect.h = 100;
DstRect.w = Graphic ->w;
SrcRect.x = 0;
SrcRect.y = Graphic ->h;
SrcRect.h = 100;
SrcRect.w = Graphic ->w;
while (SrcRect.y!=-4)
{
DrawImage(Graphic ,SrcRect.x,SrcRect.y,SrcRect.w,SrcRect.h,Screen,DstRect.x,DstRect.y,255);
SDL_UpdateRect(Screen,0,0,0,0);
SrcRect.y -= 4;
}
…and this runs dead slow - I’m updating the Screen (which is also a Rect)
It’s not going to be anything stupid like frame rates is it? It’s going very slowly so I guessed not…I want it to just zoom by…not crawl…
Thanks
Ed
Paulo Pinto wrote: Hi,
have you done the usual stuff?
By that I mean, are you converting your surfaces
before displaying them?
http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fDisplayFormat
Are you enabling hardware surfaces?
Cheers,
Paulo
Edward Byard wrote:> Hi Folks,
I’m pretty new to video programming, but have many years of experience
on embedded systems (mechanical control systems mostly).
Anyway, I’m writing a slot machine simulator, and am having problems
getting performance out of the system. Basically, I’m using SDL_
BlitSurface to blit a portion of an image to a rectangle, and it’s
pretty slow (800x600,16bpp,double-buffered).
Now, am I missing something? I have a background image, which I then
place the aforementioned rectangle on. I don’t re-draw the background at
all - just update the rectangle. Is this making any sense?
If someone can help, I’d appreciate it…
Thanks
Ed
Try the all-new Yahoo! Mail
. “The New Version is radically easier to use” ? The Wall Street Journal
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl
All new Yahoo! Mail “The new Interface is stunning in its simplicity and ease of use.” - PC Magazine