X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;f=src%2Finit.cpp;h=061e848e073691af5fcedca51763e4af97c91a80;hb=9c2baccb84195b7a2858c2b967c94d15cd31836b;hp=20f4fe4e6c0693b7e2e235eabc4173a316ed9215;hpb=e1e349bb6035463529bc341c472987d229e1cdca;p=blank.git diff --git a/src/init.cpp b/src/init.cpp index 20f4fe4..061e848 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,23 @@ 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); +} + +void GLContext::ClearDepthBuffer() { + glClear(GL_DEPTH_BUFFER_BIT); +} + InitGLEW::InitGLEW() { glewExperimental = GL_TRUE; @@ -138,8 +171,4 @@ InitGLEW::InitGLEW() { } } -InitGLEW::~InitGLEW() { - -} - }