From 589ee7ee7014a5f8918e1d99c0e04bff4f7a83cb Mon Sep 17 00:00:00 2001 From: chai Date: Sat, 28 Jul 2018 10:39:31 +0800 Subject: *update --- src/libjin/Graphics/Window.h | 60 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 src/libjin/Graphics/Window.h (limited to 'src/libjin/Graphics/Window.h') diff --git a/src/libjin/Graphics/Window.h b/src/libjin/Graphics/Window.h new file mode 100644 index 0000000..893fdb8 --- /dev/null +++ b/src/libjin/Graphics/Window.h @@ -0,0 +1,60 @@ +#ifndef __JIN_RENDER_WINDOW +#define __JIN_RENDER_WINDOW +#include "../modules.h" +#if JIN_MODULES_RENDER + +#include +#include "../utils/utils.h" +#include "../common/subsystem.h" + +namespace jin +{ +namespace graphics +{ + + class WindowSystem : public Subsystem + { + public: + + struct Setting : SettingBase + { + public: + int width, height; // 窗口大小 + bool vsync; // 垂直同步 + const char* title; // 标题 + }; + + inline int getW() + { + return width; + } + + inline int getH() + { + return height; + } + + inline void swapBuffers(); + + private: + + WindowSystem() {}; + virtual ~WindowSystem() {}; + + SINGLETON(WindowSystem); + + SDL_Window* wnd; + + int width, height; + + onlyonce bool initSystem(const SettingBase* setting) override; + onlyonce void quitSystem() override; + }; + + typedef WindowSystem::Setting WindowSetting; + +} // render +} // jin + +#endif // JIN_MODULES_RENDER +#endif // __JIN_RENDER_WINDOW \ No newline at end of file -- cgit v1.1-26-g67d0