mirror of https://github.com/axmolengine/axmol.git
[dispatcher] Adding (s|g)etCurrentTarget for Event.
This commit is contained in:
parent
c948a67243
commit
838b059b45
|
@ -29,6 +29,7 @@ NS_CC_BEGIN
|
|||
Event::Event(const std::string& type)
|
||||
: _type(type)
|
||||
, _isStopped(false)
|
||||
, _currentTarget(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -36,5 +37,14 @@ Event::~Event()
|
|||
{
|
||||
}
|
||||
|
||||
Node* Event::getCurrentTarget()
|
||||
{
|
||||
return _currentTarget;
|
||||
}
|
||||
|
||||
void Event::setCurrentTarget(Node* target)
|
||||
{
|
||||
_currentTarget = target;
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class Node;
|
||||
|
||||
class Event
|
||||
{
|
||||
public:
|
||||
|
@ -42,10 +44,13 @@ public:
|
|||
const std::string& getType() const { return _type; };
|
||||
void stopPropagation() { _isStopped = true; };
|
||||
bool isStopped() const { return _isStopped; };
|
||||
|
||||
Node* getCurrentTarget();
|
||||
|
||||
protected:
|
||||
void setCurrentTarget(Node* target);
|
||||
std::string _type;
|
||||
bool _isStopped;
|
||||
Node* _currentTarget;
|
||||
|
||||
friend class EventDispatcher;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue