diff options
Diffstat (limited to 'src/libjin/Graphics/Window.cpp')
-rw-r--r-- | src/libjin/Graphics/Window.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/libjin/Graphics/Window.cpp b/src/libjin/Graphics/Window.cpp index 28e5b84..708a30f 100644 --- a/src/libjin/Graphics/Window.cpp +++ b/src/libjin/Graphics/Window.cpp @@ -14,17 +14,19 @@ namespace jin namespace graphics { - bool WindowSystem::initSystem(const SettingBase* s) + bool Window::initSystem(const SettingBase* s) { +#if JIN_DEBUG Loghelper::log(Loglevel::LV_INFO, "Init window system"); +#endif // JIN_DEBUG if (SDL_Init(SDL_INIT_VIDEO) < 0) return false; const Setting* setting = (Setting*)s; - width = setting->width; height = setting->height; + fps = setting->fps; bool vsync = setting->vsync; const char* title = setting->title; @@ -52,8 +54,12 @@ namespace graphics int wx = SDL_WINDOWPOS_UNDEFINED, wy = SDL_WINDOWPOS_UNDEFINED; + + int flag = SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL; + if (setting->fullscreen) flag |= SDL_WINDOW_FULLSCREEN; + if (setting->resizable) flag |= SDL_WINDOW_RESIZABLE; - wnd = SDL_CreateWindow(title, wx, wy, width, height, SDL_WINDOW_SHOWN | SDL_WINDOW_OPENGL); + wnd = SDL_CreateWindow(title, wx, wy, width, height, flag); if (wnd == NULL) return false; ctx = SDL_GL_CreateContext(wnd); @@ -73,13 +79,13 @@ namespace graphics return true; } - void WindowSystem::quitSystem() + void Window::quitSystem() { SDL_DestroyWindow(wnd); SDL_Quit(); } - inline void WindowSystem::swapBuffers() + inline void Window::swapBuffers() { if (wnd) SDL_GL_SwapWindow(wnd); |