[3.0 - Keyboard] - KeyDown / KeyUp function

Hi there.

I have been fiddling with cocos2d-x for a windows game, and have managed to capture events for onkeydown and onkeyup. These only fire once though.

I am working on movement in a game, and need a multi-firing key event. (like a keydown check) — How would I go about implementing this?

I had thought about just hooking the windows/mac/linux keyboard on my own in my game, but I’d prefer to use what the engine provides me.

I see the CCEventKeyboard class already has scancodes defined.

Hey Justin,

maybe this thread can help you:

You problem sounds a little bit like the one you described. Maybe you only fire once because the keyboard pressed & release event is fired with every frame, while you’re still holding your key?

They solved the problem, using this pull: https://github.com/cocos2d/cocos2d-x/commit/378ff345fa69e25a4091c72b7e151e1c3942b1ee

Your Question is one Month old, so maybe they merged it already.

Greetings