}
}
-InitGL::~InitGL() {
-
-}
-
Window::Window()
: handle(SDL_CreateWindow(
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);
}
}
}
+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;
}
}
-InitGLEW::~InitGLEW() {
-
-}
-
}