Skip to main content
GameDev.net gamedev.net
🔒 Locked

SDL_DOUBLEBUF Question.

Started by rtw1701 Oct 31, 2003 at 10:40 PM 4 replies 2.5k views
Original Post
rtw1701
rtw1701
Hi, Just trying SDL for first time. What is the Doublebuf surface called? I create a SDL_Surface* pSurface = SDL_SetVideoMode ( 800 , 600 , 32, SDL_FULLSCREEN|SDL_SRCCOLORKEY|SDL_DOUBLEBUF|SDL_SWSURFACE ); I can flip with SDL_Flip(pSurface); but the mouse cursor is drawn all over the screen like a paint program. So what I am looking for is how to clear the Doublebuf screen to get rid of all the mouse pointers. Or what else am I missing? Using XP Pro, VC++ 6. Thanks for time taken.
YoshiN
YoshiN
SDL_ShowCursor(false);
-YoshiXGXCX ''99
rtw1701
rtw1701
Thks for response...
Sry wasnt clear bout it, but I am looking for cursor still to be displayed. Just not 1000s of times.
Axenation
Axenation
are you using a custom mouse image? if so, each frame you will have to re-draw the area where your mouse cursor is located.

if you're drawing over a black screen (no back-round image)

// screen is a pointer to the display surface

SDL_Rect s;
s.x = mouse_cursor_last_x; // mouse x at last frame

s.y = mouse_cursoe_last_y; // mouse y at last frame

s.w = mouse_image->w; // width of the mouse image

s.h = mouse_image->h; // height of the mouse image

SDL_FillRect(screen, &s, 0xFFFFFF);



if you're using a background image

// screen is a pointer to the display surface

// bg_image is a pointer to your background surface

SDL_Rect s;
s.x = mouse_cursor_last_x; // mouse x at last frame

s.y = mouse_cursor_last_y; // mouse y at last frame

s.w = mouse_image->w; // width of the mouse image

s.h = mouse_image->h; // height of the mouse image

SDL_BlitSurface(bg_image, NULL, screen, &s);




or you could just redraw the back ground image each frame.


hope that helps ya a bit.



[edited by - Axenation on November 3, 2003 2:27:14 PM]
Now I get a cookie!
rtw1701
rtw1701
Thanks for help.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.