From 538b1944f559587cc71339259ee57793380f7373 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 26 Dec 2014 17:08:01 +0300 Subject: [PATCH 1/4] Bump .so version after incompatible changes --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eac416d..3f0fc92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,7 +116,7 @@ IF(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR) # library ADD_LIBRARY(SDL2pp SHARED ${LIBRARY_SOURCES} ${LIBRARY_HEADERS}) TARGET_LINK_LIBRARIES(SDL2pp ${SDL2_ALL_LIBRARIES}) - SET_TARGET_PROPERTIES(SDL2pp PROPERTIES VERSION 1.0.0 SOVERSION 1) + SET_TARGET_PROPERTIES(SDL2pp PROPERTIES VERSION 2.0.0 SOVERSION 2) # examples and tests OPTION(SDL2PP_WITH_EXAMPLES "Build examples" ON) From 6611d95aba5ce34e963803978b2579fd6cd5ae69 Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 26 Dec 2014 17:17:20 +0300 Subject: [PATCH 2/4] Provide default argument for Texture::Lock() Unlike 3dd739d, correctly --- SDL2pp/Texture.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/SDL2pp/Texture.hh b/SDL2pp/Texture.hh index 7145061..aded353 100644 --- a/SDL2pp/Texture.hh +++ b/SDL2pp/Texture.hh @@ -28,6 +28,7 @@ #include #include +#include #include struct SDL_Texture; @@ -88,7 +89,7 @@ public: void SetAlphaMod(Uint8 alpha = 255); void SetColorMod(Uint8 r = 255, Uint8 g = 255, Uint8 b = 255); - LockHandle Lock(const Optional& rect); + LockHandle Lock(const Optional& rect = NullOpt); Uint32 GetFormat() const; int GetAccess() const; From 2d80a947976a04af8c8beaf590ac406309786e0d Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 26 Dec 2014 17:24:48 +0300 Subject: [PATCH 3/4] Remove unneeded forward declarations --- SDL2pp/Renderer.hh | 1 - SDL2pp/Texture.hh | 1 - 2 files changed, 2 deletions(-) diff --git a/SDL2pp/Renderer.hh b/SDL2pp/Renderer.hh index b3142ce..16e9e90 100644 --- a/SDL2pp/Renderer.hh +++ b/SDL2pp/Renderer.hh @@ -36,7 +36,6 @@ namespace SDL2pp { class Window; class Texture; -class Rect; class Point; class Renderer { diff --git a/SDL2pp/Texture.hh b/SDL2pp/Texture.hh index aded353..13cd74d 100644 --- a/SDL2pp/Texture.hh +++ b/SDL2pp/Texture.hh @@ -36,7 +36,6 @@ struct SDL_Texture; namespace SDL2pp { class Renderer; -class Rect; class RWops; class Texture { From 5a0623f08ee25410d50008c2264b9604d0fa6ddd Mon Sep 17 00:00:00 2001 From: Dmitry Marakasov Date: Fri, 26 Dec 2014 19:32:40 +0300 Subject: [PATCH 4/4] Add bunch of Window functions --- SDL2pp/Window.cc | 37 +++++++++++++++++++++++++++++++++++++ SDL2pp/Window.hh | 11 +++++++++++ 2 files changed, 48 insertions(+) diff --git a/SDL2pp/Window.cc b/SDL2pp/Window.cc index e535582..2073941 100644 --- a/SDL2pp/Window.cc +++ b/SDL2pp/Window.cc @@ -76,4 +76,41 @@ SDL_Window* Window::Get() const { return window_; } +void Window::Maximize() { + SDL_MaximizeWindow(window_); +} + +void Window::Minimize() { + SDL_MinimizeWindow(window_); +} + +void Window::Hide() { + SDL_HideWindow(window_); +} + +void Window::Restore() { + SDL_RestoreWindow(window_); +} + +void Window::Raise() { + SDL_RaiseWindow(window_); +} + +void Window::Show() { + SDL_ShowWindow(window_); +} + +void Window::SetFullscreen(int flags) { + if (SDL_SetWindowFullscreen(window_, flags) != 0) + throw Exception("SDL_SetWindowFullscreen failed"); +} + +void Window::SetSize(int w, int h) { + SDL_SetWindowSize(window_, w, h); +} + +void Window::SetSize(const Point& size) { + SDL_SetWindowSize(window_, size.x, size.y); +} + } diff --git a/SDL2pp/Window.hh b/SDL2pp/Window.hh index 4cda7cd..a2b067a 100644 --- a/SDL2pp/Window.hh +++ b/SDL2pp/Window.hh @@ -52,6 +52,17 @@ public: void SetTitle(const std::string& title); SDL_Window* Get() const; + + void Maximize(); + void Minimize(); + void Hide(); + void Restore(); + void Raise(); + void Show(); + + void SetFullscreen(int flags); + void SetSize(int w, int h); + void SetSize(const Point& size); }; }