diff options
Diffstat (limited to 'src/libjin/Render/Window.h')
-rw-r--r-- | src/libjin/Render/Window.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/libjin/Render/Window.h b/src/libjin/Render/Window.h new file mode 100644 index 0000000..77b1963 --- /dev/null +++ b/src/libjin/Render/Window.h @@ -0,0 +1,59 @@ +#ifndef __JIN_RENDER_WINDOW +#define __JIN_RENDER_WINDOW +#include "../modules.h" +#if JIN_MODULES_RENDER + +#include <SDL2/SDL.h> +#include "../utils/utils.h" +#include "../common/subsystem.h" + +namespace jin +{ +namespace render +{ + + class WindowSystem : public Subsystem<WindowSystem> + { + 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; + +} +} +#endif // JIN_MODULES_RENDER +#endif
\ No newline at end of file |