diff options
Diffstat (limited to 'engine/include')
-rw-r--r-- | engine/include/window.hpp | 103 |
1 files changed, 12 insertions, 91 deletions
diff --git a/engine/include/window.hpp b/engine/include/window.hpp index 98e8e04..99a6fa6 100644 --- a/engine/include/window.hpp +++ b/engine/include/window.hpp @@ -1,101 +1,22 @@ -#ifndef __FLATWINDOW_H__ -#define __FLATWINDOW_H__ +#pragma once + +#include "wsdl2/video.hpp" #include "core/object.hpp" #include "serial/keyfocusable.hpp" #include <string> -class SDL_Window; -class SDL_KeyEvent; - namespace flat { + class window : virtual public core::object, public wsdl2::window { + public: + window() = delete; + window(const window& other) = delete; + window(const std::string& title, std::size_t width, std::size_t height); + ~window(); -struct window_status -{ - window_status( unsigned char fullscreen = 0, - unsigned char hidden = 0, - unsigned char borderless = 0, - unsigned char resizable = 1, - unsigned char minimized = 0, - unsigned char maximized = 0, - unsigned char focus = 1) - - : fullscreen(fullscreen), hidden(hidden), borderless(borderless), - resizable(resizable), minimized(minimized), maximized(maximized), - focus(focus) {} - - unsigned char fullscreen:1; - unsigned char hidden:1; - unsigned char borderless:1; - unsigned char resizable:1; - unsigned char minimized:1; - unsigned char maximized:1; - unsigned char focus:1; -}; - - -class FlatLayer; - -class FlatWindow : virtual public core::object, public KeyFocusable -{ - std::string title; - window_status status; - - SDL_Rect * bounds; - SDL_Window * sdl_window; - SDL_Surface * screen; - - FlatLayer * main_layer; - - void key_cb(const SDL_KeyboardEvent*) override; - -// TODO window calls -//protected: - - //virtual void resizeEvent(); - - //virtual void quitEvent(); - -public: - - FlatWindow(int x, int y, - int width, int height, - const std::string& title, - window_status status = window_status()); - - FlatWindow( SDL_Rect *bounds, const std::string& title, - window_status status = window_status()); - - FlatWindow( int width, int height, - const std::string &title, - window_status status = window_status()); - - FlatWindow(const FlatWindow&); - - ~FlatWindow(); - - int open(); - void close(); - - int getWidth() const; - int getHeight() const; - - const SDL_Rect * getBounds() const; - - SDL_Window * getSDLWindow(); - SDL_Surface * getScreenSurface(); - - const std::string& getTitle() const; - - void setTitle(const std::string&); - - window_status getWindowStatus() const; - - void setWindowStatus(window_status); - - static uint32_t winstatus_to_flags(window_status); -}; + private: + // std::multiset<layer> m_layers; + }; } -#endif |