summaryrefslogtreecommitdiff
path: root/Source/Asura.Engine/Graphics/Window.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-03-12 00:39:26 +0800
committerchai <chaifix@163.com>2019-03-12 00:39:26 +0800
commit70b82d1981c0de3c7b77670ff8abcfeb26815142 (patch)
treef69c05bcd204cc3f9bf745be37a2ba5911e52436 /Source/Asura.Engine/Graphics/Window.h
parentc19a282e10f51ddd50d198b903f8fbd5a2238b62 (diff)
*misc
Diffstat (limited to 'Source/Asura.Engine/Graphics/Window.h')
-rw-r--r--Source/Asura.Engine/Graphics/Window.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/Source/Asura.Engine/Graphics/Window.h b/Source/Asura.Engine/Graphics/Window.h
new file mode 100644
index 0000000..973fd98
--- /dev/null
+++ b/Source/Asura.Engine/Graphics/Window.h
@@ -0,0 +1,85 @@
+#ifndef __ASURA_ENGINE_WINDOW_H__
+#define __ASURA_ENGINE_WINDOW_H__
+
+#include "SDL2/Sdl.h"
+#include "Graphics/RenderTarget.h"
+#include "Math/Vector2.hpp"
+#include "Scripting/Portable.h"
+
+namespace AsuraEngine
+{
+ namespace Graphics
+ {
+
+ enum WindowStyle
+ {
+ WINDOW_STYLE_FULLSCREEN = 1 << 1,
+ };
+
+ ///
+ /// ڣֶ֧രڡڱ༭Ҫ֧֣runnerֻҪһڡ
+ ///
+ class Window ASURA_FINAL
+ : public RenderTarget
+ , public Scripting::Portable
+ {
+ public:
+
+ Window(WindowStyle style);
+
+ ~Window();
+
+ SDL_Window* GetSDLWindowHandle();
+
+ 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) override;
+
+ void Clear(const Math::Recti& quad, const Color& col = Color::Black) override;
+
+ void Draw(const Drawable* texture, const RenderState& state) override;
+
+ void Draw(const Drawable* texture, const Math::Recti& quad, const RenderState& state) override;
+
+ private:
+
+ ///
+ /// SDL window handle.
+ ///
+ SDL_Window* mWindowHandle;
+
+ Math::Vector2i mPosition;
+
+ Math::Vector2i mSize;
+
+ public:
+
+ //----------------------------------------------------------------------------------------------------------
+
+ LUAX_DECL_FACTORY(Window);
+
+ //----------------------------------------------------------------------------------------------------------
+
+ };
+
+ using RenderWindow = Window;
+
+ }
+}
+
+#endif \ No newline at end of file