add gui examples.
This commit is contained in:
@@ -14,12 +14,14 @@ namespace hgl
|
||||
*/
|
||||
class Form:public Widget
|
||||
{
|
||||
protected: //每个窗体独立一个FBO存在,所以每个窗体会有自己的RenderTarget与pipeline
|
||||
protected:
|
||||
|
||||
public:
|
||||
|
||||
Form(ThemeEngine *te=nullptr):Widget(nullptr,te){}
|
||||
virtual ~Form()=default;
|
||||
|
||||
|
||||
};//class Form
|
||||
}//namespace gui
|
||||
}//namespace hgl
|
||||
|
@@ -13,6 +13,8 @@ namespace hgl
|
||||
class GPUDevice;
|
||||
}//namespace vulkan
|
||||
|
||||
constexpr VkFormat DefaultRenderTargetFormat=UFMT_ABGR8; ///<缺省窗体绘图表面格式
|
||||
|
||||
class ThemeEngine
|
||||
{
|
||||
protected:
|
||||
@@ -21,6 +23,12 @@ namespace hgl
|
||||
|
||||
MapObject<Form *,ThemeForm> form_list;
|
||||
|
||||
RenderTarget *CreateRenderTarget(const uint32_t,const uint32_t,const VkFormat);
|
||||
|
||||
protected:
|
||||
|
||||
virtual bool ThemeRender(Form *)=0;
|
||||
|
||||
public:
|
||||
|
||||
ThemeEngine(GPUDevice *dev){device=dev;}
|
||||
@@ -28,11 +36,11 @@ namespace hgl
|
||||
|
||||
virtual bool Init()=0;
|
||||
virtual void Clear()=0;
|
||||
|
||||
virtual bool Registry(Form *)=0;
|
||||
virtual void Unregistry(Form *)=0;
|
||||
virtual void Render(Form *)=0;
|
||||
virtual bool Resize(Form *,const uint32_t,const uint32_t);
|
||||
|
||||
virtual bool Registry(Form *,const VkFormat format=DefaultRenderTargetFormat);
|
||||
virtual void Unregistry(Form *);
|
||||
virtual bool Resize(Form *,const uint32_t,const uint32_t,const VkFormat format=DefaultRenderTargetFormat);
|
||||
virtual void Render(Form *);
|
||||
};//class ThemeEngine
|
||||
|
||||
// ThemeEngine *CreateThemeEngine();
|
||||
|
@@ -8,18 +8,26 @@ namespace hgl
|
||||
{
|
||||
namespace gui
|
||||
{
|
||||
using namespace hgl::graph;
|
||||
|
||||
class ThemeForm
|
||||
{
|
||||
protected:
|
||||
|
||||
Form *form;
|
||||
hgl::graph::RenderTarget *render_target;
|
||||
RenderTarget *render_target;
|
||||
|
||||
public:
|
||||
|
||||
ThemeForm(Form *);
|
||||
ThemeForm(Form *,RenderTarget *);
|
||||
virtual ~ThemeForm();
|
||||
|
||||
RenderTarget * GetRenderTarget(){return render_target;}
|
||||
bool SetRenderTarget(RenderTarget *);
|
||||
|
||||
void Resize(uint w,uint h);
|
||||
|
||||
|
||||
void SetRenderTarget(hgl::graph::RenderTarget *);
|
||||
};//class ThemeForm
|
||||
}//namespace gui
|
||||
}//namespace hgl
|
||||
|
@@ -52,12 +52,14 @@ namespace hgl
|
||||
void SetPosition (const RectScope2i &);
|
||||
void SetSize (const Vector2f &);
|
||||
|
||||
public: //事件
|
||||
|
||||
virtual void OnResize(uint,uint);
|
||||
|
||||
public:
|
||||
|
||||
Widget(Widget *parent=nullptr,ThemeEngine *te=nullptr);
|
||||
virtual ~Widget()=default;
|
||||
|
||||
virtual void Draw(){}
|
||||
};//class Widget
|
||||
}//namespace gui
|
||||
}//namespace hgl
|
||||
|
Reference in New Issue
Block a user