cocos2d-x节点(CCEventListenerKeyboard.h)API

来源:互联网 发布:whatsapp数据迁移 编辑:程序博客网 时间:2024/05/22 08:29

本文来自http://blog.csdn.net/runaying ,引用必须注明出处!

cocos2d-x节点(CCEventListenerKeyboard.h)API

温馨提醒:为了大家能更好学习,强烈推荐大家看看本人的这篇博客 Cocos2d-X权威指南笔记

键盘事件监听

///cocos2d/cocos2d-x-3.0alpha0/cocos2dx/event_dispatcher//键盘事件监听#ifndef __cocos2d_libs__CCKeyboardEventListener__#define __cocos2d_libs__CCKeyboardEventListener__#include "CCEventListener.h"#include "CCEventKeyboard.h"NS_CC_BEGINclass Event;class EventListenerKeyboard : public EventListener{public:    static EventListenerKeyboard* create();        /// Overrides    virtual EventListenerKeyboard* clone() override;    virtual bool checkAvaiable() override;        std::function<void(EventKeyboard::KeyCode, Event* event)> onKeyPressed;    std::function<void(EventKeyboard::KeyCode, Event* event)> onKeyReleased;private:    EventListenerKeyboard();    bool init();};NS_CC_END#endif /* defined(__cocos2d_libs__CCKeyboardEventListener__) */


原创粉丝点击