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.
This commit is contained in:
Kirigaya Kazuto 2017-04-21 10:52:45 +08:00
parent 9090acdc0f
commit 9786aea48a
2 changed files with 13 additions and 0 deletions

View File

@ -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);

View File

@ -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.