mirror of https://github.com/axmolengine/axmol.git
check if delegate is not null when dispatching keyboard event
This commit is contained in:
parent
ef6841b532
commit
83be06bafb
|
@ -54,14 +54,18 @@ void CCKeyboardDispatcher::setKeyReleaseDelegate(CCKeyboardDelegate delegate)
|
|||
|
||||
bool CCKeyboardDispatcher::dispatchKeyboardEvent(int keyCode, bool pressed)
|
||||
{
|
||||
if (pressed)
|
||||
if (m_keyPressDelegate != NULL && pressed)
|
||||
{
|
||||
m_keyPressDelegate(keyCode);
|
||||
}
|
||||
else
|
||||
else if (m_keyReleaseDelegate != NULL)
|
||||
{
|
||||
m_keyReleaseDelegate(keyCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue