From c6519e4cf281c2b9dade62c806647930868c4abc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Fri, 23 Aug 2013 13:17:28 +0300 Subject: fix window title and icon in SDL2. --- src/utils/sdl2helper.cpp | 10 ++++++++++ src/utils/sdl2helper.h | 8 ++++++++ src/utils/sdlhelper.cpp | 12 ++++++++++++ src/utils/sdlhelper.h | 9 +++++++++ 4 files changed, 39 insertions(+) (limited to 'src/utils') diff --git a/src/utils/sdl2helper.cpp b/src/utils/sdl2helper.cpp index 7cf624a2c..1ae8b087f 100644 --- a/src/utils/sdl2helper.cpp +++ b/src/utils/sdl2helper.cpp @@ -37,4 +37,14 @@ bool SDL::getAllVideoModes(StringVect &modeList) return true; } +void SDL::SetWindowTitle(SDL_Window *const window, const char *const title) +{ + SDL_SetWindowTitle(window, title); +} + +void SDL::SetWindowIcon(SDL_Window *const window, SDL_Surface *const icon) +{ + SDL_SetWindowIcon(window, icon); +} + #endif // USE_SDL2 diff --git a/src/utils/sdl2helper.h b/src/utils/sdl2helper.h index 101c965b8..bf3c57f0c 100644 --- a/src/utils/sdl2helper.h +++ b/src/utils/sdl2helper.h @@ -26,9 +26,17 @@ #include "localconsts.h" +struct SDL_Surface; +struct SDL_Window; + namespace SDL { bool getAllVideoModes(StringVect &modeList); + + void SetWindowTitle(SDL_Window *const window, const char *const title); + + void SetWindowIcon(SDL_Window *const window, SDL_Surface *const icon); + } // namespace SDL #endif // USE_SDL2 diff --git a/src/utils/sdlhelper.cpp b/src/utils/sdlhelper.cpp index 064989e93..9d28f6c96 100644 --- a/src/utils/sdlhelper.cpp +++ b/src/utils/sdlhelper.cpp @@ -61,4 +61,16 @@ bool SDL::getAllVideoModes(StringVect &modeList) } } +void SDL::SetWindowTitle(SDL_Surface *const window A_UNUSED, + const char *const title) +{ + SDL_WM_SetCaption(title, nullptr); +} + +void SDL::SetWindowIcon(SDL_Surface *const window A_UNUSED, + SDL_Surface *const icon) +{ + SDL_WM_SetIcon(icon, nullptr); +} + #endif // USE_SDL2 diff --git a/src/utils/sdlhelper.h b/src/utils/sdlhelper.h index f81cd449d..9d122f934 100644 --- a/src/utils/sdlhelper.h +++ b/src/utils/sdlhelper.h @@ -29,9 +29,18 @@ #include "localconsts.h" +struct SDL_Surface; + namespace SDL { bool getAllVideoModes(StringVect &modeList); + + void SetWindowTitle(SDL_Surface *const window, + const char *const title); + + void SetWindowIcon(SDL_Surface *const window A_UNUSED, + SDL_Surface *const icon); + } // namespace SDL #endif // USE_SDL2 -- cgit v1.2.3-70-g09d2