summaryrefslogtreecommitdiff
path: root/source/libs/asura-lib-core/window/window.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/libs/asura-lib-core/window/window.h')
-rw-r--r--source/libs/asura-lib-core/window/window.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/source/libs/asura-lib-core/window/window.h b/source/libs/asura-lib-core/window/window.h
new file mode 100644
index 0000000..39db73e
--- /dev/null
+++ b/source/libs/asura-lib-core/window/window.h
@@ -0,0 +1,90 @@
+#ifndef __ASURA_ENGINE_WINDOW_H__
+#define __ASURA_ENGINE_WINDOW_H__
+
+#include <asura-lib-utils/scripting/portable.hpp>
+#include <asura-lib-utils/math/vector2.hpp>
+
+#include "../graphics/render_state.h"
+#include "../graphics/render_target.h"
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ class WindowImpl;
+
+ enum WindowStyle
+ {
+ WINDOW_STYLE_FULLSCREEN = 1 << 1,
+ };
+
+ ///
+ /// ϷĵڣrunnerֻҪһڡͬĿͻʵִ˽ӿڲֶעᵽlua༭ᵼ࣬޽ӵ༭
+ /// ⴰϡ
+ ///
+ class Window
+ : public RenderTarget
+ , public AEScripting::Portable<Window>
+ {
+ public:
+
+ LUAX_DECL_SINGLETON(Window);
+
+ Window(WindowStyle style);
+
+ ~Window();
+
+ void SetSize(uint width, uint height);
+
+ void SetPosition(int x, int y);
+
+ void SetTitle(const std::string& title);
+
+ void SetWindowStyle(WindowStyle style);
+
+ void Show();
+
+ void Hide();
+
+ ///
+ /// ǿ˫ĴڣҪչʾǰ̨
+ ///
+ void SwapRenderBuffer();
+
+ void Clear(const Color& col = Color::Black);
+
+ void Clear(const Math::Recti& quad, const Color& col = Color::Black);
+
+ void Draw(const Drawable* texture, const RenderState& state);
+
+ void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state);
+
+ protected:
+
+ WindowImpl* mImpl;
+
+ LUAX_DECL_METHOD(_Show);
+ LUAX_DECL_METHOD(_Hide);
+ LUAX_DECL_METHOD(_SetResolution);
+ LUAX_DECL_METHOD(_SetFullScreen);
+ LUAX_DECL_METHOD(_SetTitle);
+ LUAX_DECL_METHOD(_SetWindowStyle);
+ LUAX_DECL_METHOD(_Clear);
+ LUAX_DECL_METHOD(_Draw);
+ LUAX_DECL_METHOD(_SwapRenderBuffer);
+
+ };
+
+ using RenderWindow = Window;
+
+ ASURA_ABSTRACT class WindowImpl
+ {
+ public:
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file