Archived

This topic is now archived and is closed to further replies.

Aries23

problems with SDL_UpdateRect function; please help a n00b

Recommended Posts

ok guys, im used to figure everything out the hard way (without assistance and good advices), but i really need an answer this time: somehow the SDL_UpdateRect-function doesn't work with my environment, although the SDL_Flip function works fine; when i change all Flips to updaterects, my monitor sets up full screen mode, but remains black. my code: void DrawIMG(SDL_Surface *img, int x, int y, int w, int h, int x2, int y2) { SDL_Rect dest; SDL_Rect dest2; dest.x = x; dest.y = y; dest2.x = x2; dest2.y = y2; dest.w = w; dest2.h = h; SDL_BlitSurface(img, &dest2, screen, &dest); SDL_UpdateRect(screen, 0, 0, 0, 0); } did i do anything wrong?? if something is stupid and it works, it ain''t stupid [edited by - Aries23 on August 13, 2002 6:18:36 AM]

Share this post


Link to post
Share on other sites
All the flips??? You should only have one flip that is called once per frame. First blit everything and then flip.

To solve you problem you can try the following. Take the solution with the flips that works. Then change in SDL_SetVideoMode the SDL_SWSURFACE (instead of HWSURFACE and dubble buff). The SDL_Flip is now automaticlly replaced by SDL_Rect(screen,0,0,0,0), because screen is now a software surface.

I think the other way arround does not work. If you have a hardware surface and use SDL_Rect, it does not become a SDL_Flip. Maybe you forgot to change SDL_SetVideoMode mode and screen is still a hardware surface that is waiting for a flip.....

Share this post


Link to post
Share on other sites
thanks for the info. unfortunatelly i tried all the things u listed before, but nothing worked. i''ll leave my environment now as it is currently; i thought i could improve performance with the updaterect function. now, as i get more than 500fps, i don''t need any help on this topic anymore. thanks for the reply though.

Share this post


Link to post
Share on other sites