From 9786aea48a0ba466892e1c2461ae682b4f996221 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Fri, 21 Apr 2017 10:52:45 +0800 Subject: [PATCH] Add Grab setter and getter to class Window Grab: When input is grabbed the mouse is confined to the window. If the caller enables a grab while another window is currently grabbed, the other window loses its grab in favor of the caller's window. --- MiniEngine.cpp | 10 ++++++++++ MiniEngine.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/MiniEngine.cpp b/MiniEngine.cpp index 8303ab8..e3d1478 100644 --- a/MiniEngine.cpp +++ b/MiniEngine.cpp @@ -829,6 +829,16 @@ namespace MiniEngine return std::string(SDL_GetWindowTitle(_get())); } + void Window::setGrab(bool isGrab) + { + SDL_SetWindowGrab(_get(),isGrab?SDL_TRUE:SDL_FALSE); + } + + bool Window::getGrab() + { + return (SDL_GetWindowGrab(_get())==SDL_TRUE)?true:false; + } + void Window::setResizable(bool resizable) { //SDL_SetWindowResizable(_get(), resizable?SDL_TRUE:SDL_FALSE); diff --git a/MiniEngine.h b/MiniEngine.h index da5154a..176094a 100644 --- a/MiniEngine.h +++ b/MiniEngine.h @@ -268,6 +268,9 @@ namespace MiniEngine void setTitle(std::string Title); std::string getTitle(); + void setGrab(bool); + bool getGrab(); + void setResizable(bool resizable); /// Use UTF8 in Title and Message please.