X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Finit.cpp;h=2c1c73ad6155e0aae9654f9fa9a58f6c93477fe2;hb=6af76d9e1a6499ebdab405c1d679d24b9e19fded;hp=20f4fe4e6c0693b7e2e235eabc4173a316ed9215;hpb=e1e349bb6035463529bc341c472987d229e1cdca;p=blank.git diff --git a/src/init.cpp b/src/init.cpp index 20f4fe4..2c1c73a 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -62,10 +62,6 @@ InitGL::InitGL() { } } -InitGL::~InitGL() { - -} - Window::Window() : handle(SDL_CreateWindow( @@ -83,6 +79,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); } @@ -122,6 +138,19 @@ void GLContext::EnableVSync() { } } +void GLContext::EnableDepthTest() { + glEnable(GL_DEPTH_TEST); + glDepthFunc(GL_LESS); +} + +void GLContext::EnableBackfaceCulling() { + glEnable(GL_CULL_FACE); +} + +void GLContext::Clear() { + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); +} + InitGLEW::InitGLEW() { glewExperimental = GL_TRUE; @@ -138,8 +167,4 @@ InitGLEW::InitGLEW() { } } -InitGLEW::~InitGLEW() { - -} - }