X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Finit.cpp;h=4772898fb364119cb53f469b32984c445bf0e722;hb=ea1ce7b0fb7709ae56977480821ac96a231a0686;hp=20f4fe4e6c0693b7e2e235eabc4173a316ed9215;hpb=d18be10ef3f0a7b61c6f5c4c4096ca2b776c75b3;p=blank.git diff --git a/src/init.cpp b/src/init.cpp index 20f4fe4..4772898 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -83,6 +83,26 @@ Window::~Window() { SDL_DestroyWindow(handle); } +void Window::GrabInput() { + SDL_SetWindowGrab(handle, SDL_TRUE); +} + +void Window::ReleaseInput() { + SDL_SetWindowGrab(handle, SDL_FALSE); +} + +void Window::GrabMouse() { + if (SDL_SetRelativeMouseMode(SDL_TRUE) != 0) { + sdl_error("SDL_SetRelativeMouseMode"); + } +} + +void Window::ReleaseMouse() { + if (SDL_SetRelativeMouseMode(SDL_FALSE) != 0) { + sdl_error("SDL_SetRelativeMouseMode"); + } +} + GLContext Window::CreateContext() { return GLContext(handle); }