更新EMsgManager
This commit is contained in:
parent
3747c4d0de
commit
d07f95424a
|
|
@ -19,15 +19,12 @@ int WINAPI WinMain(
|
||||||
node->setSize(30, 180);
|
node->setSize(30, 180);
|
||||||
scene->add(node);
|
scene->add(node);
|
||||||
|
|
||||||
/*auto listener = new EMouseListener([=] {
|
auto listener = new EMouseClickListener([=](EPoint) {
|
||||||
if (!EMouseMsg::isLButtonDown())
|
if (EMouseMsg::getMsg() == EMouseMsg::MOUSE_MSG::MOVE)
|
||||||
{
|
{
|
||||||
if (EMouseMsg::getMsg() == EMouseMsg::MOVE)
|
node->setPos(EMouseMsg::getPos());
|
||||||
{
|
|
||||||
node->setPos(EMouseMsg::getPos());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});*/
|
});
|
||||||
|
|
||||||
auto listener = new EKeyPressListener([=] {
|
auto listener = new EKeyPressListener([=] {
|
||||||
if (EKeyMsg::isCapitalLockOn())
|
if (EKeyMsg::isCapitalLockOn())
|
||||||
|
|
@ -41,12 +38,11 @@ int WINAPI WinMain(
|
||||||
node->move(3, 0);
|
node->move(3, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
EApp::setWindowSize(500, 500);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->bindWithNode(node);
|
listener->bindWithNode(node);
|
||||||
|
|
||||||
EMsgManager::bindListenerWithScene(listener, scene);
|
scene->bindListener(listener);
|
||||||
|
|
||||||
app.enterScene(scene);
|
app.enterScene(scene);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,10 +115,10 @@ void e2d::EScene::clearAllChildren()
|
||||||
|
|
||||||
void e2d::EScene::bindListener(EMouseListener * listener)
|
void e2d::EScene::bindListener(EMouseListener * listener)
|
||||||
{
|
{
|
||||||
EMsgManager::bindListenerWithScene(listener, this);
|
EMsgManager::bindListenerWith(listener, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::EScene::bindListener(EKeyboardListener * listener)
|
void e2d::EScene::bindListener(EKeyboardListener * listener)
|
||||||
{
|
{
|
||||||
EMsgManager::bindListenerWithScene(listener, this);
|
EMsgManager::bindListenerWith(listener, this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@ e2d::EKeyMsg keyMsg;
|
||||||
// 鼠标消息监听器
|
// 鼠标消息监听器
|
||||||
std::vector<e2d::EMouseListener*> s_vMouseListeners;
|
std::vector<e2d::EMouseListener*> s_vMouseListeners;
|
||||||
// 按键消息监听器
|
// 按键消息监听器
|
||||||
std::vector<e2d::EKeyboardListener*> s_vKeyListeners;
|
std::vector<e2d::EKeyboardListener*> s_vKeyboardListeners;
|
||||||
|
|
||||||
|
|
||||||
DWORD e2d::EMouseMsg::getX()
|
DWORD e2d::EMouseMsg::getX()
|
||||||
|
|
@ -141,7 +141,7 @@ void e2d::EMsgManager::KeyboardProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
keyMsg.m_wParam = wParam;
|
keyMsg.m_wParam = wParam;
|
||||||
keyMsg.m_lParam = lParam;
|
keyMsg.m_lParam = lParam;
|
||||||
// 执行按键消息监听函数
|
// 执行按键消息监听函数
|
||||||
for (auto klistener : s_vKeyListeners)
|
for (auto klistener : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (klistener->isRunning())
|
if (klistener->isRunning())
|
||||||
{
|
{
|
||||||
|
|
@ -150,7 +150,7 @@ void e2d::EMsgManager::KeyboardProc(UINT message, WPARAM wParam, LPARAM lParam)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::EMsgManager::bindListenerWithScene(e2d::EMouseListener * listener, EScene * pParentScene)
|
void e2d::EMsgManager::bindListenerWith(e2d::EMouseListener * listener, EScene * pParentScene)
|
||||||
{
|
{
|
||||||
WARN_IF(listener == nullptr, "EMouseListener NULL pointer exception!");
|
WARN_IF(listener == nullptr, "EMouseListener NULL pointer exception!");
|
||||||
WARN_IF(pParentScene == nullptr, "Bind EMouseListener with a NULL EScene pointer!");
|
WARN_IF(pParentScene == nullptr, "Bind EMouseListener with a NULL EScene pointer!");
|
||||||
|
|
@ -159,12 +159,12 @@ void e2d::EMsgManager::bindListenerWithScene(e2d::EMouseListener * listener, ESc
|
||||||
{
|
{
|
||||||
listener->start();
|
listener->start();
|
||||||
listener->retain();
|
listener->retain();
|
||||||
listener->bindWithScene(pParentScene);
|
listener->m_pParentScene = pParentScene;
|
||||||
s_vMouseListeners.push_back(listener);
|
s_vMouseListeners.push_back(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::EMsgManager::bindListenerWithScene(e2d::EKeyboardListener * listener, EScene * pParentScene)
|
void e2d::EMsgManager::bindListenerWith(EKeyboardListener * listener, EScene * pParentScene)
|
||||||
{
|
{
|
||||||
WARN_IF(listener == nullptr, "EKeyboardListener NULL pointer exception!");
|
WARN_IF(listener == nullptr, "EKeyboardListener NULL pointer exception!");
|
||||||
WARN_IF(pParentScene == nullptr, "Bind EKeyboardListener with a NULL EScene pointer!");
|
WARN_IF(pParentScene == nullptr, "Bind EKeyboardListener with a NULL EScene pointer!");
|
||||||
|
|
@ -173,8 +173,36 @@ void e2d::EMsgManager::bindListenerWithScene(e2d::EKeyboardListener * listener,
|
||||||
{
|
{
|
||||||
listener->start();
|
listener->start();
|
||||||
listener->retain();
|
listener->retain();
|
||||||
listener->bindWithScene(pParentScene);
|
listener->m_pParentScene = pParentScene;
|
||||||
s_vKeyListeners.push_back(listener);
|
s_vKeyboardListeners.push_back(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EMsgManager::bindListenerWith(EMouseListener * listener, ENode * pParentNode)
|
||||||
|
{
|
||||||
|
WARN_IF(listener == nullptr, "EMouseListener NULL pointer exception!");
|
||||||
|
WARN_IF(pParentNode == nullptr, "Bind EMouseListener with a NULL ENode pointer!");
|
||||||
|
|
||||||
|
if (listener && pParentNode)
|
||||||
|
{
|
||||||
|
listener->start();
|
||||||
|
listener->retain();
|
||||||
|
listener->m_pParentNode = pParentNode;
|
||||||
|
s_vMouseListeners.push_back(listener);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EMsgManager::bindListenerWith(EKeyboardListener * listener, ENode * pParentNode)
|
||||||
|
{
|
||||||
|
WARN_IF(listener == nullptr, "EKeyboardListener NULL pointer exception!");
|
||||||
|
WARN_IF(pParentNode == nullptr, "Bind EKeyboardListener with a NULL ENode pointer!");
|
||||||
|
|
||||||
|
if (listener && pParentNode)
|
||||||
|
{
|
||||||
|
listener->start();
|
||||||
|
listener->retain();
|
||||||
|
listener->m_pParentNode = pParentNode;
|
||||||
|
s_vKeyboardListeners.push_back(listener);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -189,7 +217,7 @@ void e2d::EMsgManager::startListener(EString name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 启动按键消息监听器
|
// 启动按键消息监听器
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (l->getName() == name)
|
if (l->getName() == name)
|
||||||
{
|
{
|
||||||
|
|
@ -209,7 +237,7 @@ void e2d::EMsgManager::stopListener(EString name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 停止按键消息监听器
|
// 停止按键消息监听器
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (l->getName() == name)
|
if (l->getName() == name)
|
||||||
{
|
{
|
||||||
|
|
@ -237,13 +265,13 @@ void e2d::EMsgManager::delListener(EString name)
|
||||||
}
|
}
|
||||||
// 删除按键消息监听器
|
// 删除按键消息监听器
|
||||||
std::vector<EKeyboardListener*>::iterator kIter;
|
std::vector<EKeyboardListener*>::iterator kIter;
|
||||||
for (kIter = s_vKeyListeners.begin(); kIter != s_vKeyListeners.end();)
|
for (kIter = s_vKeyboardListeners.begin(); kIter != s_vKeyboardListeners.end();)
|
||||||
{
|
{
|
||||||
if ((*kIter)->getName() == name)
|
if ((*kIter)->getName() == name)
|
||||||
{
|
{
|
||||||
(*kIter)->autoRelease();
|
(*kIter)->autoRelease();
|
||||||
(*kIter)->release();
|
(*kIter)->release();
|
||||||
kIter = s_vKeyListeners.erase(kIter);
|
kIter = s_vKeyboardListeners.erase(kIter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -286,7 +314,7 @@ void e2d::EMsgManager::clearAllMouseListeners()
|
||||||
|
|
||||||
void e2d::EMsgManager::startAllKeyboardListener()
|
void e2d::EMsgManager::startAllKeyboardListener()
|
||||||
{
|
{
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (!l->isWaiting())
|
if (!l->isWaiting())
|
||||||
{
|
{
|
||||||
|
|
@ -297,7 +325,7 @@ void e2d::EMsgManager::startAllKeyboardListener()
|
||||||
|
|
||||||
void e2d::EMsgManager::stopAllKeyboardListener()
|
void e2d::EMsgManager::stopAllKeyboardListener()
|
||||||
{
|
{
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (!l->isWaiting())
|
if (!l->isWaiting())
|
||||||
{
|
{
|
||||||
|
|
@ -308,12 +336,12 @@ void e2d::EMsgManager::stopAllKeyboardListener()
|
||||||
|
|
||||||
void e2d::EMsgManager::clearAllKeyboardListeners()
|
void e2d::EMsgManager::clearAllKeyboardListeners()
|
||||||
{
|
{
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
l->autoRelease();
|
l->autoRelease();
|
||||||
l->release();
|
l->release();
|
||||||
}
|
}
|
||||||
s_vKeyListeners.clear();
|
s_vKeyboardListeners.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::EMsgManager::startAllMouseListenersBindWithScene(EScene * pParentScene)
|
void e2d::EMsgManager::startAllMouseListenersBindWithScene(EScene * pParentScene)
|
||||||
|
|
@ -343,7 +371,7 @@ void e2d::EMsgManager::stopAllMouseListenersBindWithScene(EScene * pParentScene)
|
||||||
void e2d::EMsgManager::startAllKeyboardListenersBindWithScene(EScene * pParentScene)
|
void e2d::EMsgManager::startAllKeyboardListenersBindWithScene(EScene * pParentScene)
|
||||||
{
|
{
|
||||||
// 启动按键消息监听器
|
// 启动按键消息监听器
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (l->getParentScene() == pParentScene)
|
if (l->getParentScene() == pParentScene)
|
||||||
{
|
{
|
||||||
|
|
@ -355,7 +383,7 @@ void e2d::EMsgManager::startAllKeyboardListenersBindWithScene(EScene * pParentSc
|
||||||
void e2d::EMsgManager::stopAllKeyboardListenersBindWithScene(EScene * pParentScene)
|
void e2d::EMsgManager::stopAllKeyboardListenersBindWithScene(EScene * pParentScene)
|
||||||
{
|
{
|
||||||
// 停止按键消息监听器
|
// 停止按键消息监听器
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (l->getParentScene() == pParentScene)
|
if (l->getParentScene() == pParentScene)
|
||||||
{
|
{
|
||||||
|
|
@ -375,7 +403,7 @@ void e2d::EMsgManager::waitAllListenersBindWithScene(EScene * scene)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 挂起按键消息监听器
|
// 挂起按键消息监听器
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (l->getParentScene() == scene)
|
if (l->getParentScene() == scene)
|
||||||
{
|
{
|
||||||
|
|
@ -395,7 +423,7 @@ void e2d::EMsgManager::notifyAllListenersBindWithScene(EScene * scene)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 重启按键消息监听器
|
// 重启按键消息监听器
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (l->getParentScene() == scene)
|
if (l->getParentScene() == scene)
|
||||||
{
|
{
|
||||||
|
|
@ -421,13 +449,13 @@ void e2d::EMsgManager::clearAllListenersBindWithScene(EScene * scene)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<EKeyboardListener*>::iterator kIter;
|
std::vector<EKeyboardListener*>::iterator kIter;
|
||||||
for (kIter = s_vKeyListeners.begin(); kIter != s_vKeyListeners.end();)
|
for (kIter = s_vKeyboardListeners.begin(); kIter != s_vKeyboardListeners.end();)
|
||||||
{
|
{
|
||||||
if ((*kIter)->getParentScene() == scene)
|
if ((*kIter)->getParentScene() == scene)
|
||||||
{
|
{
|
||||||
(*kIter)->autoRelease();
|
(*kIter)->autoRelease();
|
||||||
(*kIter)->release();
|
(*kIter)->release();
|
||||||
kIter = s_vKeyListeners.erase(kIter);
|
kIter = s_vKeyboardListeners.erase(kIter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -447,7 +475,7 @@ void e2d::EMsgManager::waitAllListenersBindWithNode(ENode * pParentNode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 挂起按键消息监听器
|
// 挂起按键消息监听器
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (l->getParentNode() == pParentNode)
|
if (l->getParentNode() == pParentNode)
|
||||||
{
|
{
|
||||||
|
|
@ -467,7 +495,7 @@ void e2d::EMsgManager::notifyAllListenersBindWithNode(ENode * pParentNode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 重启按键消息监听器
|
// 重启按键消息监听器
|
||||||
for (auto l : s_vKeyListeners)
|
for (auto l : s_vKeyboardListeners)
|
||||||
{
|
{
|
||||||
if (l->getParentNode() == pParentNode)
|
if (l->getParentNode() == pParentNode)
|
||||||
{
|
{
|
||||||
|
|
@ -493,13 +521,13 @@ void e2d::EMsgManager::clearAllListenersBindWithNode(ENode * pParentNode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::vector<EKeyboardListener*>::iterator kIter;
|
std::vector<EKeyboardListener*>::iterator kIter;
|
||||||
for (kIter = s_vKeyListeners.begin(); kIter != s_vKeyListeners.end();)
|
for (kIter = s_vKeyboardListeners.begin(); kIter != s_vKeyboardListeners.end();)
|
||||||
{
|
{
|
||||||
if ((*kIter)->getParentNode() == pParentNode)
|
if ((*kIter)->getParentNode() == pParentNode)
|
||||||
{
|
{
|
||||||
(*kIter)->autoRelease();
|
(*kIter)->autoRelease();
|
||||||
(*kIter)->release();
|
(*kIter)->release();
|
||||||
kIter = s_vKeyListeners.erase(kIter);
|
kIter = s_vKeyboardListeners.erase(kIter);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -31,3 +31,23 @@ void e2d::EKeyboardListener::setCallback(const KEY_LISTENER_CALLBACK & callback)
|
||||||
{
|
{
|
||||||
m_callback = callback;
|
m_callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void e2d::EKeyboardListener::bindWithScene(EScene * pParentScene)
|
||||||
|
{
|
||||||
|
WARN_IF(m_pParentScene != nullptr || m_pParentNode != nullptr, "EListener cannot bind with two object.");
|
||||||
|
|
||||||
|
if (pParentScene)
|
||||||
|
{
|
||||||
|
EMsgManager::bindListenerWith(this, pParentScene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EKeyboardListener::bindWithNode(ENode * pParentNode)
|
||||||
|
{
|
||||||
|
WARN_IF(m_pParentScene != nullptr || m_pParentNode != nullptr, "EListener cannot bind with two object.");
|
||||||
|
|
||||||
|
if (pParentNode != nullptr && m_pParentScene == nullptr)
|
||||||
|
{
|
||||||
|
EMsgManager::bindListenerWith(this, pParentNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -45,11 +45,6 @@ void e2d::EListener::notify()
|
||||||
m_bWaiting = false;
|
m_bWaiting = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
e2d::EListener * e2d::EListener::clone()
|
|
||||||
{
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
e2d::EString e2d::EListener::getName() const
|
e2d::EString e2d::EListener::getName() const
|
||||||
{
|
{
|
||||||
return m_sName;
|
return m_sName;
|
||||||
|
|
@ -69,23 +64,3 @@ void e2d::EListener::setName(EString name)
|
||||||
{
|
{
|
||||||
m_sName = name;
|
m_sName = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
void e2d::EListener::bindWithScene(EScene * scene)
|
|
||||||
{
|
|
||||||
WARN_IF(m_pParentNode != nullptr, "EListener bind with Scene Failed! Please use its clone.");
|
|
||||||
|
|
||||||
if (scene != nullptr && m_pParentNode == nullptr)
|
|
||||||
{
|
|
||||||
m_pParentScene = scene;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void e2d::EListener::bindWithNode(ENode * pParentNode)
|
|
||||||
{
|
|
||||||
WARN_IF(m_pParentScene != nullptr, "EListener bind with Node Failed! Please use its clone.");
|
|
||||||
|
|
||||||
if (pParentNode != nullptr && m_pParentScene == nullptr)
|
|
||||||
{
|
|
||||||
m_pParentNode = pParentNode;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -31,3 +31,23 @@ void e2d::EMouseListener::setCallback(const MOUSE_LISTENER_CALLBACK & callback)
|
||||||
{
|
{
|
||||||
m_callback = callback;
|
m_callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void e2d::EMouseListener::bindWith(EScene * pParentScene)
|
||||||
|
{
|
||||||
|
WARN_IF(m_pParentScene != nullptr || m_pParentNode != nullptr, "EListener cannot bind with two object.");
|
||||||
|
|
||||||
|
if (pParentScene)
|
||||||
|
{
|
||||||
|
EMsgManager::bindListenerWith(this, pParentScene);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void e2d::EMouseListener::bindWith(ENode * pParentNode)
|
||||||
|
{
|
||||||
|
WARN_IF(m_pParentScene != nullptr || m_pParentNode != nullptr, "EListener cannot bind with two object.");
|
||||||
|
|
||||||
|
if (pParentNode != nullptr && m_pParentScene == nullptr)
|
||||||
|
{
|
||||||
|
EMsgManager::bindListenerWith(this, pParentNode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class EMouseMsg
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// 鼠标消息集合
|
// 鼠标消息集合
|
||||||
enum class MOUSE_MSG
|
enum MOUSE_MSG
|
||||||
{
|
{
|
||||||
MOVE = 0x0200, // 鼠标移动
|
MOVE = 0x0200, // 鼠标移动
|
||||||
LBUTTON_DOWN, // 鼠标左键按下
|
LBUTTON_DOWN, // 鼠标左键按下
|
||||||
|
|
@ -73,7 +73,7 @@ class EKeyMsg
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// 按键消息类型集合
|
// 按键消息类型集合
|
||||||
enum class KEYBOARD_MSG
|
enum KEYBOARD_MSG
|
||||||
{
|
{
|
||||||
KEY_DOWN = 0x0100, // 按下
|
KEY_DOWN = 0x0100, // 按下
|
||||||
KEY_UP // 抬起
|
KEY_UP // 抬起
|
||||||
|
|
@ -141,6 +141,8 @@ protected:
|
||||||
class EListener :
|
class EListener :
|
||||||
public EObject
|
public EObject
|
||||||
{
|
{
|
||||||
|
friend EMsgManager;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
EListener();
|
EListener();
|
||||||
|
|
||||||
|
|
@ -166,9 +168,6 @@ public:
|
||||||
// 唤醒
|
// 唤醒
|
||||||
void notify();
|
void notify();
|
||||||
|
|
||||||
// 克隆一个相同的监听器
|
|
||||||
virtual EListener * clone();
|
|
||||||
|
|
||||||
// 获取监听器名称
|
// 获取监听器名称
|
||||||
EString getName() const;
|
EString getName() const;
|
||||||
|
|
||||||
|
|
@ -184,14 +183,14 @@ public:
|
||||||
);
|
);
|
||||||
|
|
||||||
// 绑定监听器到场景
|
// 绑定监听器到场景
|
||||||
void bindWithScene(
|
virtual void bindWithScene(
|
||||||
EScene * pParentScene
|
EScene * pParentScene
|
||||||
);
|
) = 0;
|
||||||
|
|
||||||
// 绑定监听器到节点
|
// 绑定监听器到节点
|
||||||
void bindWithNode(
|
virtual void bindWithNode(
|
||||||
ENode * pParentNode
|
ENode * pParentNode
|
||||||
);
|
) = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EString m_sName;
|
EString m_sName;
|
||||||
|
|
@ -230,6 +229,16 @@ public:
|
||||||
const MOUSE_LISTENER_CALLBACK &callback
|
const MOUSE_LISTENER_CALLBACK &callback
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 绑定监听器到场景
|
||||||
|
virtual void bindWith(
|
||||||
|
EScene * pParentScene
|
||||||
|
);
|
||||||
|
|
||||||
|
// 绑定监听器到节点
|
||||||
|
virtual void bindWith(
|
||||||
|
ENode * pParentNode
|
||||||
|
);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
MOUSE_LISTENER_CALLBACK m_callback;
|
MOUSE_LISTENER_CALLBACK m_callback;
|
||||||
};
|
};
|
||||||
|
|
@ -331,6 +340,16 @@ public:
|
||||||
const KEY_LISTENER_CALLBACK &callback
|
const KEY_LISTENER_CALLBACK &callback
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 绑定监听器到场景
|
||||||
|
virtual void bindWithScene(
|
||||||
|
EScene * pParentScene
|
||||||
|
);
|
||||||
|
|
||||||
|
// 绑定监听器到节点
|
||||||
|
virtual void bindWithNode(
|
||||||
|
ENode * pParentNode
|
||||||
|
);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
KEY_LISTENER_CALLBACK m_callback;
|
KEY_LISTENER_CALLBACK m_callback;
|
||||||
};
|
};
|
||||||
|
|
@ -368,17 +387,29 @@ class EMsgManager
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// 绑定鼠标消息监听器到场景
|
// 绑定鼠标消息监听器到场景
|
||||||
static void bindListenerWithScene(
|
static void bindListenerWith(
|
||||||
EMouseListener * listener,
|
EMouseListener * listener,
|
||||||
EScene * pParentScene
|
EScene * pParentScene
|
||||||
);
|
);
|
||||||
|
|
||||||
// 绑定按键消息监听器到场景
|
// 绑定鼠标消息监听器到场景
|
||||||
static void bindListenerWithScene(
|
static void bindListenerWith(
|
||||||
EKeyboardListener * listener,
|
EKeyboardListener * listener,
|
||||||
EScene * pParentScene
|
EScene * pParentScene
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// 绑定按键消息监听器到节点
|
||||||
|
static void bindListenerWith(
|
||||||
|
EMouseListener * listener,
|
||||||
|
ENode * pParentNode
|
||||||
|
);
|
||||||
|
|
||||||
|
// 绑定按键消息监听器到节点
|
||||||
|
static void bindListenerWith(
|
||||||
|
EKeyboardListener * listener,
|
||||||
|
ENode * pParentNode
|
||||||
|
);
|
||||||
|
|
||||||
// 启动具有相同名称的监听器
|
// 启动具有相同名称的监听器
|
||||||
static void startListener(
|
static void startListener(
|
||||||
EString name
|
EString name
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue