summaryrefslogtreecommitdiffstats
path: root/engine/include/window.hpp
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2019-01-25 01:11:57 +0100
committerNao Pross <naopross@thearcway.org>2019-01-25 01:11:57 +0100
commitbcd14a356cafe58808b4c2a14782ebb194c6abc5 (patch)
tree3bc95288b0a0172bb447ccf218fb59821f22501a /engine/include/window.hpp
parentDelete bin and test/makefile update .gitignore (diff)
downloadflatland-bcd14a356cafe58808b4c2a14782ebb194c6abc5.tar.gz
flatland-bcd14a356cafe58808b4c2a14782ebb194c6abc5.zip
Rename everything under engine/ to remove `flat' and be `.hpp'
Diffstat (limited to 'engine/include/window.hpp')
-rw-r--r--engine/include/window.hpp97
1 files changed, 97 insertions, 0 deletions
diff --git a/engine/include/window.hpp b/engine/include/window.hpp
new file mode 100644
index 0000000..37e834d
--- /dev/null
+++ b/engine/include/window.hpp
@@ -0,0 +1,97 @@
+#ifndef __FLATWINDOW_H__
+#define __FLATWINDOW_H__
+
+#include <string>
+
+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;
+};
+
+#include "core/object.hpp"
+#include "serial/keyfocusable.h"
+
+class SDL_Window;
+class FlatLayer;
+
+class SDL_KeyEvent;
+
+class FlatWindow : virtual public flat::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);
+};
+
+#endif