update Components
This commit is contained in:
parent
ccbaf0573f
commit
ab9c650b0a
|
|
@ -20,8 +20,13 @@
|
||||||
|
|
||||||
#include "Component.h"
|
#include "Component.h"
|
||||||
|
|
||||||
|
#define KGE_DEFINE_COMPONENT_FLAG ( 0x01 << (__COUNTER__ % 32) )
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
const Int32 RenderComponent::flag = KGE_DEFINE_COMPONENT_FLAG;
|
||||||
|
const Int32 UpdateComponent::flag = KGE_DEFINE_COMPONENT_FLAG;
|
||||||
|
const Int32 EventComponent::flag = KGE_DEFINE_COMPONENT_FLAG;
|
||||||
|
|
||||||
ComponentBase::ComponentBase()
|
ComponentBase::ComponentBase()
|
||||||
: flag_(0)
|
: flag_(0)
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,7 @@
|
||||||
|
|
||||||
namespace kiwano
|
namespace kiwano
|
||||||
{
|
{
|
||||||
|
// 基础组件
|
||||||
#define KGE_DEFINE_COMPONENT_FLAG ( 0x01 << (__COUNTER__ % 32) )
|
|
||||||
|
|
||||||
class KGE_API ComponentBase
|
class KGE_API ComponentBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
@ -46,49 +44,55 @@ namespace kiwano
|
||||||
|
|
||||||
class RenderTarget;
|
class RenderTarget;
|
||||||
|
|
||||||
|
// 渲染支持组件
|
||||||
class KGE_API RenderComponent
|
class KGE_API RenderComponent
|
||||||
: public virtual ComponentBase
|
: public virtual ComponentBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const Int32 flag = KGE_DEFINE_COMPONENT_FLAG;
|
|
||||||
|
|
||||||
RenderComponent();
|
|
||||||
|
|
||||||
virtual void BeforeRender() {}
|
virtual void BeforeRender() {}
|
||||||
|
|
||||||
virtual void OnRender(RenderTarget*) {}
|
virtual void OnRender(RenderTarget*) {}
|
||||||
|
|
||||||
virtual void AfterRender() {}
|
virtual void AfterRender() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const Int32 flag;
|
||||||
|
|
||||||
|
RenderComponent();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 更新支持组件
|
||||||
class KGE_API UpdateComponent
|
class KGE_API UpdateComponent
|
||||||
: public virtual ComponentBase
|
: public virtual ComponentBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const Int32 flag = KGE_DEFINE_COMPONENT_FLAG;
|
|
||||||
|
|
||||||
UpdateComponent();
|
|
||||||
|
|
||||||
virtual void BeforeUpdate() {}
|
virtual void BeforeUpdate() {}
|
||||||
|
|
||||||
virtual void OnUpdate(Duration) {}
|
virtual void OnUpdate(Duration) {}
|
||||||
|
|
||||||
virtual void AfterUpdate() {}
|
virtual void AfterUpdate() {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const Int32 flag;
|
||||||
|
|
||||||
|
UpdateComponent();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// 事件支持组件
|
||||||
class KGE_API EventComponent
|
class KGE_API EventComponent
|
||||||
: public virtual ComponentBase
|
: public virtual ComponentBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const Int32 flag = KGE_DEFINE_COMPONENT_FLAG;
|
|
||||||
|
|
||||||
EventComponent();
|
|
||||||
|
|
||||||
virtual void HandleEvent(Event&) {}
|
virtual void HandleEvent(Event&) {}
|
||||||
|
|
||||||
virtual void HandleMessage(HWND, UInt32, WPARAM, LPARAM) {}
|
virtual void HandleMessage(HWND, UInt32, WPARAM, LPARAM) {}
|
||||||
|
|
||||||
|
public:
|
||||||
|
static const Int32 flag;
|
||||||
|
|
||||||
|
EventComponent();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -209,15 +209,14 @@ namespace kiwano
|
||||||
void ResizeTarget(UInt32 width, UInt32 height);
|
void ResizeTarget(UInt32 width, UInt32 height);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool vsync_;
|
bool vsync_;
|
||||||
HWND hwnd_;
|
HWND hwnd_;
|
||||||
Color clear_color_;
|
Color clear_color_;
|
||||||
Size output_size_;
|
Size output_size_;
|
||||||
|
|
||||||
ComPtr<ID2DDeviceResources> d2d_res_;
|
|
||||||
ComPtr<ID3DDeviceResources> d3d_res_;
|
|
||||||
ComPtr<ID2D1DrawingStateBlock> drawing_state_block_;
|
|
||||||
|
|
||||||
|
ComPtr<ID2DDeviceResources> d2d_res_;
|
||||||
|
ComPtr<ID3DDeviceResources> d3d_res_;
|
||||||
|
ComPtr<ID2D1DrawingStateBlock> drawing_state_block_;
|
||||||
ComPtr<IFontCollectionLoader> font_collection_loader_;
|
ComPtr<IFontCollectionLoader> font_collection_loader_;
|
||||||
ComPtr<IResourceFontFileLoader> res_font_file_loader_;
|
ComPtr<IResourceFontFileLoader> res_font_file_loader_;
|
||||||
ComPtr<IResourceFontCollectionLoader> res_font_collection_loader_;
|
ComPtr<IResourceFontCollectionLoader> res_font_collection_loader_;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue