cocos2d x - cocos2dx onKeyReleased gets called at keydown instead of keyup in android -
i working cocos2dx 3.0rc2 , want respond key event in android platform. learned override onkeyreleased method of layer , setkeypadenabled(true) capture key.
however got problem, can capture event, not accurately. is, expect method gets called when released finger key. gets triggered put finger on key. being said, responds @ key-down phase while wish @ key-up phase.
can me this? way, tested code , seemed on win32, backspace key not responded (but not matter me care android)
here code blocks:
init:
... this->setkeypadenabled(true); ...
onkeyreleased:
... if(keycode == eventkeyboard::keycode::key_backspace) { onback(nullptr); } ...
i tried other way capture event, setting listener instead of putting setkeypadenabled(true). result same.
i appreciate help!
you have written correct code have used wrong key code.
it shoud eventkeyboard::keycode::key_escape
.
Comments
Post a Comment