From ec1beaa2ee07368368e9bd45fe400eedc57419eb Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 21 Aug 2013 14:37:03 +0300 Subject: first part of fixes for compilation with SDL2 --- src/gui/gui.cpp | 5 +++++ src/gui/sdlfont.cpp | 8 ++++++++ src/gui/viewport.cpp | 1 + src/gui/whoisonline.cpp | 5 +++++ 4 files changed, 19 insertions(+) (limited to 'src/gui') diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp index 2a838069b..8d96cfde3 100644 --- a/src/gui/gui.cpp +++ b/src/gui/gui.cpp @@ -437,8 +437,13 @@ void Gui::draw() int mouseX, mouseY; const uint8_t button = SDL_GetMouseState(&mouseX, &mouseY); +#ifdef USE_SDL2 + if (button & SDL_BUTTON(1) && mMouseCursors && mCustomCursor + && mMouseCursorAlpha > 0.0f) +#else if ((SDL_GetAppState() & SDL_APPMOUSEFOCUS || button & SDL_BUTTON(1)) && mMouseCursors && mCustomCursor && mMouseCursorAlpha > 0.0f) +#endif { Graphics *g2 = static_cast(mGraphics); const Image *const image = dragDrop.getItemImage(); diff --git a/src/gui/sdlfont.cpp b/src/gui/sdlfont.cpp index 2e974f6d8..b1e0092d7 100644 --- a/src/gui/sdlfont.cpp +++ b/src/gui/sdlfont.cpp @@ -137,7 +137,11 @@ void SDLTextChunk::generate(TTF_Font *const font, const float alpha) sdlCol.b = static_cast(color.b); sdlCol.r = static_cast(color.r); sdlCol.g = static_cast(color.g); +#ifdef USE_SDL2 + sdlCol.a = 0; +#else sdlCol.unused = 0; +#endif getSafeUtf8String(text, strBuf); @@ -170,7 +174,11 @@ void SDLTextChunk::generate(TTF_Font *const font, const float alpha) sdlCol2.b = static_cast(color2.b); sdlCol2.r = static_cast(color2.r); sdlCol2.g = static_cast(color2.g); +#ifdef USE_SDL2 + sdlCol2.a = 0; +#else sdlCol2.unused = 0; +#endif SDL_Surface *const surface2 = TTF_RenderUTF8_Blended( font, strBuf, sdlCol2); if (!surface2) diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp index 34a24e2aa..fe5238e41 100644 --- a/src/gui/viewport.cpp +++ b/src/gui/viewport.cpp @@ -31,6 +31,7 @@ #include "keyboardconfig.h" #include "localplayer.h" #include "playerinfo.h" +#include "sdlshared.h" #include "textmanager.h" #include "gui/beingpopup.h" diff --git a/src/gui/whoisonline.cpp b/src/gui/whoisonline.cpp index 741e1e771..7036ac7d0 100644 --- a/src/gui/whoisonline.cpp +++ b/src/gui/whoisonline.cpp @@ -581,7 +581,12 @@ void WhoIsOnline::download() SDL_WaitThread(mThread, nullptr); mDownloadComplete = false; +#ifdef USE_SDL2 + mThread = SDL_CreateThread(WhoIsOnline::downloadThread, + "whoisonline", this); +#else mThread = SDL_CreateThread(WhoIsOnline::downloadThread, this); +#endif if (mThread == nullptr) mDownloadStatus = UPDATE_ERROR; -- cgit v1.2.3-60-g2f50