Skip to content
Browse files

SwapBuffers: generalize cursor/tooltip drawing

should re-enable both on SDL2 dirver.
  • Loading branch information...
1 parent b500324 commit fbb06c26181ac08c8f7d29b052f409b4248b74ef @bradallred bradallred committed Jun 29, 2013
Showing with 30 additions and 32 deletions.
  1. +5 −31 gemrb/plugins/SDLVideo/SDL12Video.cpp
  2. +25 −1 gemrb/plugins/SDLVideo/SDLVideo.cpp
View
36 gemrb/plugins/SDLVideo/SDL12Video.cpp
@@ -190,8 +190,6 @@ bool SDL12VideoDriver::SetFullscreenMode(bool set)
int SDL12VideoDriver::SwapBuffers(void)
{
- int ret = SDLVideoDriver::SwapBuffers();
-
SDL_BlitSurface( backBuf, NULL, disp, NULL );
if (fadeColor.a) {
SDL_SetAlpha( extra, SDL_SRCALPHA, fadeColor.a );
@@ -204,36 +202,12 @@ int SDL12VideoDriver::SwapBuffers(void)
SDL_BlitSurface( extra, &src, disp, &dst );
}
- if (Cursor[CursorIndex] && !(MouseFlags & (MOUSE_DISABLED | MOUSE_HIDDEN))) {
- SDL_Surface* temp = backBuf;
- backBuf = disp; // FIXME: UGLY HACK!
- if (MouseFlags&MOUSE_GRAYED) {
- //used for greyscale blitting, fadeColor is unused
- BlitGameSprite(Cursor[CursorIndex], CursorPos.x, CursorPos.y, BLIT_GREY, fadeColor, NULL, NULL, NULL, true);
- } else {
- BlitSprite(Cursor[CursorIndex], CursorPos.x, CursorPos.y, true);
- }
- backBuf = temp;
- }
- if (!(MouseFlags & MOUSE_NO_TOOLTIPS)) {
- //handle tooltips
- unsigned int delay = core->TooltipDelay;
- // The multiplication by 10 is there since the last, disabling slider position is the eleventh
- if (!core->ConsolePopped && (delay<TOOLTIP_DELAY_FACTOR*10) ) {
- unsigned long time = GetTickCount();
- /** Display tooltip if mouse is idle */
- if (( time - lastMouseMoveTime ) > delay) {
- if (EvntManager)
- EvntManager->MouseIdle( time - lastMouseMoveTime );
- }
+ /** This causes the tooltips/cursors to be rendered directly to display */
+ SDL_Surface* tmp = backBuf;
+ backBuf = disp; // FIXME: UGLY HACK!
+ int ret = SDLVideoDriver::SwapBuffers();
+ backBuf = tmp;
- /** This causes the tooltip to be rendered directly to display */
- SDL_Surface* tmp = backBuf;
- backBuf = disp; // FIXME: UGLY HACK!
- core->DrawTooltip();
- backBuf = tmp;
- }
- }
SDL_Flip( disp );
return ret;
}
View
26 gemrb/plugins/SDLVideo/SDLVideo.cpp
@@ -98,11 +98,35 @@ int SDLVideoDriver::SwapBuffers(void)
lastTime = time;
bool ConsolePopped = core->ConsolePopped;
-
if (ConsolePopped) {
core->DrawConsole();
}
+ if (Cursor[CursorIndex] && !(MouseFlags & (MOUSE_DISABLED | MOUSE_HIDDEN))) {
+
+ if (MouseFlags&MOUSE_GRAYED) {
+ //used for greyscale blitting, fadeColor is unused
+ BlitGameSprite(Cursor[CursorIndex], CursorPos.x, CursorPos.y, BLIT_GREY, fadeColor, NULL, NULL, NULL, true);
+ } else {
+ BlitSprite(Cursor[CursorIndex], CursorPos.x, CursorPos.y, true);
+ }
+ }
+ if (!(MouseFlags & MOUSE_NO_TOOLTIPS)) {
+ //handle tooltips
+ unsigned int delay = core->TooltipDelay;
+ // The multiplication by 10 is there since the last, disabling slider position is the eleventh
+ if (!core->ConsolePopped && (delay<TOOLTIP_DELAY_FACTOR*10) ) {
+ unsigned long time = GetTickCount();
+ /** Display tooltip if mouse is idle */
+ if (( time - lastMouseMoveTime ) > delay) {
+ if (EvntManager)
+ EvntManager->MouseIdle( time - lastMouseMoveTime );
+ }
+
+ core->DrawTooltip();
+ }
+ }
+
return PollEvents();
}

0 comments on commit fbb06c2

Please sign in to comment.
Something went wrong with that request. Please try again.