22#include <kiwano/base/RefObject.h>
23#include <kiwano/base/RefPtr.h>
24#include <kiwano/event/EventType.h>
25#include <kiwano/math/Math.h>
58 template <
typename _Ty>
64 template <
typename _Ty>
65 const _Ty* Cast()
const;
70 template <
typename _Ty>
79template <
typename _Ty>
82 inline bool operator()(
const Event* evt)
const
84 static_assert(std::is_base_of<Event, _Ty>::value,
"_Ty is not an event type.");
85 return evt->
GetType() == KGE_EVENT(_Ty);
96template <
typename _Ty>
99 static_assert(std::is_base_of<Event, _Ty>::value,
"_Ty is not an event type.");
103template <
typename _Ty>
106 return const_cast<Event*
>(
this)->Cast<_Ty>();
109template <
typename _Ty>
112 if (!this->IsType<_Ty>())
114 return dynamic_cast<_Ty*
>(
this);
事件类型
Definition: EventType.h:36
const EventType & GetType() const
获取类型事件
Definition: Event.h:91
bool IsType() const
判断事件类型
Definition: Event.h:97
const _Ty * Cast() const
转换为其他类型事件
Definition: Event.h:104
引用计数器
Definition: RefObject.h:33
事件特性:判断事件类型是否相同
Definition: Event.h:81