From c302f5ae5f9e30a28e487e8a764d9cc31546bbea Mon Sep 17 00:00:00 2001 From: chai Date: Fri, 29 Mar 2019 22:51:04 +0800 Subject: *rename --- source/modules/asura-core/window/window.h | 90 +++++++++++++++++++++++++++++++ 1 file changed, 90 insertions(+) create mode 100644 source/modules/asura-core/window/window.h (limited to 'source/modules/asura-core/window/window.h') diff --git a/source/modules/asura-core/window/window.h b/source/modules/asura-core/window/window.h new file mode 100644 index 0000000..052e1ee --- /dev/null +++ b/source/modules/asura-core/window/window.h @@ -0,0 +1,90 @@ +#ifndef __ASURA_ENGINE_WINDOW_H__ +#define __ASURA_ENGINE_WINDOW_H__ + +#include +#include + +#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 + { + 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 -- cgit v1.1-26-g67d0