Anybody could share a Keypad or Keybaord sample code?

Anybody could share a Keypad or Keybaord sample code?
0.0 0


Since I find the CCKeyboardEventDelegate.cpp, there should be with Keypad or Keybaord surpport, right? But, when I look in to the function CCEGLView::WindowProc, I start to have doubt of that.

I need keyPress event in win32, Could anybody give me a sample code or some advice. Any reply is greatly appreciated.

Best Regards.


It is not keyboard, it is the key used in android machine, like the home, menu.


When I want get keyboard event, What should I do?
Could you give me some directions?


You should do many things:

  1. Capture the keyboard event.
  2. Dispatch the event to the layer, just like CCTouchDispatcher do.


Hi, guo, I think you can try this



Thank you.

So sad! The code in the thread can’t be downloaded. Maybe I must implement by myself :frowning:

A more question. Can cocos2d-x support iOS gestures? For example, the Swipe, Pinch Open/Pinch Close, Touch and Hold, Shake etc.


Nope, you had to implement the gestures in game logic source.