From 4c9771ba3c7b0368ef5c46359b16225428fa16d9 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 20 Sep 2013 19:19:31 +0800 Subject: [PATCH 1/2] rename some class names to obey cocos2d-x coding style --- .../event_dispatcher/CCAccelerationEvent.cpp | 4 +- .../event_dispatcher/CCAccelerationEvent.h | 6 +- .../CCAccelerationEventListener.cpp | 20 +- .../CCAccelerationEventListener.h | 10 +- cocos2dx/event_dispatcher/CCCustomEvent.cpp | 2 +- cocos2dx/event_dispatcher/CCCustomEvent.h | 4 +- .../CCCustomEventListener.cpp | 16 +- .../event_dispatcher/CCCustomEventListener.h | 14 +- .../event_dispatcher/CCEventDispatcher.cpp | 34 +-- cocos2dx/event_dispatcher/CCEventDispatcher.h | 4 +- cocos2dx/event_dispatcher/CCKeyboardEvent.cpp | 2 +- cocos2dx/event_dispatcher/CCKeyboardEvent.h | 6 +- .../CCKeyboardEventListener.cpp | 18 +- .../CCKeyboardEventListener.h | 12 +- cocos2dx/event_dispatcher/CCTouchEvent.cpp | 2 +- cocos2dx/event_dispatcher/CCTouchEvent.h | 4 +- .../event_dispatcher/CCTouchEventListener.cpp | 20 +- .../event_dispatcher/CCTouchEventListener.h | 10 +- .../CCLayer.cpp | 36 +-- .../layers_scenes_transitions_nodes/CCLayer.h | 20 +- cocos2dx/platform/CCEGLViewProtocol.cpp | 22 +- cocos2dx/platform/CCEGLViewProtocol.h | 2 +- cocos2dx/platform/android/nativeactivity.cpp | 8 +- cocos2dx/platform/ios/CCDevice.mm | 2 +- cocos2dx/platform/linux/CCEGLView.cpp | 248 ++++++++--------- cocos2dx/platform/mac/CCEGLView.mm | 248 ++++++++--------- cocos2dx/platform/win32/CCEGLView.cpp | 250 +++++++++--------- cocos2dx/script_support/CCScriptSupport.h | 12 +- .../CocoStudio/Components/CCInputDelegate.cpp | 8 +- .../CocoStudio/Components/CCInputDelegate.h | 4 +- extensions/GUI/CCScrollView/CCScrollView.cpp | 2 +- .../Classes/Box2DTestBed/Box2dView.cpp | 4 +- .../CocosDenshionTest/CocosDenshionTest.cpp | 2 +- .../Classes/KeyboardTest/KeyboardTest.cpp | 4 +- .../Classes/KeyboardTest/KeyboardTest.h | 4 +- .../TestCpp/Classes/KeypadTest/KeypadTest.cpp | 6 +- .../TestCpp/Classes/KeypadTest/KeypadTest.h | 2 +- .../Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp | 2 +- .../Classes/MutiTouchTest/MutiTouchTest.cpp | 2 +- .../NewEventDispatcherTest.cpp | 20 +- .../NewEventDispatcherTest.h | 2 +- .../PerformanceTouchesTest.cpp | 6 +- .../Classes/TextInputTest/TextInputTest.cpp | 2 +- .../TestCpp/Classes/TouchesTest/Paddle.cpp | 2 +- samples/Cpp/TestCpp/Classes/controller.cpp | 2 +- 45 files changed, 555 insertions(+), 555 deletions(-) diff --git a/cocos2dx/event_dispatcher/CCAccelerationEvent.cpp b/cocos2dx/event_dispatcher/CCAccelerationEvent.cpp index 73d114eb3d..3a2f2e6799 100644 --- a/cocos2dx/event_dispatcher/CCAccelerationEvent.cpp +++ b/cocos2dx/event_dispatcher/CCAccelerationEvent.cpp @@ -26,9 +26,9 @@ NS_CC_BEGIN -const char* AccelerationEvent::EVENT_TYPE = "AccelerometerEvent"; +const char* EventAcceleration::EVENT_TYPE = "AccelerometerEvent"; -AccelerationEvent::AccelerationEvent(Acceleration acc) +EventAcceleration::EventAcceleration(Acceleration acc) : Event(EVENT_TYPE) , _acc(acc) { diff --git a/cocos2dx/event_dispatcher/CCAccelerationEvent.h b/cocos2dx/event_dispatcher/CCAccelerationEvent.h index b72f7ac808..c5dfbe9ef5 100644 --- a/cocos2dx/event_dispatcher/CCAccelerationEvent.h +++ b/cocos2dx/event_dispatcher/CCAccelerationEvent.h @@ -30,16 +30,16 @@ NS_CC_BEGIN -class AccelerationEvent : public Event +class EventAcceleration : public Event { public: static const char* EVENT_TYPE; - AccelerationEvent(Acceleration acc); + EventAcceleration(Acceleration acc); private: Acceleration _acc; - friend class AccelerationEventListener; + friend class EventListenerAcceleration; }; NS_CC_END diff --git a/cocos2dx/event_dispatcher/CCAccelerationEventListener.cpp b/cocos2dx/event_dispatcher/CCAccelerationEventListener.cpp index 7fa8d6d9a5..7aadbc49b1 100644 --- a/cocos2dx/event_dispatcher/CCAccelerationEventListener.cpp +++ b/cocos2dx/event_dispatcher/CCAccelerationEventListener.cpp @@ -27,19 +27,19 @@ NS_CC_BEGIN -AccelerationEventListener::AccelerationEventListener() +EventListenerAcceleration::EventListenerAcceleration() { } -AccelerationEventListener::~AccelerationEventListener() +EventListenerAcceleration::~EventListenerAcceleration() { CCLOGINFO("In the destructor of AccelerationEventListener. %p", this); } -AccelerationEventListener* AccelerationEventListener::create(std::function callback) +EventListenerAcceleration* EventListenerAcceleration::create(std::function callback) { - AccelerationEventListener* ret = new AccelerationEventListener(); + EventListenerAcceleration* ret = new EventListenerAcceleration(); if (ret && ret->init(callback)) { ret->autorelease(); @@ -52,14 +52,14 @@ AccelerationEventListener* AccelerationEventListener::create(std::function callback) +bool EventListenerAcceleration::init(std::function callback) { auto listener = [this](Event* event){ - auto accEvent = static_cast(event); + auto accEvent = static_cast(event); this->onAccelerationEvent(&accEvent->_acc, event); }; - if (EventListener::init(AccelerationEvent::EVENT_TYPE, listener)) + if (EventListener::init(EventAcceleration::EVENT_TYPE, listener)) { onAccelerationEvent = callback; return true; @@ -68,9 +68,9 @@ bool AccelerationEventListener::init(std::functioninit(onAccelerationEvent)) { @@ -84,7 +84,7 @@ AccelerationEventListener* AccelerationEventListener::clone() return ret; } -bool AccelerationEventListener::checkAvaiable() +bool EventListenerAcceleration::checkAvaiable() { CCASSERT(onAccelerationEvent, ""); diff --git a/cocos2dx/event_dispatcher/CCAccelerationEventListener.h b/cocos2dx/event_dispatcher/CCAccelerationEventListener.h index d5a3b85eaf..1fb9536be7 100644 --- a/cocos2dx/event_dispatcher/CCAccelerationEventListener.h +++ b/cocos2dx/event_dispatcher/CCAccelerationEventListener.h @@ -30,17 +30,17 @@ NS_CC_BEGIN -class AccelerationEventListener : public EventListener +class EventListenerAcceleration : public EventListener { public: - static AccelerationEventListener* create(std::function callback); - ~AccelerationEventListener(); + static EventListenerAcceleration* create(std::function callback); + virtual ~EventListenerAcceleration(); /// Overrides - virtual AccelerationEventListener* clone() override; + virtual EventListenerAcceleration* clone() override; virtual bool checkAvaiable() override; private: - AccelerationEventListener(); + EventListenerAcceleration(); bool init(std::function callback); std::function onAccelerationEvent; diff --git a/cocos2dx/event_dispatcher/CCCustomEvent.cpp b/cocos2dx/event_dispatcher/CCCustomEvent.cpp index 460b9b96f6..7aa7f7d869 100644 --- a/cocos2dx/event_dispatcher/CCCustomEvent.cpp +++ b/cocos2dx/event_dispatcher/CCCustomEvent.cpp @@ -26,7 +26,7 @@ NS_CC_BEGIN -CustomEvent::CustomEvent(const std::string& eventName) +EventCustom::EventCustom(const std::string& eventName) : Event(eventName) , _userData(nullptr) { diff --git a/cocos2dx/event_dispatcher/CCCustomEvent.h b/cocos2dx/event_dispatcher/CCCustomEvent.h index f1255bffc8..c4521e3bbf 100644 --- a/cocos2dx/event_dispatcher/CCCustomEvent.h +++ b/cocos2dx/event_dispatcher/CCCustomEvent.h @@ -29,11 +29,11 @@ NS_CC_BEGIN -class CustomEvent : public Event +class EventCustom : public Event { public: /** Constructor */ - CustomEvent(const std::string& eventName); + EventCustom(const std::string& eventName); /** Set user data */ inline void setUserData(void* data) { _userData = data; }; diff --git a/cocos2dx/event_dispatcher/CCCustomEventListener.cpp b/cocos2dx/event_dispatcher/CCCustomEventListener.cpp index d575a71591..c03da00531 100644 --- a/cocos2dx/event_dispatcher/CCCustomEventListener.cpp +++ b/cocos2dx/event_dispatcher/CCCustomEventListener.cpp @@ -27,14 +27,14 @@ NS_CC_BEGIN -CustomEventListener::CustomEventListener() +EventListenerCustom::EventListenerCustom() : _onCustomEvent(nullptr) { } -CustomEventListener* CustomEventListener::create(const std::string& eventName, std::function callback) +EventListenerCustom* EventListenerCustom::create(const std::string& eventName, std::function callback) { - CustomEventListener* ret = new CustomEventListener(); + EventListenerCustom* ret = new EventListenerCustom(); if (ret && ret->init(eventName, callback)) { ret->autorelease(); @@ -46,7 +46,7 @@ CustomEventListener* CustomEventListener::create(const std::string& eventName, s return ret; } -bool CustomEventListener::init(const std::string& eventName, std::functioncallback) +bool EventListenerCustom::init(const std::string& eventName, std::functioncallback) { bool ret = false; @@ -55,7 +55,7 @@ bool CustomEventListener::init(const std::string& eventName, std::function(event)); + _onCustomEvent(static_cast(event)); } }; @@ -66,9 +66,9 @@ bool CustomEventListener::init(const std::string& eventName, std::functioninit(_type, _onCustomEvent)) { ret->autorelease(); @@ -80,7 +80,7 @@ CustomEventListener* CustomEventListener::clone() return ret; } -bool CustomEventListener::checkAvaiable() +bool EventListenerCustom::checkAvaiable() { bool ret = false; if (EventListener::checkAvaiable() && _onCustomEvent != nullptr) diff --git a/cocos2dx/event_dispatcher/CCCustomEventListener.h b/cocos2dx/event_dispatcher/CCCustomEventListener.h index 4e5785ad0e..190ed63f95 100644 --- a/cocos2dx/event_dispatcher/CCCustomEventListener.h +++ b/cocos2dx/event_dispatcher/CCCustomEventListener.h @@ -29,7 +29,7 @@ NS_CC_BEGIN -class CustomEvent; +class EventCustom; /** * Usage: @@ -49,27 +49,27 @@ class CustomEvent; * * dispatcher->removeListener(listener); */ -class CustomEventListener : public EventListener +class EventListenerCustom : public EventListener { public: /** Creates an event listener with type and callback. * @param eventType The type of the event. * @param callback The callback function when the specified event was emitted. */ - static CustomEventListener* create(const std::string& eventName, std::function callback); + static EventListenerCustom* create(const std::string& eventName, std::function callback); /// Overrides virtual bool checkAvaiable() override; - virtual CustomEventListener* clone() override; + virtual EventListenerCustom* clone() override; protected: /** Constructor */ - CustomEventListener(); + EventListenerCustom(); /** Initializes event with type and callback function */ - bool init(const std::string& eventName, std::function callback); + bool init(const std::string& eventName, std::function callback); - std::function _onCustomEvent; + std::function _onCustomEvent; }; NS_CC_END diff --git a/cocos2dx/event_dispatcher/CCEventDispatcher.cpp b/cocos2dx/event_dispatcher/CCEventDispatcher.cpp index 33ba2b7e13..7dafa65ab6 100644 --- a/cocos2dx/event_dispatcher/CCEventDispatcher.cpp +++ b/cocos2dx/event_dispatcher/CCEventDispatcher.cpp @@ -267,9 +267,9 @@ void EventDispatcher::dispatchEvent(Event* event, bool forceSortListeners) DispatchGuard guard(_inDispatch); - if (event->_type == TouchEvent::EVENT_TYPE) + if (event->_type == EventTouch::EVENT_TYPE) { - dispatchTouchEvent(static_cast(event)); + dispatchTouchEvent(static_cast(event)); return; } @@ -292,9 +292,9 @@ void EventDispatcher::dispatchEvent(Event* event, bool forceSortListeners) updateListenerItems(); } -void EventDispatcher::dispatchTouchEvent(TouchEvent* event) +void EventDispatcher::dispatchTouchEvent(EventTouch* event) { - auto touchListeners = getListenerItemsForType(TouchEvent::EVENT_TYPE); + auto touchListeners = getListenerItemsForType(EventTouch::EVENT_TYPE); if (touchListeners == nullptr) return; @@ -304,11 +304,11 @@ void EventDispatcher::dispatchTouchEvent(TouchEvent* event) std::vector allInOnelisteners; allInOnelisteners.reserve(touchListeners->size()); - TouchEventListener* touchEventListener = nullptr; + EventListenerTouch* touchEventListener = nullptr; std::for_each(touchListeners->begin(), touchListeners->end(), [&](EventListenerItem*& item){ - touchEventListener = static_cast(item->listener); + touchEventListener = static_cast(item->listener); if (touchEventListener->_dispatchMode == Touch::DispatchMode::ONE_BY_ONE) { @@ -353,10 +353,10 @@ void EventDispatcher::dispatchTouchEvent(TouchEvent* event) bool isClaimed = false; std::vector::iterator removedIter; - auto touchEventListener = static_cast(item->listener); - TouchEvent::EventCode eventCode = event->getEventCode(); + auto touchEventListenerTouch = static_cast(item->listener); + EventTouch::EventCode eventCode = event->getEventCode(); - if (eventCode == TouchEvent::EventCode::BEGAN) + if (eventCode == EventTouch::EventCode::BEGAN) { if (touchEventListener->onTouchBegan) { @@ -374,13 +374,13 @@ void EventDispatcher::dispatchTouchEvent(TouchEvent* event) switch (eventCode) { - case TouchEvent::EventCode::MOVED: + case EventTouch::EventCode::MOVED: if (touchEventListener->onTouchMoved) { touchEventListener->onTouchMoved(*touchesIter, event); } break; - case TouchEvent::EventCode::ENDED: + case EventTouch::EventCode::ENDED: if (touchEventListener->onTouchEnded) { touchEventListener->onTouchEnded(*touchesIter, event); @@ -390,7 +390,7 @@ void EventDispatcher::dispatchTouchEvent(TouchEvent* event) touchEventListener->_claimedTouches.erase(removedIter); } break; - case TouchEvent::EventCode::CANCELLED: + case EventTouch::EventCode::CANCELLED: if (touchEventListener->onTouchCancelled) { touchEventListener->onTouchCancelled(*touchesIter, event); @@ -444,29 +444,29 @@ void EventDispatcher::dispatchTouchEvent(TouchEvent* event) event->setCurrentTarget(item->node); - auto touchEventListener = static_cast(item->listener); + auto touchEventListener = static_cast(item->listener); switch (event->getEventCode()) { - case TouchEvent::EventCode::BEGAN: + case EventTouch::EventCode::BEGAN: if (touchEventListener->onTouchesBegan) { touchEventListener->onTouchesBegan(mutableTouches, event); } break; - case TouchEvent::EventCode::MOVED: + case EventTouch::EventCode::MOVED: if (touchEventListener->onTouchesMoved) { touchEventListener->onTouchesMoved(mutableTouches, event); } break; - case TouchEvent::EventCode::ENDED: + case EventTouch::EventCode::ENDED: if (touchEventListener->onTouchesEnded) { touchEventListener->onTouchesEnded(mutableTouches, event); } break; - case TouchEvent::EventCode::CANCELLED: + case EventTouch::EventCode::CANCELLED: if (touchEventListener->onTouchesCancelled) { touchEventListener->onTouchesCancelled(mutableTouches, event); diff --git a/cocos2dx/event_dispatcher/CCEventDispatcher.h b/cocos2dx/event_dispatcher/CCEventDispatcher.h index b5648b0629..bc56273391 100644 --- a/cocos2dx/event_dispatcher/CCEventDispatcher.h +++ b/cocos2dx/event_dispatcher/CCEventDispatcher.h @@ -37,7 +37,7 @@ NS_CC_BEGIN class Event; -class TouchEvent; +class EventTouch; class Node; /** @@ -124,7 +124,7 @@ private: void addEventListenerWithItem(EventListenerItem* item); /** Touch event needs to be processed different with other events since it needs support ALL_AT_ONCE and ONE_BY_NONE mode. */ - void dispatchTouchEvent(TouchEvent* event); + void dispatchTouchEvent(EventTouch* event); /** Gets event the listener list for the event type. */ std::vector* getListenerItemsForType(const std::string& eventType); diff --git a/cocos2dx/event_dispatcher/CCKeyboardEvent.cpp b/cocos2dx/event_dispatcher/CCKeyboardEvent.cpp index 64c051221a..2c5a3a1e6e 100644 --- a/cocos2dx/event_dispatcher/CCKeyboardEvent.cpp +++ b/cocos2dx/event_dispatcher/CCKeyboardEvent.cpp @@ -27,6 +27,6 @@ NS_CC_BEGIN -const char* KeyboardEvent::EVENT_TYPE = "KeyboardEvent"; +const char* EventKeyboard::EVENT_TYPE = "KeyboardEvent"; NS_CC_END diff --git a/cocos2dx/event_dispatcher/CCKeyboardEvent.h b/cocos2dx/event_dispatcher/CCKeyboardEvent.h index f7407fbbf8..fffc76e0ac 100644 --- a/cocos2dx/event_dispatcher/CCKeyboardEvent.h +++ b/cocos2dx/event_dispatcher/CCKeyboardEvent.h @@ -30,7 +30,7 @@ NS_CC_BEGIN -class KeyboardEvent : public Event +class EventKeyboard : public Event { public: /** @@ -198,7 +198,7 @@ public: static const char* EVENT_TYPE; - KeyboardEvent(KeyCode keyCode, bool isPressed) + EventKeyboard(KeyCode keyCode, bool isPressed) : Event(EVENT_TYPE) , _keyCode(keyCode) , _isPressed(isPressed) @@ -208,7 +208,7 @@ private: KeyCode _keyCode; bool _isPressed; - friend class KeyboardEventListener; + friend class EventListenerKeyboard; }; NS_CC_END diff --git a/cocos2dx/event_dispatcher/CCKeyboardEventListener.cpp b/cocos2dx/event_dispatcher/CCKeyboardEventListener.cpp index 4d997d0287..3471d3c23b 100644 --- a/cocos2dx/event_dispatcher/CCKeyboardEventListener.cpp +++ b/cocos2dx/event_dispatcher/CCKeyboardEventListener.cpp @@ -29,16 +29,16 @@ NS_CC_BEGIN -bool KeyboardEventListener::checkAvaiable() +bool EventListenerKeyboard::checkAvaiable() { CCASSERT(onKeyPressed && onKeyReleased, ""); return true; } -KeyboardEventListener* KeyboardEventListener::create() +EventListenerKeyboard* EventListenerKeyboard::create() { - auto ret = new KeyboardEventListener(); + auto ret = new EventListenerKeyboard(); if (ret && ret->init()) { ret->autorelease(); @@ -50,9 +50,9 @@ KeyboardEventListener* KeyboardEventListener::create() return ret; } -KeyboardEventListener* KeyboardEventListener::clone() +EventListenerKeyboard* EventListenerKeyboard::clone() { - auto ret = new KeyboardEventListener(); + auto ret = new EventListenerKeyboard(); if (ret && ret->init()) { ret->autorelease(); @@ -66,16 +66,16 @@ KeyboardEventListener* KeyboardEventListener::clone() return ret; } -KeyboardEventListener::KeyboardEventListener() +EventListenerKeyboard::EventListenerKeyboard() : onKeyPressed(nullptr) , onKeyReleased(nullptr) { } -bool KeyboardEventListener::init() +bool EventListenerKeyboard::init() { auto listener = [this](Event* event){ - auto keyboardEvent = static_cast(event); + auto keyboardEvent = static_cast(event); if (keyboardEvent->_isPressed) { if (onKeyPressed != nullptr) @@ -88,7 +88,7 @@ bool KeyboardEventListener::init() } }; - if (EventListener::init(KeyboardEvent::EVENT_TYPE, listener)) + if (EventListener::init(EventKeyboard::EVENT_TYPE, listener)) { return true; } diff --git a/cocos2dx/event_dispatcher/CCKeyboardEventListener.h b/cocos2dx/event_dispatcher/CCKeyboardEventListener.h index 18feb6a908..7896234aae 100644 --- a/cocos2dx/event_dispatcher/CCKeyboardEventListener.h +++ b/cocos2dx/event_dispatcher/CCKeyboardEventListener.h @@ -33,19 +33,19 @@ NS_CC_BEGIN class Event; -class KeyboardEventListener : public EventListener +class EventListenerKeyboard : public EventListener { public: - static KeyboardEventListener* create(); + static EventListenerKeyboard* create(); /// Overrides - virtual KeyboardEventListener* clone() override; + virtual EventListenerKeyboard* clone() override; virtual bool checkAvaiable() override; - std::function onKeyPressed; - std::function onKeyReleased; + std::function onKeyPressed; + std::function onKeyReleased; private: - KeyboardEventListener(); + EventListenerKeyboard(); bool init(); }; diff --git a/cocos2dx/event_dispatcher/CCTouchEvent.cpp b/cocos2dx/event_dispatcher/CCTouchEvent.cpp index f034fe36d4..2f137fad94 100644 --- a/cocos2dx/event_dispatcher/CCTouchEvent.cpp +++ b/cocos2dx/event_dispatcher/CCTouchEvent.cpp @@ -26,6 +26,6 @@ NS_CC_BEGIN -const char* TouchEvent::EVENT_TYPE = "TouchEvent"; +const char* EventTouch::EVENT_TYPE = "TouchEvent"; NS_CC_END diff --git a/cocos2dx/event_dispatcher/CCTouchEvent.h b/cocos2dx/event_dispatcher/CCTouchEvent.h index f0fe5fdf4d..a005073173 100644 --- a/cocos2dx/event_dispatcher/CCTouchEvent.h +++ b/cocos2dx/event_dispatcher/CCTouchEvent.h @@ -33,7 +33,7 @@ NS_CC_BEGIN #define TOUCH_PERF_DEBUG 1 -class TouchEvent : public Event +class EventTouch : public Event { public: static const char* EVENT_TYPE; @@ -47,7 +47,7 @@ public: CANCELLED }; - TouchEvent() + EventTouch() : Event(EVENT_TYPE) { _touches.reserve(MAX_TOUCHES); diff --git a/cocos2dx/event_dispatcher/CCTouchEventListener.cpp b/cocos2dx/event_dispatcher/CCTouchEventListener.cpp index c7d21b0f6e..9037bdc008 100644 --- a/cocos2dx/event_dispatcher/CCTouchEventListener.cpp +++ b/cocos2dx/event_dispatcher/CCTouchEventListener.cpp @@ -30,7 +30,7 @@ NS_CC_BEGIN -TouchEventListener::TouchEventListener() +EventListenerTouch::EventListenerTouch() : onTouchBegan(nullptr) , onTouchMoved(nullptr) , onTouchEnded(nullptr) @@ -44,14 +44,14 @@ TouchEventListener::TouchEventListener() { } -TouchEventListener::~TouchEventListener() +EventListenerTouch::~EventListenerTouch() { CCLOGINFO("In the destructor of TouchEventListener, %p", this); } -bool TouchEventListener::init(Touch::DispatchMode mode) +bool EventListenerTouch::init(Touch::DispatchMode mode) { - if (EventListener::init(TouchEvent::EVENT_TYPE, nullptr)) + if (EventListener::init(EventTouch::EVENT_TYPE, nullptr)) { _dispatchMode = mode; return true; @@ -60,15 +60,15 @@ bool TouchEventListener::init(Touch::DispatchMode mode) return false; } -void TouchEventListener::setSwallowTouches(bool needSwallow) +void EventListenerTouch::setSwallowTouches(bool needSwallow) { CCASSERT(_dispatchMode == Touch::DispatchMode::ONE_BY_ONE, "Swallow touches only available in OneByOne mode."); _needSwallow = needSwallow; } -TouchEventListener* TouchEventListener::create(Touch::DispatchMode mode) +EventListenerTouch* EventListenerTouch::create(Touch::DispatchMode mode) { - auto ret = new TouchEventListener(); + auto ret = new EventListenerTouch(); if (ret && ret->init(mode)) { ret->autorelease(); @@ -80,7 +80,7 @@ TouchEventListener* TouchEventListener::create(Touch::DispatchMode mode) return ret; } -bool TouchEventListener::checkAvaiable() +bool EventListenerTouch::checkAvaiable() { if (_dispatchMode == Touch::DispatchMode::ALL_AT_ONCE) { @@ -108,9 +108,9 @@ bool TouchEventListener::checkAvaiable() return true; } -TouchEventListener* TouchEventListener::clone() +EventListenerTouch* EventListenerTouch::clone() { - auto ret = new TouchEventListener(); + auto ret = new EventListenerTouch(); if (ret && ret->init(_dispatchMode)) { ret->autorelease(); diff --git a/cocos2dx/event_dispatcher/CCTouchEventListener.h b/cocos2dx/event_dispatcher/CCTouchEventListener.h index 87bdded343..62cd4c3e6d 100644 --- a/cocos2dx/event_dispatcher/CCTouchEventListener.h +++ b/cocos2dx/event_dispatcher/CCTouchEventListener.h @@ -33,19 +33,19 @@ NS_CC_BEGIN -class TouchEventListener : public EventListener +class EventListenerTouch : public EventListener { public: - static TouchEventListener* create(Touch::DispatchMode mode); + static EventListenerTouch* create(Touch::DispatchMode mode); /// Overrides - virtual TouchEventListener* clone() override; + virtual EventListenerTouch* clone() override; virtual bool checkAvaiable() override; - virtual ~TouchEventListener(); + virtual ~EventListenerTouch(); private: - TouchEventListener(); + EventListenerTouch(); bool init(Touch::DispatchMode mode); public: diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp index 9e4fa9d1de..362438c2b1 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.cpp @@ -109,7 +109,7 @@ void Layer::addTouchListener() if( _touchMode == Touch::DispatchMode::ALL_AT_ONCE ) { // Register Touch Event - auto listener = TouchEventListener::create(Touch::DispatchMode::ALL_AT_ONCE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ALL_AT_ONCE); listener->onTouchesBegan = CC_CALLBACK_2(Layer::onTouchesBegan, this); listener->onTouchesMoved = CC_CALLBACK_2(Layer::onTouchesMoved, this); @@ -122,7 +122,7 @@ void Layer::addTouchListener() else { // Register Touch Event - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->setSwallowTouches(_swallowsTouches); listener->onTouchBegan = CC_CALLBACK_2(Layer::onTouchBegan, this); @@ -135,7 +135,7 @@ void Layer::addTouchListener() } } -int Layer::executeScriptTouchHandler(TouchEvent::EventCode eventType, Touch* touch) +int Layer::executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch) { if (kScriptTypeNone != _scriptType) { @@ -148,7 +148,7 @@ int Layer::executeScriptTouchHandler(TouchEvent::EventCode eventType, Touch* tou return 0; } -int Layer::executeScriptTouchesHandler(TouchEvent::EventCode eventType, const std::vector& touches) +int Layer::executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector& touches) { if (kScriptTypeNone != _scriptType) { @@ -249,7 +249,7 @@ void Layer::setAccelerometerEnabled(bool enabled) if (enabled) { - _accelerationListener = AccelerationEventListener::create(CC_CALLBACK_2(Layer::onAcceleration, this)); + _accelerationListener = EventListenerAcceleration::create(CC_CALLBACK_2(Layer::onAcceleration, this)); dispatcher->addEventListenerWithSceneGraphPriority(_accelerationListener, this); } } @@ -280,13 +280,13 @@ void Layer::onAcceleration(Acceleration* pAccelerationValue, Event* event) } } -void Layer::onKeyPressed(KeyboardEvent::KeyCode keyCode, Event* event) +void Layer::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event) { CC_UNUSED_PARAM(keyCode); CC_UNUSED_PARAM(event); } -void Layer::onKeyReleased(KeyboardEvent::KeyCode keyCode, Event* event) +void Layer::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event) { CC_UNUSED_PARAM(event); if(kScriptTypeNone != _scriptType) @@ -315,7 +315,7 @@ void Layer::setKeyboardEnabled(bool enabled) if (enabled) { - auto listener = KeyboardEventListener::create(); + auto listener = EventListenerKeyboard::create(); listener->onKeyPressed = CC_CALLBACK_2(Layer::onKeyPressed, this); listener->onKeyReleased = CC_CALLBACK_2(Layer::onKeyReleased, this); @@ -343,7 +343,7 @@ void Layer::onEnter() { auto dispatcher = EventDispatcher::getInstance(); dispatcher->removeEventListener(_accelerationListener); - _accelerationListener = AccelerationEventListener::create(CC_CALLBACK_2(Layer::onAcceleration, this)); + _accelerationListener = EventListenerAcceleration::create(CC_CALLBACK_2(Layer::onAcceleration, this)); dispatcher->addEventListenerWithSceneGraphPriority(_accelerationListener, this); } } @@ -372,7 +372,7 @@ void Layer::onEnterTransitionDidFinish() { auto dispatcher = EventDispatcher::getInstance(); dispatcher->removeEventListener(_accelerationListener); - _accelerationListener = AccelerationEventListener::create(CC_CALLBACK_2(Layer::onAcceleration, this)); + _accelerationListener = EventListenerAcceleration::create(CC_CALLBACK_2(Layer::onAcceleration, this)); dispatcher->addEventListenerWithSceneGraphPriority(_accelerationListener, this); } @@ -383,7 +383,7 @@ bool Layer::onTouchBegan(Touch *pTouch, Event *pEvent) { if (kScriptTypeNone != _scriptType) { - return executeScriptTouchHandler(TouchEvent::EventCode::BEGAN, pTouch) == 0 ? false : true; + return executeScriptTouchHandler(EventTouch::EventCode::BEGAN, pTouch) == 0 ? false : true; } CC_UNUSED_PARAM(pTouch); @@ -396,7 +396,7 @@ void Layer::onTouchMoved(Touch *pTouch, Event *pEvent) { if (kScriptTypeNone != _scriptType) { - executeScriptTouchHandler(TouchEvent::EventCode::MOVED, pTouch); + executeScriptTouchHandler(EventTouch::EventCode::MOVED, pTouch); return; } @@ -408,7 +408,7 @@ void Layer::onTouchEnded(Touch *pTouch, Event *pEvent) { if (kScriptTypeNone != _scriptType) { - executeScriptTouchHandler(TouchEvent::EventCode::ENDED, pTouch); + executeScriptTouchHandler(EventTouch::EventCode::ENDED, pTouch); return; } @@ -420,7 +420,7 @@ void Layer::onTouchCancelled(Touch *pTouch, Event *pEvent) { if (kScriptTypeNone != _scriptType) { - executeScriptTouchHandler(TouchEvent::EventCode::CANCELLED, pTouch); + executeScriptTouchHandler(EventTouch::EventCode::CANCELLED, pTouch); return; } @@ -432,7 +432,7 @@ void Layer::onTouchesBegan(const std::vector& pTouches, Event *pEvent) { if (kScriptTypeNone != _scriptType) { - executeScriptTouchesHandler(TouchEvent::EventCode::BEGAN, pTouches); + executeScriptTouchesHandler(EventTouch::EventCode::BEGAN, pTouches); return; } @@ -444,7 +444,7 @@ void Layer::onTouchesMoved(const std::vector& pTouches, Event *pEvent) { if (kScriptTypeNone != _scriptType) { - executeScriptTouchesHandler(TouchEvent::EventCode::MOVED, pTouches); + executeScriptTouchesHandler(EventTouch::EventCode::MOVED, pTouches); return; } @@ -456,7 +456,7 @@ void Layer::onTouchesEnded(const std::vector& pTouches, Event *pEvent) { if (kScriptTypeNone != _scriptType) { - executeScriptTouchesHandler(TouchEvent::EventCode::ENDED, pTouches); + executeScriptTouchesHandler(EventTouch::EventCode::ENDED, pTouches); return; } @@ -468,7 +468,7 @@ void Layer::onTouchesCancelled(const std::vector& pTouches, Event *pEven { if (kScriptTypeNone != _scriptType) { - executeScriptTouchesHandler(TouchEvent::EventCode::CANCELLED, pTouches); + executeScriptTouchesHandler(EventTouch::EventCode::CANCELLED, pTouches); return; } diff --git a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h index 5b148c5d32..77ba10c4cd 100644 --- a/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h +++ b/cocos2dx/layers_scenes_transitions_nodes/CCLayer.h @@ -46,9 +46,9 @@ NS_CC_BEGIN class TouchScriptHandlerEntry; -class TouchEventListener; -class KeyboardEventListener; -class AccelerationEventListener; +class EventListenerTouch; +class EventListenerKeyboard; +class EventListenerAcceleration; // // Layer @@ -152,8 +152,8 @@ public: /** Please use onKeyReleased instead. */ virtual void keyReleased(int keyCode) final {}; - virtual void onKeyPressed(KeyboardEvent::KeyCode keyCode, Event* event); - virtual void onKeyReleased(KeyboardEvent::KeyCode keyCode, Event* event); + virtual void onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event); + virtual void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event); CC_DEPRECATED_ATTRIBUTE virtual bool isKeypadEnabled() const final { return isKeyboardEnabled(); }; CC_DEPRECATED_ATTRIBUTE virtual void setKeypadEnabled(bool value) { setKeyboardEnabled(value); }; @@ -192,15 +192,15 @@ protected: bool _touchEnabled; bool _accelerometerEnabled; bool _keyboardEnabled; - TouchEventListener* _touchListener; - KeyboardEventListener* _keyboardListener; - AccelerationEventListener* _accelerationListener; + EventListenerTouch* _touchListener; + EventListenerKeyboard* _keyboardListener; + EventListenerAcceleration* _accelerationListener; private: Touch::DispatchMode _touchMode; bool _swallowsTouches; - int executeScriptTouchHandler(TouchEvent::EventCode eventType, Touch* touch); - int executeScriptTouchesHandler(TouchEvent::EventCode eventType, const std::vector& touches); + int executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch); + int executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector& touches); }; #ifdef __apple__ diff --git a/cocos2dx/platform/CCEGLViewProtocol.cpp b/cocos2dx/platform/CCEGLViewProtocol.cpp index 597c41c2a3..870146a2f9 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.cpp +++ b/cocos2dx/platform/CCEGLViewProtocol.cpp @@ -9,7 +9,7 @@ NS_CC_BEGIN namespace { - static Touch* g_touches[TouchEvent::MAX_TOUCHES] = { NULL }; + static Touch* g_touches[EventTouch::MAX_TOUCHES] = { NULL }; static unsigned int g_indexBitsUsed = 0; // System touch pointer ID (It may not be ascending order number) <-> Ascending order number from 0 static std::map g_touchIdReorderMap; @@ -19,7 +19,7 @@ namespace { int i; int temp = g_indexBitsUsed; - for (i = 0; i < TouchEvent::MAX_TOUCHES; i++) { + for (i = 0; i < EventTouch::MAX_TOUCHES; i++) { if (! (temp & 0x00000001)) { g_indexBitsUsed |= (1 << i); return i; @@ -34,7 +34,7 @@ namespace { static void removeUsedIndexBit(int index) { - if (index < 0 || index >= TouchEvent::MAX_TOUCHES) + if (index < 0 || index >= EventTouch::MAX_TOUCHES) { return; } @@ -207,7 +207,7 @@ void EGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float y float x = 0.0f; float y = 0.0f; int nUnusedIndex = 0; - TouchEvent touchEvent; + EventTouch touchEvent; for (int i = 0; i < num; ++i) { @@ -246,7 +246,7 @@ void EGLViewProtocol::handleTouchesBegin(int num, int ids[], float xs[], float y return; } - touchEvent._eventCode = TouchEvent::EventCode::BEGAN; + touchEvent._eventCode = EventTouch::EventCode::BEGAN; EventDispatcher::getInstance()->dispatchEvent(&touchEvent); } @@ -255,7 +255,7 @@ void EGLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float ys int id = 0; float x = 0.0f; float y = 0.0f; - TouchEvent touchEvent; + EventTouch touchEvent; for (int i = 0; i < num; ++i) { @@ -293,16 +293,16 @@ void EGLViewProtocol::handleTouchesMove(int num, int ids[], float xs[], float ys return; } - touchEvent._eventCode = TouchEvent::EventCode::MOVED; + touchEvent._eventCode = EventTouch::EventCode::MOVED; EventDispatcher::getInstance()->dispatchEvent(&touchEvent); } -void EGLViewProtocol::handleTouchesOfEndOrCancel(TouchEvent::EventCode eventCode, int num, int ids[], float xs[], float ys[]) +void EGLViewProtocol::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, int ids[], float xs[], float ys[]) { int id = 0; float x = 0.0f; float y = 0.0f; - TouchEvent touchEvent; + EventTouch touchEvent; for (int i = 0; i < num; ++i) { @@ -358,12 +358,12 @@ void EGLViewProtocol::handleTouchesOfEndOrCancel(TouchEvent::EventCode eventCode void EGLViewProtocol::handleTouchesEnd(int num, int ids[], float xs[], float ys[]) { - handleTouchesOfEndOrCancel(TouchEvent::EventCode::ENDED, num, ids, xs, ys); + handleTouchesOfEndOrCancel(EventTouch::EventCode::ENDED, num, ids, xs, ys); } void EGLViewProtocol::handleTouchesCancel(int num, int ids[], float xs[], float ys[]) { - handleTouchesOfEndOrCancel(TouchEvent::EventCode::CANCELLED, num, ids, xs, ys); + handleTouchesOfEndOrCancel(EventTouch::EventCode::CANCELLED, num, ids, xs, ys); } const Rect& EGLViewProtocol::getViewPortRect() const diff --git a/cocos2dx/platform/CCEGLViewProtocol.h b/cocos2dx/platform/CCEGLViewProtocol.h index 42edc99213..f9bf971e64 100644 --- a/cocos2dx/platform/CCEGLViewProtocol.h +++ b/cocos2dx/platform/CCEGLViewProtocol.h @@ -156,7 +156,7 @@ public: */ float getScaleY() const; private: - void handleTouchesOfEndOrCancel(TouchEvent::EventCode eventCode, int num, int ids[], float xs[], float ys[]); + void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, int ids[], float xs[], float ys[]); protected: EGLTouchDelegate* _delegate; diff --git a/cocos2dx/platform/android/nativeactivity.cpp b/cocos2dx/platform/android/nativeactivity.cpp index 473cf445e3..e8da06172a 100644 --- a/cocos2dx/platform/android/nativeactivity.cpp +++ b/cocos2dx/platform/android/nativeactivity.cpp @@ -400,13 +400,13 @@ static int32_t handle_key_input(AInputEvent *event) { case AKEYCODE_BACK: { - cocos2d::KeyboardEvent event(cocos2d::KeyboardEvent::KeyCode::KEY_BACKSPACE, false); + cocos2d::EventKeyboard event(cocos2d::EventKeyboard::KeyCode::KEY_BACKSPACE, false); cocos2d::EventDispatcher::getInstance()->dispatchEvent(&event); } return 1; case AKEYCODE_MENU: { - cocos2d::KeyboardEvent event(cocos2d::KeyboardEvent::KeyCode::KEY_MENU, false); + cocos2d::EventKeyboard event(cocos2d::EventKeyboard::KeyCode::KEY_MENU, false); cocos2d::EventDispatcher::getInstance()->dispatchEvent(&event); } return 1; @@ -602,7 +602,7 @@ void android_main(struct android_app* state) { acc.y = -event.acceleration.y/10; acc.z = event.acceleration.z/10; acc.timestamp = 0; - cocos2d::AccelerationEvent accEvent(acc); + cocos2d::EventAcceleration accEvent(acc); cocos2d::EventDispatcher::getInstance()->dispatchEvent(&accEvent); } else { @@ -613,7 +613,7 @@ void android_main(struct android_app* state) { acc.y = -event.acceleration.x/10; acc.z = event.acceleration.z/10; acc.timestamp = 0; - cocos2d::AccelerationEvent accEvent(acc); + cocos2d::EventAcceleration accEvent(acc); cocos2d::EventDispatcher::getInstance()->dispatchEvent(&accEvent); } diff --git a/cocos2dx/platform/ios/CCDevice.mm b/cocos2dx/platform/ios/CCDevice.mm index 3191af79ec..8afedfa8f0 100644 --- a/cocos2dx/platform/ios/CCDevice.mm +++ b/cocos2dx/platform/ios/CCDevice.mm @@ -95,7 +95,7 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher; break; } - cocos2d::AccelerationEvent event(*_acceleration); + cocos2d::EventAcceleration event(*_acceleration); cocos2d::EventDispatcher::getInstance()->dispatchEvent(&event); } diff --git a/cocos2dx/platform/linux/CCEGLView.cpp b/cocos2dx/platform/linux/CCEGLView.cpp index d557e24854..74152a053a 100644 --- a/cocos2dx/platform/linux/CCEGLView.cpp +++ b/cocos2dx/platform/linux/CCEGLView.cpp @@ -18,134 +18,134 @@ NS_CC_BEGIN -static std::map g_keyCodeMap = { +static std::map g_keyCodeMap = { /* The unknown key */ - { GLFW_KEY_UNKNOWN , KeyboardEvent::KeyCode::KEY_NONE }, + { GLFW_KEY_UNKNOWN , EventKeyboard::KeyCode::KEY_NONE }, /* Printable keys */ - { GLFW_KEY_SPACE , KeyboardEvent::KeyCode::KEY_SPACE }, - { GLFW_KEY_APOSTROPHE , KeyboardEvent::KeyCode::KEY_APOSTROPHE }, - { GLFW_KEY_COMMA , KeyboardEvent::KeyCode::KEY_COMMA }, - { GLFW_KEY_MINUS , KeyboardEvent::KeyCode::KEY_MINUS }, - { GLFW_KEY_PERIOD , KeyboardEvent::KeyCode::KEY_PERIOD }, - { GLFW_KEY_SLASH , KeyboardEvent::KeyCode::KEY_SLASH }, - { GLFW_KEY_0 , KeyboardEvent::KeyCode::KEY_0 }, - { GLFW_KEY_1 , KeyboardEvent::KeyCode::KEY_1 }, - { GLFW_KEY_2 , KeyboardEvent::KeyCode::KEY_2 }, - { GLFW_KEY_3 , KeyboardEvent::KeyCode::KEY_3 }, - { GLFW_KEY_4 , KeyboardEvent::KeyCode::KEY_4 }, - { GLFW_KEY_5 , KeyboardEvent::KeyCode::KEY_5 }, - { GLFW_KEY_6 , KeyboardEvent::KeyCode::KEY_6 }, - { GLFW_KEY_7 , KeyboardEvent::KeyCode::KEY_7 }, - { GLFW_KEY_8 , KeyboardEvent::KeyCode::KEY_8 }, - { GLFW_KEY_9 , KeyboardEvent::KeyCode::KEY_9 }, - { GLFW_KEY_SEMICOLON , KeyboardEvent::KeyCode::KEY_SEMICOLON }, - { GLFW_KEY_EQUAL , KeyboardEvent::KeyCode::KEY_EQUAL }, - { GLFW_KEY_A , KeyboardEvent::KeyCode::KEY_A }, - { GLFW_KEY_B , KeyboardEvent::KeyCode::KEY_B }, - { GLFW_KEY_C , KeyboardEvent::KeyCode::KEY_C }, - { GLFW_KEY_D , KeyboardEvent::KeyCode::KEY_D }, - { GLFW_KEY_E , KeyboardEvent::KeyCode::KEY_E }, - { GLFW_KEY_F , KeyboardEvent::KeyCode::KEY_F }, - { GLFW_KEY_G , KeyboardEvent::KeyCode::KEY_G }, - { GLFW_KEY_H , KeyboardEvent::KeyCode::KEY_H }, - { GLFW_KEY_I , KeyboardEvent::KeyCode::KEY_I }, - { GLFW_KEY_J , KeyboardEvent::KeyCode::KEY_J }, - { GLFW_KEY_K , KeyboardEvent::KeyCode::KEY_K }, - { GLFW_KEY_L , KeyboardEvent::KeyCode::KEY_L }, - { GLFW_KEY_M , KeyboardEvent::KeyCode::KEY_M }, - { GLFW_KEY_N , KeyboardEvent::KeyCode::KEY_N }, - { GLFW_KEY_O , KeyboardEvent::KeyCode::KEY_O }, - { GLFW_KEY_P , KeyboardEvent::KeyCode::KEY_P }, - { GLFW_KEY_Q , KeyboardEvent::KeyCode::KEY_Q }, - { GLFW_KEY_R , KeyboardEvent::KeyCode::KEY_R }, - { GLFW_KEY_S , KeyboardEvent::KeyCode::KEY_S }, - { GLFW_KEY_T , KeyboardEvent::KeyCode::KEY_T }, - { GLFW_KEY_U , KeyboardEvent::KeyCode::KEY_U }, - { GLFW_KEY_V , KeyboardEvent::KeyCode::KEY_V }, - { GLFW_KEY_W , KeyboardEvent::KeyCode::KEY_W }, - { GLFW_KEY_X , KeyboardEvent::KeyCode::KEY_X }, - { GLFW_KEY_Y , KeyboardEvent::KeyCode::KEY_Y }, - { GLFW_KEY_Z , KeyboardEvent::KeyCode::KEY_Z }, - { GLFW_KEY_LEFT_BRACKET , KeyboardEvent::KeyCode::KEY_LEFT_BRACKET }, - { GLFW_KEY_BACKSLASH , KeyboardEvent::KeyCode::KEY_BACK_SLASH }, - { GLFW_KEY_RIGHT_BRACKET , KeyboardEvent::KeyCode::KEY_RIGHT_BRACKET }, - { GLFW_KEY_GRAVE_ACCENT , KeyboardEvent::KeyCode::KEY_GRAVE }, - { GLFW_KEY_WORLD_1 , KeyboardEvent::KeyCode::KEY_GRAVE }, - { GLFW_KEY_WORLD_2 , KeyboardEvent::KeyCode::KEY_NONE }, + { GLFW_KEY_SPACE , EventKeyboard::KeyCode::KEY_SPACE }, + { GLFW_KEY_APOSTROPHE , EventKeyboard::KeyCode::KEY_APOSTROPHE }, + { GLFW_KEY_COMMA , EventKeyboard::KeyCode::KEY_COMMA }, + { GLFW_KEY_MINUS , EventKeyboard::KeyCode::KEY_MINUS }, + { GLFW_KEY_PERIOD , EventKeyboard::KeyCode::KEY_PERIOD }, + { GLFW_KEY_SLASH , EventKeyboard::KeyCode::KEY_SLASH }, + { GLFW_KEY_0 , EventKeyboard::KeyCode::KEY_0 }, + { GLFW_KEY_1 , EventKeyboard::KeyCode::KEY_1 }, + { GLFW_KEY_2 , EventKeyboard::KeyCode::KEY_2 }, + { GLFW_KEY_3 , EventKeyboard::KeyCode::KEY_3 }, + { GLFW_KEY_4 , EventKeyboard::KeyCode::KEY_4 }, + { GLFW_KEY_5 , EventKeyboard::KeyCode::KEY_5 }, + { GLFW_KEY_6 , EventKeyboard::KeyCode::KEY_6 }, + { GLFW_KEY_7 , EventKeyboard::KeyCode::KEY_7 }, + { GLFW_KEY_8 , EventKeyboard::KeyCode::KEY_8 }, + { GLFW_KEY_9 , EventKeyboard::KeyCode::KEY_9 }, + { GLFW_KEY_SEMICOLON , EventKeyboard::KeyCode::KEY_SEMICOLON }, + { GLFW_KEY_EQUAL , EventKeyboard::KeyCode::KEY_EQUAL }, + { GLFW_KEY_A , EventKeyboard::KeyCode::KEY_A }, + { GLFW_KEY_B , EventKeyboard::KeyCode::KEY_B }, + { GLFW_KEY_C , EventKeyboard::KeyCode::KEY_C }, + { GLFW_KEY_D , EventKeyboard::KeyCode::KEY_D }, + { GLFW_KEY_E , EventKeyboard::KeyCode::KEY_E }, + { GLFW_KEY_F , EventKeyboard::KeyCode::KEY_F }, + { GLFW_KEY_G , EventKeyboard::KeyCode::KEY_G }, + { GLFW_KEY_H , EventKeyboard::KeyCode::KEY_H }, + { GLFW_KEY_I , EventKeyboard::KeyCode::KEY_I }, + { GLFW_KEY_J , EventKeyboard::KeyCode::KEY_J }, + { GLFW_KEY_K , EventKeyboard::KeyCode::KEY_K }, + { GLFW_KEY_L , EventKeyboard::KeyCode::KEY_L }, + { GLFW_KEY_M , EventKeyboard::KeyCode::KEY_M }, + { GLFW_KEY_N , EventKeyboard::KeyCode::KEY_N }, + { GLFW_KEY_O , EventKeyboard::KeyCode::KEY_O }, + { GLFW_KEY_P , EventKeyboard::KeyCode::KEY_P }, + { GLFW_KEY_Q , EventKeyboard::KeyCode::KEY_Q }, + { GLFW_KEY_R , EventKeyboard::KeyCode::KEY_R }, + { GLFW_KEY_S , EventKeyboard::KeyCode::KEY_S }, + { GLFW_KEY_T , EventKeyboard::KeyCode::KEY_T }, + { GLFW_KEY_U , EventKeyboard::KeyCode::KEY_U }, + { GLFW_KEY_V , EventKeyboard::KeyCode::KEY_V }, + { GLFW_KEY_W , EventKeyboard::KeyCode::KEY_W }, + { GLFW_KEY_X , EventKeyboard::KeyCode::KEY_X }, + { GLFW_KEY_Y , EventKeyboard::KeyCode::KEY_Y }, + { GLFW_KEY_Z , EventKeyboard::KeyCode::KEY_Z }, + { GLFW_KEY_LEFT_BRACKET , EventKeyboard::KeyCode::KEY_LEFT_BRACKET }, + { GLFW_KEY_BACKSLASH , EventKeyboard::KeyCode::KEY_BACK_SLASH }, + { GLFW_KEY_RIGHT_BRACKET , EventKeyboard::KeyCode::KEY_RIGHT_BRACKET }, + { GLFW_KEY_GRAVE_ACCENT , EventKeyboard::KeyCode::KEY_GRAVE }, + { GLFW_KEY_WORLD_1 , EventKeyboard::KeyCode::KEY_GRAVE }, + { GLFW_KEY_WORLD_2 , EventKeyboard::KeyCode::KEY_NONE }, /* Function keys */ - { GLFW_KEY_ESCAPE , KeyboardEvent::KeyCode::KEY_ESCAPE }, - { GLFW_KEY_ENTER , KeyboardEvent::KeyCode::KEY_KP_ENTER }, - { GLFW_KEY_TAB , KeyboardEvent::KeyCode::KEY_TAB }, - { GLFW_KEY_BACKSPACE , KeyboardEvent::KeyCode::KEY_BACKSPACE }, - { GLFW_KEY_INSERT , KeyboardEvent::KeyCode::KEY_INSERT }, - { GLFW_KEY_DELETE , KeyboardEvent::KeyCode::KEY_DELETE }, - { GLFW_KEY_RIGHT , KeyboardEvent::KeyCode::KEY_RIGHT_ARROW }, - { GLFW_KEY_LEFT , KeyboardEvent::KeyCode::KEY_LEFT_ARROW }, - { GLFW_KEY_DOWN , KeyboardEvent::KeyCode::KEY_DOWN_ARROW }, - { GLFW_KEY_UP , KeyboardEvent::KeyCode::KEY_UP_ARROW }, - { GLFW_KEY_PAGE_UP , KeyboardEvent::KeyCode::KEY_KP_PG_UP }, - { GLFW_KEY_PAGE_DOWN , KeyboardEvent::KeyCode::KEY_KP_PG_DOWN }, - { GLFW_KEY_HOME , KeyboardEvent::KeyCode::KEY_KP_HOME }, - { GLFW_KEY_END , KeyboardEvent::KeyCode::KEY_END }, - { GLFW_KEY_CAPS_LOCK , KeyboardEvent::KeyCode::KEY_CAPS_LOCK }, - { GLFW_KEY_SCROLL_LOCK , KeyboardEvent::KeyCode::KEY_SCROLL_LOCK }, - { GLFW_KEY_NUM_LOCK , KeyboardEvent::KeyCode::KEY_NUM_LOCK }, - { GLFW_KEY_PRINT_SCREEN , KeyboardEvent::KeyCode::KEY_PRINT }, - { GLFW_KEY_PAUSE , KeyboardEvent::KeyCode::KEY_PAUSE }, - { GLFW_KEY_F1 , KeyboardEvent::KeyCode::KEY_F1 }, - { GLFW_KEY_F2 , KeyboardEvent::KeyCode::KEY_F2 }, - { GLFW_KEY_F3 , KeyboardEvent::KeyCode::KEY_F3 }, - { GLFW_KEY_F4 , KeyboardEvent::KeyCode::KEY_F4 }, - { GLFW_KEY_F5 , KeyboardEvent::KeyCode::KEY_F5 }, - { GLFW_KEY_F6 , KeyboardEvent::KeyCode::KEY_F6 }, - { GLFW_KEY_F7 , KeyboardEvent::KeyCode::KEY_F7 }, - { GLFW_KEY_F8 , KeyboardEvent::KeyCode::KEY_F8 }, - { GLFW_KEY_F9 , KeyboardEvent::KeyCode::KEY_F9 }, - { GLFW_KEY_F10 , KeyboardEvent::KeyCode::KEY_F10 }, - { GLFW_KEY_F11 , KeyboardEvent::KeyCode::KEY_F11 }, - { GLFW_KEY_F12 , KeyboardEvent::KeyCode::KEY_F12 }, - { GLFW_KEY_F13 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F14 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F15 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F16 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F17 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F18 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F19 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F20 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F21 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F22 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F23 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F24 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F25 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_KP_0 , KeyboardEvent::KeyCode::KEY_0 }, - { GLFW_KEY_KP_1 , KeyboardEvent::KeyCode::KEY_1 }, - { GLFW_KEY_KP_2 , KeyboardEvent::KeyCode::KEY_2 }, - { GLFW_KEY_KP_3 , KeyboardEvent::KeyCode::KEY_3 }, - { GLFW_KEY_KP_4 , KeyboardEvent::KeyCode::KEY_4 }, - { GLFW_KEY_KP_5 , KeyboardEvent::KeyCode::KEY_5 }, - { GLFW_KEY_KP_6 , KeyboardEvent::KeyCode::KEY_6 }, - { GLFW_KEY_KP_7 , KeyboardEvent::KeyCode::KEY_7 }, - { GLFW_KEY_KP_8 , KeyboardEvent::KeyCode::KEY_8 }, - { GLFW_KEY_KP_9 , KeyboardEvent::KeyCode::KEY_9 }, - { GLFW_KEY_KP_DECIMAL , KeyboardEvent::KeyCode::KEY_PERIOD }, - { GLFW_KEY_KP_DIVIDE , KeyboardEvent::KeyCode::KEY_KP_DIVIDE }, - { GLFW_KEY_KP_MULTIPLY , KeyboardEvent::KeyCode::KEY_KP_MULTIPLY }, - { GLFW_KEY_KP_SUBTRACT , KeyboardEvent::KeyCode::KEY_KP_MINUS }, - { GLFW_KEY_KP_ADD , KeyboardEvent::KeyCode::KEY_KP_PLUS }, - { GLFW_KEY_KP_ENTER , KeyboardEvent::KeyCode::KEY_KP_ENTER }, - { GLFW_KEY_KP_EQUAL , KeyboardEvent::KeyCode::KEY_EQUAL }, - { GLFW_KEY_LEFT_SHIFT , KeyboardEvent::KeyCode::KEY_SHIFT }, - { GLFW_KEY_LEFT_CONTROL , KeyboardEvent::KeyCode::KEY_CTRL }, - { GLFW_KEY_LEFT_ALT , KeyboardEvent::KeyCode::KEY_ALT }, - { GLFW_KEY_LEFT_SUPER , KeyboardEvent::KeyCode::KEY_HYPER }, - { GLFW_KEY_RIGHT_SHIFT , KeyboardEvent::KeyCode::KEY_SHIFT }, - { GLFW_KEY_RIGHT_CONTROL , KeyboardEvent::KeyCode::KEY_CTRL }, - { GLFW_KEY_RIGHT_ALT , KeyboardEvent::KeyCode::KEY_ALT }, - { GLFW_KEY_RIGHT_SUPER , KeyboardEvent::KeyCode::KEY_HYPER }, - { GLFW_KEY_MENU , KeyboardEvent::KeyCode::KEY_MENU }, - { GLFW_KEY_LAST , KeyboardEvent::KeyCode::KEY_NONE } + { GLFW_KEY_ESCAPE , EventKeyboard::KeyCode::KEY_ESCAPE }, + { GLFW_KEY_ENTER , EventKeyboard::KeyCode::KEY_KP_ENTER }, + { GLFW_KEY_TAB , EventKeyboard::KeyCode::KEY_TAB }, + { GLFW_KEY_BACKSPACE , EventKeyboard::KeyCode::KEY_BACKSPACE }, + { GLFW_KEY_INSERT , EventKeyboard::KeyCode::KEY_INSERT }, + { GLFW_KEY_DELETE , EventKeyboard::KeyCode::KEY_DELETE }, + { GLFW_KEY_RIGHT , EventKeyboard::KeyCode::KEY_RIGHT_ARROW }, + { GLFW_KEY_LEFT , EventKeyboard::KeyCode::KEY_LEFT_ARROW }, + { GLFW_KEY_DOWN , EventKeyboard::KeyCode::KEY_DOWN_ARROW }, + { GLFW_KEY_UP , EventKeyboard::KeyCode::KEY_UP_ARROW }, + { GLFW_KEY_PAGE_UP , EventKeyboard::KeyCode::KEY_KP_PG_UP }, + { GLFW_KEY_PAGE_DOWN , EventKeyboard::KeyCode::KEY_KP_PG_DOWN }, + { GLFW_KEY_HOME , EventKeyboard::KeyCode::KEY_KP_HOME }, + { GLFW_KEY_END , EventKeyboard::KeyCode::KEY_END }, + { GLFW_KEY_CAPS_LOCK , EventKeyboard::KeyCode::KEY_CAPS_LOCK }, + { GLFW_KEY_SCROLL_LOCK , EventKeyboard::KeyCode::KEY_SCROLL_LOCK }, + { GLFW_KEY_NUM_LOCK , EventKeyboard::KeyCode::KEY_NUM_LOCK }, + { GLFW_KEY_PRINT_SCREEN , EventKeyboard::KeyCode::KEY_PRINT }, + { GLFW_KEY_PAUSE , EventKeyboard::KeyCode::KEY_PAUSE }, + { GLFW_KEY_F1 , EventKeyboard::KeyCode::KEY_F1 }, + { GLFW_KEY_F2 , EventKeyboard::KeyCode::KEY_F2 }, + { GLFW_KEY_F3 , EventKeyboard::KeyCode::KEY_F3 }, + { GLFW_KEY_F4 , EventKeyboard::KeyCode::KEY_F4 }, + { GLFW_KEY_F5 , EventKeyboard::KeyCode::KEY_F5 }, + { GLFW_KEY_F6 , EventKeyboard::KeyCode::KEY_F6 }, + { GLFW_KEY_F7 , EventKeyboard::KeyCode::KEY_F7 }, + { GLFW_KEY_F8 , EventKeyboard::KeyCode::KEY_F8 }, + { GLFW_KEY_F9 , EventKeyboard::KeyCode::KEY_F9 }, + { GLFW_KEY_F10 , EventKeyboard::KeyCode::KEY_F10 }, + { GLFW_KEY_F11 , EventKeyboard::KeyCode::KEY_F11 }, + { GLFW_KEY_F12 , EventKeyboard::KeyCode::KEY_F12 }, + { GLFW_KEY_F13 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F14 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F15 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F16 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F17 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F18 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F19 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F20 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F21 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F22 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F23 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F24 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F25 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_KP_0 , EventKeyboard::KeyCode::KEY_0 }, + { GLFW_KEY_KP_1 , EventKeyboard::KeyCode::KEY_1 }, + { GLFW_KEY_KP_2 , EventKeyboard::KeyCode::KEY_2 }, + { GLFW_KEY_KP_3 , EventKeyboard::KeyCode::KEY_3 }, + { GLFW_KEY_KP_4 , EventKeyboard::KeyCode::KEY_4 }, + { GLFW_KEY_KP_5 , EventKeyboard::KeyCode::KEY_5 }, + { GLFW_KEY_KP_6 , EventKeyboard::KeyCode::KEY_6 }, + { GLFW_KEY_KP_7 , EventKeyboard::KeyCode::KEY_7 }, + { GLFW_KEY_KP_8 , EventKeyboard::KeyCode::KEY_8 }, + { GLFW_KEY_KP_9 , EventKeyboard::KeyCode::KEY_9 }, + { GLFW_KEY_KP_DECIMAL , EventKeyboard::KeyCode::KEY_PERIOD }, + { GLFW_KEY_KP_DIVIDE , EventKeyboard::KeyCode::KEY_KP_DIVIDE }, + { GLFW_KEY_KP_MULTIPLY , EventKeyboard::KeyCode::KEY_KP_MULTIPLY }, + { GLFW_KEY_KP_SUBTRACT , EventKeyboard::KeyCode::KEY_KP_MINUS }, + { GLFW_KEY_KP_ADD , EventKeyboard::KeyCode::KEY_KP_PLUS }, + { GLFW_KEY_KP_ENTER , EventKeyboard::KeyCode::KEY_KP_ENTER }, + { GLFW_KEY_KP_EQUAL , EventKeyboard::KeyCode::KEY_EQUAL }, + { GLFW_KEY_LEFT_SHIFT , EventKeyboard::KeyCode::KEY_SHIFT }, + { GLFW_KEY_LEFT_CONTROL , EventKeyboard::KeyCode::KEY_CTRL }, + { GLFW_KEY_LEFT_ALT , EventKeyboard::KeyCode::KEY_ALT }, + { GLFW_KEY_LEFT_SUPER , EventKeyboard::KeyCode::KEY_HYPER }, + { GLFW_KEY_RIGHT_SHIFT , EventKeyboard::KeyCode::KEY_SHIFT }, + { GLFW_KEY_RIGHT_CONTROL , EventKeyboard::KeyCode::KEY_CTRL }, + { GLFW_KEY_RIGHT_ALT , EventKeyboard::KeyCode::KEY_ALT }, + { GLFW_KEY_RIGHT_SUPER , EventKeyboard::KeyCode::KEY_HYPER }, + { GLFW_KEY_MENU , EventKeyboard::KeyCode::KEY_MENU }, + { GLFW_KEY_LAST , EventKeyboard::KeyCode::KEY_NONE } }; //begin EGLViewEventHandler @@ -222,7 +222,7 @@ void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x, void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) { - KeyboardEvent event(g_keyCodeMap[key], GLFW_PRESS == action); + EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action); EventDispatcher::getInstance()->dispatchEvent(&event); } diff --git a/cocos2dx/platform/mac/CCEGLView.mm b/cocos2dx/platform/mac/CCEGLView.mm index ba839a9e3a..c94d9077b6 100644 --- a/cocos2dx/platform/mac/CCEGLView.mm +++ b/cocos2dx/platform/mac/CCEGLView.mm @@ -33,134 +33,134 @@ NS_CC_BEGIN -static std::map g_keyCodeMap = { +static std::map g_keyCodeMap = { /* The unknown key */ - { GLFW_KEY_UNKNOWN , KeyboardEvent::KeyCode::KEY_NONE }, + { GLFW_KEY_UNKNOWN , EventKeyboard::KeyCode::KEY_NONE }, /* Printable keys */ - { GLFW_KEY_SPACE , KeyboardEvent::KeyCode::KEY_SPACE }, - { GLFW_KEY_APOSTROPHE , KeyboardEvent::KeyCode::KEY_APOSTROPHE }, - { GLFW_KEY_COMMA , KeyboardEvent::KeyCode::KEY_COMMA }, - { GLFW_KEY_MINUS , KeyboardEvent::KeyCode::KEY_MINUS }, - { GLFW_KEY_PERIOD , KeyboardEvent::KeyCode::KEY_PERIOD }, - { GLFW_KEY_SLASH , KeyboardEvent::KeyCode::KEY_SLASH }, - { GLFW_KEY_0 , KeyboardEvent::KeyCode::KEY_0 }, - { GLFW_KEY_1 , KeyboardEvent::KeyCode::KEY_1 }, - { GLFW_KEY_2 , KeyboardEvent::KeyCode::KEY_2 }, - { GLFW_KEY_3 , KeyboardEvent::KeyCode::KEY_3 }, - { GLFW_KEY_4 , KeyboardEvent::KeyCode::KEY_4 }, - { GLFW_KEY_5 , KeyboardEvent::KeyCode::KEY_5 }, - { GLFW_KEY_6 , KeyboardEvent::KeyCode::KEY_6 }, - { GLFW_KEY_7 , KeyboardEvent::KeyCode::KEY_7 }, - { GLFW_KEY_8 , KeyboardEvent::KeyCode::KEY_8 }, - { GLFW_KEY_9 , KeyboardEvent::KeyCode::KEY_9 }, - { GLFW_KEY_SEMICOLON , KeyboardEvent::KeyCode::KEY_SEMICOLON }, - { GLFW_KEY_EQUAL , KeyboardEvent::KeyCode::KEY_EQUAL }, - { GLFW_KEY_A , KeyboardEvent::KeyCode::KEY_A }, - { GLFW_KEY_B , KeyboardEvent::KeyCode::KEY_B }, - { GLFW_KEY_C , KeyboardEvent::KeyCode::KEY_C }, - { GLFW_KEY_D , KeyboardEvent::KeyCode::KEY_D }, - { GLFW_KEY_E , KeyboardEvent::KeyCode::KEY_E }, - { GLFW_KEY_F , KeyboardEvent::KeyCode::KEY_F }, - { GLFW_KEY_G , KeyboardEvent::KeyCode::KEY_G }, - { GLFW_KEY_H , KeyboardEvent::KeyCode::KEY_H }, - { GLFW_KEY_I , KeyboardEvent::KeyCode::KEY_I }, - { GLFW_KEY_J , KeyboardEvent::KeyCode::KEY_J }, - { GLFW_KEY_K , KeyboardEvent::KeyCode::KEY_K }, - { GLFW_KEY_L , KeyboardEvent::KeyCode::KEY_L }, - { GLFW_KEY_M , KeyboardEvent::KeyCode::KEY_M }, - { GLFW_KEY_N , KeyboardEvent::KeyCode::KEY_N }, - { GLFW_KEY_O , KeyboardEvent::KeyCode::KEY_O }, - { GLFW_KEY_P , KeyboardEvent::KeyCode::KEY_P }, - { GLFW_KEY_Q , KeyboardEvent::KeyCode::KEY_Q }, - { GLFW_KEY_R , KeyboardEvent::KeyCode::KEY_R }, - { GLFW_KEY_S , KeyboardEvent::KeyCode::KEY_S }, - { GLFW_KEY_T , KeyboardEvent::KeyCode::KEY_T }, - { GLFW_KEY_U , KeyboardEvent::KeyCode::KEY_U }, - { GLFW_KEY_V , KeyboardEvent::KeyCode::KEY_V }, - { GLFW_KEY_W , KeyboardEvent::KeyCode::KEY_W }, - { GLFW_KEY_X , KeyboardEvent::KeyCode::KEY_X }, - { GLFW_KEY_Y , KeyboardEvent::KeyCode::KEY_Y }, - { GLFW_KEY_Z , KeyboardEvent::KeyCode::KEY_Z }, - { GLFW_KEY_LEFT_BRACKET , KeyboardEvent::KeyCode::KEY_LEFT_BRACKET }, - { GLFW_KEY_BACKSLASH , KeyboardEvent::KeyCode::KEY_BACK_SLASH }, - { GLFW_KEY_RIGHT_BRACKET , KeyboardEvent::KeyCode::KEY_RIGHT_BRACKET }, - { GLFW_KEY_GRAVE_ACCENT , KeyboardEvent::KeyCode::KEY_GRAVE }, - { GLFW_KEY_WORLD_1 , KeyboardEvent::KeyCode::KEY_GRAVE }, - { GLFW_KEY_WORLD_2 , KeyboardEvent::KeyCode::KEY_NONE }, + { GLFW_KEY_SPACE , EventKeyboard::KeyCode::KEY_SPACE }, + { GLFW_KEY_APOSTROPHE , EventKeyboard::KeyCode::KEY_APOSTROPHE }, + { GLFW_KEY_COMMA , EventKeyboard::KeyCode::KEY_COMMA }, + { GLFW_KEY_MINUS , EventKeyboard::KeyCode::KEY_MINUS }, + { GLFW_KEY_PERIOD , EventKeyboard::KeyCode::KEY_PERIOD }, + { GLFW_KEY_SLASH , EventKeyboard::KeyCode::KEY_SLASH }, + { GLFW_KEY_0 , EventKeyboard::KeyCode::KEY_0 }, + { GLFW_KEY_1 , EventKeyboard::KeyCode::KEY_1 }, + { GLFW_KEY_2 , EventKeyboard::KeyCode::KEY_2 }, + { GLFW_KEY_3 , EventKeyboard::KeyCode::KEY_3 }, + { GLFW_KEY_4 , EventKeyboard::KeyCode::KEY_4 }, + { GLFW_KEY_5 , EventKeyboard::KeyCode::KEY_5 }, + { GLFW_KEY_6 , EventKeyboard::KeyCode::KEY_6 }, + { GLFW_KEY_7 , EventKeyboard::KeyCode::KEY_7 }, + { GLFW_KEY_8 , EventKeyboard::KeyCode::KEY_8 }, + { GLFW_KEY_9 , EventKeyboard::KeyCode::KEY_9 }, + { GLFW_KEY_SEMICOLON , EventKeyboard::KeyCode::KEY_SEMICOLON }, + { GLFW_KEY_EQUAL , EventKeyboard::KeyCode::KEY_EQUAL }, + { GLFW_KEY_A , EventKeyboard::KeyCode::KEY_A }, + { GLFW_KEY_B , EventKeyboard::KeyCode::KEY_B }, + { GLFW_KEY_C , EventKeyboard::KeyCode::KEY_C }, + { GLFW_KEY_D , EventKeyboard::KeyCode::KEY_D }, + { GLFW_KEY_E , EventKeyboard::KeyCode::KEY_E }, + { GLFW_KEY_F , EventKeyboard::KeyCode::KEY_F }, + { GLFW_KEY_G , EventKeyboard::KeyCode::KEY_G }, + { GLFW_KEY_H , EventKeyboard::KeyCode::KEY_H }, + { GLFW_KEY_I , EventKeyboard::KeyCode::KEY_I }, + { GLFW_KEY_J , EventKeyboard::KeyCode::KEY_J }, + { GLFW_KEY_K , EventKeyboard::KeyCode::KEY_K }, + { GLFW_KEY_L , EventKeyboard::KeyCode::KEY_L }, + { GLFW_KEY_M , EventKeyboard::KeyCode::KEY_M }, + { GLFW_KEY_N , EventKeyboard::KeyCode::KEY_N }, + { GLFW_KEY_O , EventKeyboard::KeyCode::KEY_O }, + { GLFW_KEY_P , EventKeyboard::KeyCode::KEY_P }, + { GLFW_KEY_Q , EventKeyboard::KeyCode::KEY_Q }, + { GLFW_KEY_R , EventKeyboard::KeyCode::KEY_R }, + { GLFW_KEY_S , EventKeyboard::KeyCode::KEY_S }, + { GLFW_KEY_T , EventKeyboard::KeyCode::KEY_T }, + { GLFW_KEY_U , EventKeyboard::KeyCode::KEY_U }, + { GLFW_KEY_V , EventKeyboard::KeyCode::KEY_V }, + { GLFW_KEY_W , EventKeyboard::KeyCode::KEY_W }, + { GLFW_KEY_X , EventKeyboard::KeyCode::KEY_X }, + { GLFW_KEY_Y , EventKeyboard::KeyCode::KEY_Y }, + { GLFW_KEY_Z , EventKeyboard::KeyCode::KEY_Z }, + { GLFW_KEY_LEFT_BRACKET , EventKeyboard::KeyCode::KEY_LEFT_BRACKET }, + { GLFW_KEY_BACKSLASH , EventKeyboard::KeyCode::KEY_BACK_SLASH }, + { GLFW_KEY_RIGHT_BRACKET , EventKeyboard::KeyCode::KEY_RIGHT_BRACKET }, + { GLFW_KEY_GRAVE_ACCENT , EventKeyboard::KeyCode::KEY_GRAVE }, + { GLFW_KEY_WORLD_1 , EventKeyboard::KeyCode::KEY_GRAVE }, + { GLFW_KEY_WORLD_2 , EventKeyboard::KeyCode::KEY_NONE }, /* Function keys */ - { GLFW_KEY_ESCAPE , KeyboardEvent::KeyCode::KEY_ESCAPE }, - { GLFW_KEY_ENTER , KeyboardEvent::KeyCode::KEY_KP_ENTER }, - { GLFW_KEY_TAB , KeyboardEvent::KeyCode::KEY_TAB }, - { GLFW_KEY_BACKSPACE , KeyboardEvent::KeyCode::KEY_BACKSPACE }, - { GLFW_KEY_INSERT , KeyboardEvent::KeyCode::KEY_INSERT }, - { GLFW_KEY_DELETE , KeyboardEvent::KeyCode::KEY_DELETE }, - { GLFW_KEY_RIGHT , KeyboardEvent::KeyCode::KEY_RIGHT_ARROW }, - { GLFW_KEY_LEFT , KeyboardEvent::KeyCode::KEY_LEFT_ARROW }, - { GLFW_KEY_DOWN , KeyboardEvent::KeyCode::KEY_DOWN_ARROW }, - { GLFW_KEY_UP , KeyboardEvent::KeyCode::KEY_UP_ARROW }, - { GLFW_KEY_PAGE_UP , KeyboardEvent::KeyCode::KEY_KP_PG_UP }, - { GLFW_KEY_PAGE_DOWN , KeyboardEvent::KeyCode::KEY_KP_PG_DOWN }, - { GLFW_KEY_HOME , KeyboardEvent::KeyCode::KEY_KP_HOME }, - { GLFW_KEY_END , KeyboardEvent::KeyCode::KEY_END }, - { GLFW_KEY_CAPS_LOCK , KeyboardEvent::KeyCode::KEY_CAPS_LOCK }, - { GLFW_KEY_SCROLL_LOCK , KeyboardEvent::KeyCode::KEY_SCROLL_LOCK }, - { GLFW_KEY_NUM_LOCK , KeyboardEvent::KeyCode::KEY_NUM_LOCK }, - { GLFW_KEY_PRINT_SCREEN , KeyboardEvent::KeyCode::KEY_PRINT }, - { GLFW_KEY_PAUSE , KeyboardEvent::KeyCode::KEY_PAUSE }, - { GLFW_KEY_F1 , KeyboardEvent::KeyCode::KEY_F1 }, - { GLFW_KEY_F2 , KeyboardEvent::KeyCode::KEY_F2 }, - { GLFW_KEY_F3 , KeyboardEvent::KeyCode::KEY_F3 }, - { GLFW_KEY_F4 , KeyboardEvent::KeyCode::KEY_F4 }, - { GLFW_KEY_F5 , KeyboardEvent::KeyCode::KEY_F5 }, - { GLFW_KEY_F6 , KeyboardEvent::KeyCode::KEY_F6 }, - { GLFW_KEY_F7 , KeyboardEvent::KeyCode::KEY_F7 }, - { GLFW_KEY_F8 , KeyboardEvent::KeyCode::KEY_F8 }, - { GLFW_KEY_F9 , KeyboardEvent::KeyCode::KEY_F9 }, - { GLFW_KEY_F10 , KeyboardEvent::KeyCode::KEY_F10 }, - { GLFW_KEY_F11 , KeyboardEvent::KeyCode::KEY_F11 }, - { GLFW_KEY_F12 , KeyboardEvent::KeyCode::KEY_F12 }, - { GLFW_KEY_F13 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F14 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F15 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F16 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F17 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F18 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F19 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F20 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F21 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F22 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F23 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F24 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F25 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_KP_0 , KeyboardEvent::KeyCode::KEY_0 }, - { GLFW_KEY_KP_1 , KeyboardEvent::KeyCode::KEY_1 }, - { GLFW_KEY_KP_2 , KeyboardEvent::KeyCode::KEY_2 }, - { GLFW_KEY_KP_3 , KeyboardEvent::KeyCode::KEY_3 }, - { GLFW_KEY_KP_4 , KeyboardEvent::KeyCode::KEY_4 }, - { GLFW_KEY_KP_5 , KeyboardEvent::KeyCode::KEY_5 }, - { GLFW_KEY_KP_6 , KeyboardEvent::KeyCode::KEY_6 }, - { GLFW_KEY_KP_7 , KeyboardEvent::KeyCode::KEY_7 }, - { GLFW_KEY_KP_8 , KeyboardEvent::KeyCode::KEY_8 }, - { GLFW_KEY_KP_9 , KeyboardEvent::KeyCode::KEY_9 }, - { GLFW_KEY_KP_DECIMAL , KeyboardEvent::KeyCode::KEY_PERIOD }, - { GLFW_KEY_KP_DIVIDE , KeyboardEvent::KeyCode::KEY_KP_DIVIDE }, - { GLFW_KEY_KP_MULTIPLY , KeyboardEvent::KeyCode::KEY_KP_MULTIPLY }, - { GLFW_KEY_KP_SUBTRACT , KeyboardEvent::KeyCode::KEY_KP_MINUS }, - { GLFW_KEY_KP_ADD , KeyboardEvent::KeyCode::KEY_KP_PLUS }, - { GLFW_KEY_KP_ENTER , KeyboardEvent::KeyCode::KEY_KP_ENTER }, - { GLFW_KEY_KP_EQUAL , KeyboardEvent::KeyCode::KEY_EQUAL }, - { GLFW_KEY_LEFT_SHIFT , KeyboardEvent::KeyCode::KEY_SHIFT }, - { GLFW_KEY_LEFT_CONTROL , KeyboardEvent::KeyCode::KEY_CTRL }, - { GLFW_KEY_LEFT_ALT , KeyboardEvent::KeyCode::KEY_ALT }, - { GLFW_KEY_LEFT_SUPER , KeyboardEvent::KeyCode::KEY_HYPER }, - { GLFW_KEY_RIGHT_SHIFT , KeyboardEvent::KeyCode::KEY_SHIFT }, - { GLFW_KEY_RIGHT_CONTROL , KeyboardEvent::KeyCode::KEY_CTRL }, - { GLFW_KEY_RIGHT_ALT , KeyboardEvent::KeyCode::KEY_ALT }, - { GLFW_KEY_RIGHT_SUPER , KeyboardEvent::KeyCode::KEY_HYPER }, - { GLFW_KEY_MENU , KeyboardEvent::KeyCode::KEY_MENU }, - { GLFW_KEY_LAST , KeyboardEvent::KeyCode::KEY_NONE } + { GLFW_KEY_ESCAPE , EventKeyboard::KeyCode::KEY_ESCAPE }, + { GLFW_KEY_ENTER , EventKeyboard::KeyCode::KEY_KP_ENTER }, + { GLFW_KEY_TAB , EventKeyboard::KeyCode::KEY_TAB }, + { GLFW_KEY_BACKSPACE , EventKeyboard::KeyCode::KEY_BACKSPACE }, + { GLFW_KEY_INSERT , EventKeyboard::KeyCode::KEY_INSERT }, + { GLFW_KEY_DELETE , EventKeyboard::KeyCode::KEY_DELETE }, + { GLFW_KEY_RIGHT , EventKeyboard::KeyCode::KEY_RIGHT_ARROW }, + { GLFW_KEY_LEFT , EventKeyboard::KeyCode::KEY_LEFT_ARROW }, + { GLFW_KEY_DOWN , EventKeyboard::KeyCode::KEY_DOWN_ARROW }, + { GLFW_KEY_UP , EventKeyboard::KeyCode::KEY_UP_ARROW }, + { GLFW_KEY_PAGE_UP , EventKeyboard::KeyCode::KEY_KP_PG_UP }, + { GLFW_KEY_PAGE_DOWN , EventKeyboard::KeyCode::KEY_KP_PG_DOWN }, + { GLFW_KEY_HOME , EventKeyboard::KeyCode::KEY_KP_HOME }, + { GLFW_KEY_END , EventKeyboard::KeyCode::KEY_END }, + { GLFW_KEY_CAPS_LOCK , EventKeyboard::KeyCode::KEY_CAPS_LOCK }, + { GLFW_KEY_SCROLL_LOCK , EventKeyboard::KeyCode::KEY_SCROLL_LOCK }, + { GLFW_KEY_NUM_LOCK , EventKeyboard::KeyCode::KEY_NUM_LOCK }, + { GLFW_KEY_PRINT_SCREEN , EventKeyboard::KeyCode::KEY_PRINT }, + { GLFW_KEY_PAUSE , EventKeyboard::KeyCode::KEY_PAUSE }, + { GLFW_KEY_F1 , EventKeyboard::KeyCode::KEY_F1 }, + { GLFW_KEY_F2 , EventKeyboard::KeyCode::KEY_F2 }, + { GLFW_KEY_F3 , EventKeyboard::KeyCode::KEY_F3 }, + { GLFW_KEY_F4 , EventKeyboard::KeyCode::KEY_F4 }, + { GLFW_KEY_F5 , EventKeyboard::KeyCode::KEY_F5 }, + { GLFW_KEY_F6 , EventKeyboard::KeyCode::KEY_F6 }, + { GLFW_KEY_F7 , EventKeyboard::KeyCode::KEY_F7 }, + { GLFW_KEY_F8 , EventKeyboard::KeyCode::KEY_F8 }, + { GLFW_KEY_F9 , EventKeyboard::KeyCode::KEY_F9 }, + { GLFW_KEY_F10 , EventKeyboard::KeyCode::KEY_F10 }, + { GLFW_KEY_F11 , EventKeyboard::KeyCode::KEY_F11 }, + { GLFW_KEY_F12 , EventKeyboard::KeyCode::KEY_F12 }, + { GLFW_KEY_F13 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F14 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F15 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F16 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F17 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F18 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F19 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F20 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F21 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F22 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F23 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F24 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F25 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_KP_0 , EventKeyboard::KeyCode::KEY_0 }, + { GLFW_KEY_KP_1 , EventKeyboard::KeyCode::KEY_1 }, + { GLFW_KEY_KP_2 , EventKeyboard::KeyCode::KEY_2 }, + { GLFW_KEY_KP_3 , EventKeyboard::KeyCode::KEY_3 }, + { GLFW_KEY_KP_4 , EventKeyboard::KeyCode::KEY_4 }, + { GLFW_KEY_KP_5 , EventKeyboard::KeyCode::KEY_5 }, + { GLFW_KEY_KP_6 , EventKeyboard::KeyCode::KEY_6 }, + { GLFW_KEY_KP_7 , EventKeyboard::KeyCode::KEY_7 }, + { GLFW_KEY_KP_8 , EventKeyboard::KeyCode::KEY_8 }, + { GLFW_KEY_KP_9 , EventKeyboard::KeyCode::KEY_9 }, + { GLFW_KEY_KP_DECIMAL , EventKeyboard::KeyCode::KEY_PERIOD }, + { GLFW_KEY_KP_DIVIDE , EventKeyboard::KeyCode::KEY_KP_DIVIDE }, + { GLFW_KEY_KP_MULTIPLY , EventKeyboard::KeyCode::KEY_KP_MULTIPLY }, + { GLFW_KEY_KP_SUBTRACT , EventKeyboard::KeyCode::KEY_KP_MINUS }, + { GLFW_KEY_KP_ADD , EventKeyboard::KeyCode::KEY_KP_PLUS }, + { GLFW_KEY_KP_ENTER , EventKeyboard::KeyCode::KEY_KP_ENTER }, + { GLFW_KEY_KP_EQUAL , EventKeyboard::KeyCode::KEY_EQUAL }, + { GLFW_KEY_LEFT_SHIFT , EventKeyboard::KeyCode::KEY_SHIFT }, + { GLFW_KEY_LEFT_CONTROL , EventKeyboard::KeyCode::KEY_CTRL }, + { GLFW_KEY_LEFT_ALT , EventKeyboard::KeyCode::KEY_ALT }, + { GLFW_KEY_LEFT_SUPER , EventKeyboard::KeyCode::KEY_HYPER }, + { GLFW_KEY_RIGHT_SHIFT , EventKeyboard::KeyCode::KEY_SHIFT }, + { GLFW_KEY_RIGHT_CONTROL , EventKeyboard::KeyCode::KEY_CTRL }, + { GLFW_KEY_RIGHT_ALT , EventKeyboard::KeyCode::KEY_ALT }, + { GLFW_KEY_RIGHT_SUPER , EventKeyboard::KeyCode::KEY_HYPER }, + { GLFW_KEY_MENU , EventKeyboard::KeyCode::KEY_MENU }, + { GLFW_KEY_LAST , EventKeyboard::KeyCode::KEY_NONE } }; @@ -238,7 +238,7 @@ void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x, void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) { - KeyboardEvent event(g_keyCodeMap[key], GLFW_PRESS == action); + EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action); EventDispatcher::getInstance()->dispatchEvent(&event); } diff --git a/cocos2dx/platform/win32/CCEGLView.cpp b/cocos2dx/platform/win32/CCEGLView.cpp index 58da40a0c9..957f57cc2f 100644 --- a/cocos2dx/platform/win32/CCEGLView.cpp +++ b/cocos2dx/platform/win32/CCEGLView.cpp @@ -38,140 +38,140 @@ NS_CC_BEGIN struct keyCodeItem { int glfwKeyCode; - KeyboardEvent::KeyCode keyCode; + EventKeyboard::KeyCode keyCode; }; -static std::map g_keyCodeMap; +static std::map g_keyCodeMap; static keyCodeItem g_keyCodeStructArray[] = { /* The unknown key */ - { GLFW_KEY_UNKNOWN , KeyboardEvent::KeyCode::KEY_NONE }, + { GLFW_KEY_UNKNOWN , EventKeyboard::KeyCode::KEY_NONE }, /* Printable keys */ - { GLFW_KEY_SPACE , KeyboardEvent::KeyCode::KEY_SPACE }, - { GLFW_KEY_APOSTROPHE , KeyboardEvent::KeyCode::KEY_APOSTROPHE }, - { GLFW_KEY_COMMA , KeyboardEvent::KeyCode::KEY_COMMA }, - { GLFW_KEY_MINUS , KeyboardEvent::KeyCode::KEY_MINUS }, - { GLFW_KEY_PERIOD , KeyboardEvent::KeyCode::KEY_PERIOD }, - { GLFW_KEY_SLASH , KeyboardEvent::KeyCode::KEY_SLASH }, - { GLFW_KEY_0 , KeyboardEvent::KeyCode::KEY_0 }, - { GLFW_KEY_1 , KeyboardEvent::KeyCode::KEY_1 }, - { GLFW_KEY_2 , KeyboardEvent::KeyCode::KEY_2 }, - { GLFW_KEY_3 , KeyboardEvent::KeyCode::KEY_3 }, - { GLFW_KEY_4 , KeyboardEvent::KeyCode::KEY_4 }, - { GLFW_KEY_5 , KeyboardEvent::KeyCode::KEY_5 }, - { GLFW_KEY_6 , KeyboardEvent::KeyCode::KEY_6 }, - { GLFW_KEY_7 , KeyboardEvent::KeyCode::KEY_7 }, - { GLFW_KEY_8 , KeyboardEvent::KeyCode::KEY_8 }, - { GLFW_KEY_9 , KeyboardEvent::KeyCode::KEY_9 }, - { GLFW_KEY_SEMICOLON , KeyboardEvent::KeyCode::KEY_SEMICOLON }, - { GLFW_KEY_EQUAL , KeyboardEvent::KeyCode::KEY_EQUAL }, - { GLFW_KEY_A , KeyboardEvent::KeyCode::KEY_A }, - { GLFW_KEY_B , KeyboardEvent::KeyCode::KEY_B }, - { GLFW_KEY_C , KeyboardEvent::KeyCode::KEY_C }, - { GLFW_KEY_D , KeyboardEvent::KeyCode::KEY_D }, - { GLFW_KEY_E , KeyboardEvent::KeyCode::KEY_E }, - { GLFW_KEY_F , KeyboardEvent::KeyCode::KEY_F }, - { GLFW_KEY_G , KeyboardEvent::KeyCode::KEY_G }, - { GLFW_KEY_H , KeyboardEvent::KeyCode::KEY_H }, - { GLFW_KEY_I , KeyboardEvent::KeyCode::KEY_I }, - { GLFW_KEY_J , KeyboardEvent::KeyCode::KEY_J }, - { GLFW_KEY_K , KeyboardEvent::KeyCode::KEY_K }, - { GLFW_KEY_L , KeyboardEvent::KeyCode::KEY_L }, - { GLFW_KEY_M , KeyboardEvent::KeyCode::KEY_M }, - { GLFW_KEY_N , KeyboardEvent::KeyCode::KEY_N }, - { GLFW_KEY_O , KeyboardEvent::KeyCode::KEY_O }, - { GLFW_KEY_P , KeyboardEvent::KeyCode::KEY_P }, - { GLFW_KEY_Q , KeyboardEvent::KeyCode::KEY_Q }, - { GLFW_KEY_R , KeyboardEvent::KeyCode::KEY_R }, - { GLFW_KEY_S , KeyboardEvent::KeyCode::KEY_S }, - { GLFW_KEY_T , KeyboardEvent::KeyCode::KEY_T }, - { GLFW_KEY_U , KeyboardEvent::KeyCode::KEY_U }, - { GLFW_KEY_V , KeyboardEvent::KeyCode::KEY_V }, - { GLFW_KEY_W , KeyboardEvent::KeyCode::KEY_W }, - { GLFW_KEY_X , KeyboardEvent::KeyCode::KEY_X }, - { GLFW_KEY_Y , KeyboardEvent::KeyCode::KEY_Y }, - { GLFW_KEY_Z , KeyboardEvent::KeyCode::KEY_Z }, - { GLFW_KEY_LEFT_BRACKET , KeyboardEvent::KeyCode::KEY_LEFT_BRACKET }, - { GLFW_KEY_BACKSLASH , KeyboardEvent::KeyCode::KEY_BACK_SLASH }, - { GLFW_KEY_RIGHT_BRACKET , KeyboardEvent::KeyCode::KEY_RIGHT_BRACKET }, - { GLFW_KEY_GRAVE_ACCENT , KeyboardEvent::KeyCode::KEY_GRAVE }, - { GLFW_KEY_WORLD_1 , KeyboardEvent::KeyCode::KEY_GRAVE }, - { GLFW_KEY_WORLD_2 , KeyboardEvent::KeyCode::KEY_NONE }, + { GLFW_KEY_SPACE , EventKeyboard::KeyCode::KEY_SPACE }, + { GLFW_KEY_APOSTROPHE , EventKeyboard::KeyCode::KEY_APOSTROPHE }, + { GLFW_KEY_COMMA , EventKeyboard::KeyCode::KEY_COMMA }, + { GLFW_KEY_MINUS , EventKeyboard::KeyCode::KEY_MINUS }, + { GLFW_KEY_PERIOD , EventKeyboard::KeyCode::KEY_PERIOD }, + { GLFW_KEY_SLASH , EventKeyboard::KeyCode::KEY_SLASH }, + { GLFW_KEY_0 , EventKeyboard::KeyCode::KEY_0 }, + { GLFW_KEY_1 , EventKeyboard::KeyCode::KEY_1 }, + { GLFW_KEY_2 , EventKeyboard::KeyCode::KEY_2 }, + { GLFW_KEY_3 , EventKeyboard::KeyCode::KEY_3 }, + { GLFW_KEY_4 , EventKeyboard::KeyCode::KEY_4 }, + { GLFW_KEY_5 , EventKeyboard::KeyCode::KEY_5 }, + { GLFW_KEY_6 , EventKeyboard::KeyCode::KEY_6 }, + { GLFW_KEY_7 , EventKeyboard::KeyCode::KEY_7 }, + { GLFW_KEY_8 , EventKeyboard::KeyCode::KEY_8 }, + { GLFW_KEY_9 , EventKeyboard::KeyCode::KEY_9 }, + { GLFW_KEY_SEMICOLON , EventKeyboard::KeyCode::KEY_SEMICOLON }, + { GLFW_KEY_EQUAL , EventKeyboard::KeyCode::KEY_EQUAL }, + { GLFW_KEY_A , EventKeyboard::KeyCode::KEY_A }, + { GLFW_KEY_B , EventKeyboard::KeyCode::KEY_B }, + { GLFW_KEY_C , EventKeyboard::KeyCode::KEY_C }, + { GLFW_KEY_D , EventKeyboard::KeyCode::KEY_D }, + { GLFW_KEY_E , EventKeyboard::KeyCode::KEY_E }, + { GLFW_KEY_F , EventKeyboard::KeyCode::KEY_F }, + { GLFW_KEY_G , EventKeyboard::KeyCode::KEY_G }, + { GLFW_KEY_H , EventKeyboard::KeyCode::KEY_H }, + { GLFW_KEY_I , EventKeyboard::KeyCode::KEY_I }, + { GLFW_KEY_J , EventKeyboard::KeyCode::KEY_J }, + { GLFW_KEY_K , EventKeyboard::KeyCode::KEY_K }, + { GLFW_KEY_L , EventKeyboard::KeyCode::KEY_L }, + { GLFW_KEY_M , EventKeyboard::KeyCode::KEY_M }, + { GLFW_KEY_N , EventKeyboard::KeyCode::KEY_N }, + { GLFW_KEY_O , EventKeyboard::KeyCode::KEY_O }, + { GLFW_KEY_P , EventKeyboard::KeyCode::KEY_P }, + { GLFW_KEY_Q , EventKeyboard::KeyCode::KEY_Q }, + { GLFW_KEY_R , EventKeyboard::KeyCode::KEY_R }, + { GLFW_KEY_S , EventKeyboard::KeyCode::KEY_S }, + { GLFW_KEY_T , EventKeyboard::KeyCode::KEY_T }, + { GLFW_KEY_U , EventKeyboard::KeyCode::KEY_U }, + { GLFW_KEY_V , EventKeyboard::KeyCode::KEY_V }, + { GLFW_KEY_W , EventKeyboard::KeyCode::KEY_W }, + { GLFW_KEY_X , EventKeyboard::KeyCode::KEY_X }, + { GLFW_KEY_Y , EventKeyboard::KeyCode::KEY_Y }, + { GLFW_KEY_Z , EventKeyboard::KeyCode::KEY_Z }, + { GLFW_KEY_LEFT_BRACKET , EventKeyboard::KeyCode::KEY_LEFT_BRACKET }, + { GLFW_KEY_BACKSLASH , EventKeyboard::KeyCode::KEY_BACK_SLASH }, + { GLFW_KEY_RIGHT_BRACKET , EventKeyboard::KeyCode::KEY_RIGHT_BRACKET }, + { GLFW_KEY_GRAVE_ACCENT , EventKeyboard::KeyCode::KEY_GRAVE }, + { GLFW_KEY_WORLD_1 , EventKeyboard::KeyCode::KEY_GRAVE }, + { GLFW_KEY_WORLD_2 , EventKeyboard::KeyCode::KEY_NONE }, /* Function keys */ - { GLFW_KEY_ESCAPE , KeyboardEvent::KeyCode::KEY_ESCAPE }, - { GLFW_KEY_ENTER , KeyboardEvent::KeyCode::KEY_KP_ENTER }, - { GLFW_KEY_TAB , KeyboardEvent::KeyCode::KEY_TAB }, - { GLFW_KEY_BACKSPACE , KeyboardEvent::KeyCode::KEY_BACKSPACE }, - { GLFW_KEY_INSERT , KeyboardEvent::KeyCode::KEY_INSERT }, - { GLFW_KEY_DELETE , KeyboardEvent::KeyCode::KEY_DELETE }, - { GLFW_KEY_RIGHT , KeyboardEvent::KeyCode::KEY_RIGHT_ARROW }, - { GLFW_KEY_LEFT , KeyboardEvent::KeyCode::KEY_LEFT_ARROW }, - { GLFW_KEY_DOWN , KeyboardEvent::KeyCode::KEY_DOWN_ARROW }, - { GLFW_KEY_UP , KeyboardEvent::KeyCode::KEY_UP_ARROW }, - { GLFW_KEY_PAGE_UP , KeyboardEvent::KeyCode::KEY_KP_PG_UP }, - { GLFW_KEY_PAGE_DOWN , KeyboardEvent::KeyCode::KEY_KP_PG_DOWN }, - { GLFW_KEY_HOME , KeyboardEvent::KeyCode::KEY_KP_HOME }, - { GLFW_KEY_END , KeyboardEvent::KeyCode::KEY_END }, - { GLFW_KEY_CAPS_LOCK , KeyboardEvent::KeyCode::KEY_CAPS_LOCK }, - { GLFW_KEY_SCROLL_LOCK , KeyboardEvent::KeyCode::KEY_SCROLL_LOCK }, - { GLFW_KEY_NUM_LOCK , KeyboardEvent::KeyCode::KEY_NUM_LOCK }, - { GLFW_KEY_PRINT_SCREEN , KeyboardEvent::KeyCode::KEY_PRINT }, - { GLFW_KEY_PAUSE , KeyboardEvent::KeyCode::KEY_PAUSE }, - { GLFW_KEY_F1 , KeyboardEvent::KeyCode::KEY_F1 }, - { GLFW_KEY_F2 , KeyboardEvent::KeyCode::KEY_F2 }, - { GLFW_KEY_F3 , KeyboardEvent::KeyCode::KEY_F3 }, - { GLFW_KEY_F4 , KeyboardEvent::KeyCode::KEY_F4 }, - { GLFW_KEY_F5 , KeyboardEvent::KeyCode::KEY_F5 }, - { GLFW_KEY_F6 , KeyboardEvent::KeyCode::KEY_F6 }, - { GLFW_KEY_F7 , KeyboardEvent::KeyCode::KEY_F7 }, - { GLFW_KEY_F8 , KeyboardEvent::KeyCode::KEY_F8 }, - { GLFW_KEY_F9 , KeyboardEvent::KeyCode::KEY_F9 }, - { GLFW_KEY_F10 , KeyboardEvent::KeyCode::KEY_F10 }, - { GLFW_KEY_F11 , KeyboardEvent::KeyCode::KEY_F11 }, - { GLFW_KEY_F12 , KeyboardEvent::KeyCode::KEY_F12 }, - { GLFW_KEY_F13 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F14 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F15 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F16 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F17 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F18 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F19 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F20 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F21 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F22 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F23 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F24 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_F25 , KeyboardEvent::KeyCode::KEY_NONE }, - { GLFW_KEY_KP_0 , KeyboardEvent::KeyCode::KEY_0 }, - { GLFW_KEY_KP_1 , KeyboardEvent::KeyCode::KEY_1 }, - { GLFW_KEY_KP_2 , KeyboardEvent::KeyCode::KEY_2 }, - { GLFW_KEY_KP_3 , KeyboardEvent::KeyCode::KEY_3 }, - { GLFW_KEY_KP_4 , KeyboardEvent::KeyCode::KEY_4 }, - { GLFW_KEY_KP_5 , KeyboardEvent::KeyCode::KEY_5 }, - { GLFW_KEY_KP_6 , KeyboardEvent::KeyCode::KEY_6 }, - { GLFW_KEY_KP_7 , KeyboardEvent::KeyCode::KEY_7 }, - { GLFW_KEY_KP_8 , KeyboardEvent::KeyCode::KEY_8 }, - { GLFW_KEY_KP_9 , KeyboardEvent::KeyCode::KEY_9 }, - { GLFW_KEY_KP_DECIMAL , KeyboardEvent::KeyCode::KEY_PERIOD }, - { GLFW_KEY_KP_DIVIDE , KeyboardEvent::KeyCode::KEY_KP_DIVIDE }, - { GLFW_KEY_KP_MULTIPLY , KeyboardEvent::KeyCode::KEY_KP_MULTIPLY }, - { GLFW_KEY_KP_SUBTRACT , KeyboardEvent::KeyCode::KEY_KP_MINUS }, - { GLFW_KEY_KP_ADD , KeyboardEvent::KeyCode::KEY_KP_PLUS }, - { GLFW_KEY_KP_ENTER , KeyboardEvent::KeyCode::KEY_KP_ENTER }, - { GLFW_KEY_KP_EQUAL , KeyboardEvent::KeyCode::KEY_EQUAL }, - { GLFW_KEY_LEFT_SHIFT , KeyboardEvent::KeyCode::KEY_SHIFT }, - { GLFW_KEY_LEFT_CONTROL , KeyboardEvent::KeyCode::KEY_CTRL }, - { GLFW_KEY_LEFT_ALT , KeyboardEvent::KeyCode::KEY_ALT }, - { GLFW_KEY_LEFT_SUPER , KeyboardEvent::KeyCode::KEY_HYPER }, - { GLFW_KEY_RIGHT_SHIFT , KeyboardEvent::KeyCode::KEY_SHIFT }, - { GLFW_KEY_RIGHT_CONTROL , KeyboardEvent::KeyCode::KEY_CTRL }, - { GLFW_KEY_RIGHT_ALT , KeyboardEvent::KeyCode::KEY_ALT }, - { GLFW_KEY_RIGHT_SUPER , KeyboardEvent::KeyCode::KEY_HYPER }, - { GLFW_KEY_MENU , KeyboardEvent::KeyCode::KEY_MENU }, - { GLFW_KEY_LAST , KeyboardEvent::KeyCode::KEY_NONE } + { GLFW_KEY_ESCAPE , EventKeyboard::KeyCode::KEY_ESCAPE }, + { GLFW_KEY_ENTER , EventKeyboard::KeyCode::KEY_KP_ENTER }, + { GLFW_KEY_TAB , EventKeyboard::KeyCode::KEY_TAB }, + { GLFW_KEY_BACKSPACE , EventKeyboard::KeyCode::KEY_BACKSPACE }, + { GLFW_KEY_INSERT , EventKeyboard::KeyCode::KEY_INSERT }, + { GLFW_KEY_DELETE , EventKeyboard::KeyCode::KEY_DELETE }, + { GLFW_KEY_RIGHT , EventKeyboard::KeyCode::KEY_RIGHT_ARROW }, + { GLFW_KEY_LEFT , EventKeyboard::KeyCode::KEY_LEFT_ARROW }, + { GLFW_KEY_DOWN , EventKeyboard::KeyCode::KEY_DOWN_ARROW }, + { GLFW_KEY_UP , EventKeyboard::KeyCode::KEY_UP_ARROW }, + { GLFW_KEY_PAGE_UP , EventKeyboard::KeyCode::KEY_KP_PG_UP }, + { GLFW_KEY_PAGE_DOWN , EventKeyboard::KeyCode::KEY_KP_PG_DOWN }, + { GLFW_KEY_HOME , EventKeyboard::KeyCode::KEY_KP_HOME }, + { GLFW_KEY_END , EventKeyboard::KeyCode::KEY_END }, + { GLFW_KEY_CAPS_LOCK , EventKeyboard::KeyCode::KEY_CAPS_LOCK }, + { GLFW_KEY_SCROLL_LOCK , EventKeyboard::KeyCode::KEY_SCROLL_LOCK }, + { GLFW_KEY_NUM_LOCK , EventKeyboard::KeyCode::KEY_NUM_LOCK }, + { GLFW_KEY_PRINT_SCREEN , EventKeyboard::KeyCode::KEY_PRINT }, + { GLFW_KEY_PAUSE , EventKeyboard::KeyCode::KEY_PAUSE }, + { GLFW_KEY_F1 , EventKeyboard::KeyCode::KEY_F1 }, + { GLFW_KEY_F2 , EventKeyboard::KeyCode::KEY_F2 }, + { GLFW_KEY_F3 , EventKeyboard::KeyCode::KEY_F3 }, + { GLFW_KEY_F4 , EventKeyboard::KeyCode::KEY_F4 }, + { GLFW_KEY_F5 , EventKeyboard::KeyCode::KEY_F5 }, + { GLFW_KEY_F6 , EventKeyboard::KeyCode::KEY_F6 }, + { GLFW_KEY_F7 , EventKeyboard::KeyCode::KEY_F7 }, + { GLFW_KEY_F8 , EventKeyboard::KeyCode::KEY_F8 }, + { GLFW_KEY_F9 , EventKeyboard::KeyCode::KEY_F9 }, + { GLFW_KEY_F10 , EventKeyboard::KeyCode::KEY_F10 }, + { GLFW_KEY_F11 , EventKeyboard::KeyCode::KEY_F11 }, + { GLFW_KEY_F12 , EventKeyboard::KeyCode::KEY_F12 }, + { GLFW_KEY_F13 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F14 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F15 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F16 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F17 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F18 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F19 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F20 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F21 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F22 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F23 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F24 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_F25 , EventKeyboard::KeyCode::KEY_NONE }, + { GLFW_KEY_KP_0 , EventKeyboard::KeyCode::KEY_0 }, + { GLFW_KEY_KP_1 , EventKeyboard::KeyCode::KEY_1 }, + { GLFW_KEY_KP_2 , EventKeyboard::KeyCode::KEY_2 }, + { GLFW_KEY_KP_3 , EventKeyboard::KeyCode::KEY_3 }, + { GLFW_KEY_KP_4 , EventKeyboard::KeyCode::KEY_4 }, + { GLFW_KEY_KP_5 , EventKeyboard::KeyCode::KEY_5 }, + { GLFW_KEY_KP_6 , EventKeyboard::KeyCode::KEY_6 }, + { GLFW_KEY_KP_7 , EventKeyboard::KeyCode::KEY_7 }, + { GLFW_KEY_KP_8 , EventKeyboard::KeyCode::KEY_8 }, + { GLFW_KEY_KP_9 , EventKeyboard::KeyCode::KEY_9 }, + { GLFW_KEY_KP_DECIMAL , EventKeyboard::KeyCode::KEY_PERIOD }, + { GLFW_KEY_KP_DIVIDE , EventKeyboard::KeyCode::KEY_KP_DIVIDE }, + { GLFW_KEY_KP_MULTIPLY , EventKeyboard::KeyCode::KEY_KP_MULTIPLY }, + { GLFW_KEY_KP_SUBTRACT , EventKeyboard::KeyCode::KEY_KP_MINUS }, + { GLFW_KEY_KP_ADD , EventKeyboard::KeyCode::KEY_KP_PLUS }, + { GLFW_KEY_KP_ENTER , EventKeyboard::KeyCode::KEY_KP_ENTER }, + { GLFW_KEY_KP_EQUAL , EventKeyboard::KeyCode::KEY_EQUAL }, + { GLFW_KEY_LEFT_SHIFT , EventKeyboard::KeyCode::KEY_SHIFT }, + { GLFW_KEY_LEFT_CONTROL , EventKeyboard::KeyCode::KEY_CTRL }, + { GLFW_KEY_LEFT_ALT , EventKeyboard::KeyCode::KEY_ALT }, + { GLFW_KEY_LEFT_SUPER , EventKeyboard::KeyCode::KEY_HYPER }, + { GLFW_KEY_RIGHT_SHIFT , EventKeyboard::KeyCode::KEY_SHIFT }, + { GLFW_KEY_RIGHT_CONTROL , EventKeyboard::KeyCode::KEY_CTRL }, + { GLFW_KEY_RIGHT_ALT , EventKeyboard::KeyCode::KEY_ALT }, + { GLFW_KEY_RIGHT_SUPER , EventKeyboard::KeyCode::KEY_HYPER }, + { GLFW_KEY_MENU , EventKeyboard::KeyCode::KEY_MENU }, + { GLFW_KEY_LAST , EventKeyboard::KeyCode::KEY_NONE } }; #if(_MSC_VER >= 1600) // Visual Studio 2010 or higher version. @@ -340,7 +340,7 @@ void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x, void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods) { - KeyboardEvent event(g_keyCodeMap[key], GLFW_PRESS == action); + EventKeyboard event(g_keyCodeMap[key], GLFW_PRESS == action); EventDispatcher::getInstance()->dispatchEvent(&event); } diff --git a/cocos2dx/script_support/CCScriptSupport.h b/cocos2dx/script_support/CCScriptSupport.h index c84bd69462..4134b9470d 100644 --- a/cocos2dx/script_support/CCScriptSupport.h +++ b/cocos2dx/script_support/CCScriptSupport.h @@ -254,7 +254,7 @@ struct SchedulerScriptData struct TouchesScriptData { - TouchEvent::EventCode actionType; + EventTouch::EventCode actionType; void* nativeObject; const std::vector& touches; @@ -263,7 +263,7 @@ struct TouchesScriptData * @js NA * @lua NA */ - TouchesScriptData(TouchEvent::EventCode inActionType, void* inNativeObject, const std::vector& inTouches) + TouchesScriptData(EventTouch::EventCode inActionType, void* inNativeObject, const std::vector& inTouches) : actionType(inActionType), nativeObject(inNativeObject), touches(inTouches) @@ -273,7 +273,7 @@ struct TouchesScriptData struct TouchScriptData { - TouchEvent::EventCode actionType; + EventTouch::EventCode actionType; void* nativeObject; Touch* touch; @@ -282,7 +282,7 @@ struct TouchScriptData * @js NA * @lua NA */ - TouchScriptData(TouchEvent::EventCode inActionType, void* inNativeObject, Touch* inTouch) + TouchScriptData(EventTouch::EventCode inActionType, void* inNativeObject, Touch* inTouch) : actionType(inActionType), nativeObject(inNativeObject), touch(inTouch) @@ -292,7 +292,7 @@ struct TouchScriptData struct KeypadScriptData { - KeyboardEvent::KeyCode actionType; + EventKeyboard::KeyCode actionType; void* nativeObject; // Constructor @@ -300,7 +300,7 @@ struct KeypadScriptData * @js NA * @lua NA */ - KeypadScriptData(KeyboardEvent::KeyCode inActionType,void* inNativeObject) + KeypadScriptData(EventKeyboard::KeyCode inActionType,void* inNativeObject) : actionType(inActionType),nativeObject(inNativeObject) { } diff --git a/extensions/CocoStudio/Components/CCInputDelegate.cpp b/extensions/CocoStudio/Components/CCInputDelegate.cpp index 658b2101c8..84694e0619 100644 --- a/extensions/CocoStudio/Components/CCInputDelegate.cpp +++ b/extensions/CocoStudio/Components/CCInputDelegate.cpp @@ -110,7 +110,7 @@ void InputDelegate::setTouchEnabled(bool enabled) { if( _touchMode == Touch::DispatchMode::ALL_AT_ONCE ) { // Register Touch Event - auto listener = TouchEventListener::create(Touch::DispatchMode::ALL_AT_ONCE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ALL_AT_ONCE); listener->onTouchesBegan = CC_CALLBACK_2(InputDelegate::onTouchesBegan, this); listener->onTouchesMoved = CC_CALLBACK_2(InputDelegate::onTouchesMoved, this); @@ -121,7 +121,7 @@ void InputDelegate::setTouchEnabled(bool enabled) _touchListener = listener; } else { // Register Touch Event - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->setSwallowTouches(true); listener->onTouchBegan = CC_CALLBACK_2(InputDelegate::onTouchBegan, this); @@ -195,7 +195,7 @@ void InputDelegate::setAccelerometerEnabled(bool enabled) if (enabled) { - auto listener = AccelerationEventListener::create(CC_CALLBACK_2(InputDelegate::onAcceleration, this)); + auto listener = EventListenerAcceleration::create(CC_CALLBACK_2(InputDelegate::onAcceleration, this)); dispatcher->addEventListenerWithFixedPriority(listener, -1); _accelerometerListener = listener; } @@ -217,7 +217,7 @@ void InputDelegate::setKeypadEnabled(bool enabled) if (enabled) { - auto listener = KeyboardEventListener::create(); + auto listener = EventListenerKeyboard::create(); listener->onKeyPressed = CC_CALLBACK_2(InputDelegate::onKeyPressed, this); listener->onKeyReleased = CC_CALLBACK_2(InputDelegate::onKeyReleased, this); diff --git a/extensions/CocoStudio/Components/CCInputDelegate.h b/extensions/CocoStudio/Components/CCInputDelegate.h index ec6744df55..94bff421ce 100644 --- a/extensions/CocoStudio/Components/CCInputDelegate.h +++ b/extensions/CocoStudio/Components/CCInputDelegate.h @@ -110,8 +110,8 @@ public: virtual void onAcceleration(Acceleration* acc, Event* event) {}; - virtual void onKeyPressed(KeyboardEvent::KeyCode keyCode, Event* event) {}; - virtual void onKeyReleased(KeyboardEvent::KeyCode keyCode, Event* event) {}; + virtual void onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event) {}; + virtual void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event) {}; virtual bool onTouchBegan(Touch *touch, Event *event); virtual void onTouchMoved(Touch *touch, Event *event); diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index 2dd6724765..95b9c48c51 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -112,7 +112,7 @@ bool ScrollView::initWithViewSize(Size size, Node *container/* = NULL*/) setTouchEnabled(true); setTouchMode(Touch::DispatchMode::ONE_BY_ONE); - _touches.reserve(TouchEvent::MAX_TOUCHES); + _touches.reserve(EventTouch::MAX_TOUCHES); _delegate = NULL; _bounceable = true; diff --git a/samples/Cpp/TestCpp/Classes/Box2DTestBed/Box2dView.cpp b/samples/Cpp/TestCpp/Classes/Box2DTestBed/Box2dView.cpp index d99f5e6f3c..4c958bebaa 100644 --- a/samples/Cpp/TestCpp/Classes/Box2DTestBed/Box2dView.cpp +++ b/samples/Cpp/TestCpp/Classes/Box2DTestBed/Box2dView.cpp @@ -85,7 +85,7 @@ bool MenuLayer::initWithEntryID(int entryId) EventDispatcher::getInstance()->removeEventListener(_touchListener); // Adds touch event listener - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->setSwallowTouches(true); listener->onTouchBegan = CC_CALLBACK_2(MenuLayer::onTouchBegan, this); @@ -192,7 +192,7 @@ bool Box2DView::initWithEntryID(int entryId) EventDispatcher::getInstance()->removeEventListener(_touchListener); // Adds Touch Event Listener - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->setSwallowTouches(true); listener->onTouchBegan = CC_CALLBACK_2(Box2DView::onTouchBegan, this); diff --git a/samples/Cpp/TestCpp/Classes/CocosDenshionTest/CocosDenshionTest.cpp b/samples/Cpp/TestCpp/Classes/CocosDenshionTest/CocosDenshionTest.cpp index 0fb59b1b89..f4ff8718a3 100644 --- a/samples/Cpp/TestCpp/Classes/CocosDenshionTest/CocosDenshionTest.cpp +++ b/samples/Cpp/TestCpp/Classes/CocosDenshionTest/CocosDenshionTest.cpp @@ -65,7 +65,7 @@ private: // Director::getInstance()->getTouchDispatcher()->addTargetedDelegate(this, 100, true); // Register Touch Event - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->setSwallowTouches(true); listener->onTouchBegan = CC_CALLBACK_2(Button::onTouchBegan, this); diff --git a/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.cpp b/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.cpp index 53c1d8248b..9e2fd40647 100644 --- a/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.cpp +++ b/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.cpp @@ -22,12 +22,12 @@ KeyboardTest::~KeyboardTest() _label->release(); } -void KeyboardTest::onKeyPressed(KeyboardEvent::KeyCode keyCode, Event* event) +void KeyboardTest::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event) { log("Key with keycode %d pressed", keyCode); } -void KeyboardTest::onKeyReleased(KeyboardEvent::KeyCode keyCode, Event* event) +void KeyboardTest::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event) { log("Key with keycode %d released", keyCode); } diff --git a/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.h b/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.h index d3db8eb9d1..e4e0f303e9 100644 --- a/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.h +++ b/samples/Cpp/TestCpp/Classes/KeyboardTest/KeyboardTest.h @@ -10,8 +10,8 @@ public: KeyboardTest(); ~KeyboardTest(); - virtual void onKeyPressed(KeyboardEvent::KeyCode keyCode, Event* event); - virtual void onKeyReleased(KeyboardEvent::KeyCode keyCode, Event* event); + virtual void onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event); + virtual void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event); private: LabelTTF* _label; diff --git a/samples/Cpp/TestCpp/Classes/KeypadTest/KeypadTest.cpp b/samples/Cpp/TestCpp/Classes/KeypadTest/KeypadTest.cpp index 3878a2f81b..7cdbebbc6e 100644 --- a/samples/Cpp/TestCpp/Classes/KeypadTest/KeypadTest.cpp +++ b/samples/Cpp/TestCpp/Classes/KeypadTest/KeypadTest.cpp @@ -22,13 +22,13 @@ KeypadTest::~KeypadTest() _label->release(); } -void KeypadTest::onKeyReleased(KeyboardEvent::KeyCode keycode, Event* event) +void KeypadTest::onKeyReleased(EventKeyboard::KeyCode keycode, Event* event) { - if (keycode == KeyboardEvent::KeyCode::KEY_BACKSPACE) + if (keycode == EventKeyboard::KeyCode::KEY_BACKSPACE) { _label->setString("BACK clicked!"); } - else if (keycode == KeyboardEvent::KeyCode::KEY_MENU) + else if (keycode == EventKeyboard::KeyCode::KEY_MENU) { _label->setString("MENU clicked!"); } diff --git a/samples/Cpp/TestCpp/Classes/KeypadTest/KeypadTest.h b/samples/Cpp/TestCpp/Classes/KeypadTest/KeypadTest.h index 541731046d..760ab8eb01 100644 --- a/samples/Cpp/TestCpp/Classes/KeypadTest/KeypadTest.h +++ b/samples/Cpp/TestCpp/Classes/KeypadTest/KeypadTest.h @@ -10,7 +10,7 @@ public: KeypadTest(); ~KeypadTest(); - virtual void onKeyReleased(KeyboardEvent::KeyCode keycode, Event* event) override; + virtual void onKeyReleased(EventKeyboard::KeyCode keycode, Event* event) override; private: LabelTTF* _label; diff --git a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp index 27b5554097..8a5809ee6b 100644 --- a/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp +++ b/samples/Cpp/TestCpp/Classes/MenuTest/MenuTest.cpp @@ -575,7 +575,7 @@ RemoveMenuItemWhenMove::RemoveMenuItemWhenMove() setTouchMode(Touch::DispatchMode::ONE_BY_ONE); // Register Touch Event - _touchListener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + _touchListener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); _touchListener->setSwallowTouches(false); _touchListener->onTouchBegan = CC_CALLBACK_2(RemoveMenuItemWhenMove::onTouchBegan, this); diff --git a/samples/Cpp/TestCpp/Classes/MutiTouchTest/MutiTouchTest.cpp b/samples/Cpp/TestCpp/Classes/MutiTouchTest/MutiTouchTest.cpp index 76caec059c..9ef9656951 100644 --- a/samples/Cpp/TestCpp/Classes/MutiTouchTest/MutiTouchTest.cpp +++ b/samples/Cpp/TestCpp/Classes/MutiTouchTest/MutiTouchTest.cpp @@ -1,7 +1,7 @@ #include "MutiTouchTest.h" -static const Color3B* s_TouchColors[TouchEvent::MAX_TOUCHES] = { +static const Color3B* s_TouchColors[EventTouch::MAX_TOUCHES] = { &Color3B::YELLOW, &Color3B::BLUE, &Color3B::GREEN, diff --git a/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp b/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp index a7be59f089..60a2f909a9 100644 --- a/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -141,7 +141,7 @@ void TouchableSpriteTest::onEnter() sprite2->addChild(sprite3, 1); // Make sprite1 touchable - auto listener1 = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener1 = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener1->setSwallowTouches(true); listener1->onTouchBegan = [](Touch* touch, Event* event){ @@ -188,7 +188,7 @@ void TouchableSpriteTest::onEnter() auto senderItem = static_cast(sender); senderItem->setString("Only Next item could be clicked"); - EventDispatcher::getInstance()->removeListenersForEventType(TouchEvent::EVENT_TYPE); + EventDispatcher::getInstance()->removeListenersForEventType(EventTouch::EVENT_TYPE); auto nextItem = MenuItemFont::create("Next", [=](Object* sender){ nextCallback(nullptr); @@ -243,7 +243,7 @@ public: auto dispatcher = EventDispatcher::getInstance(); - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->setSwallowTouches(true); listener->onTouchBegan = [=](Touch* touch, Event* event){ @@ -348,7 +348,7 @@ void RemoveListenerWhenDispatching::onEnter() addChild(sprite1, 10); // Make sprite1 touchable - auto listener1 = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener1 = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener1->setSwallowTouches(true); setUserObject(listener1); @@ -426,7 +426,7 @@ void CustomEventTest::onEnter() statusLabel->setPosition(origin + Point(size.width/2, size.height-90)); addChild(statusLabel); - _listener = CustomEventListener::create("game_custom_event", [=](CustomEvent* event){ + _listener = EventListenerCustom::create("game_custom_event", [=](EventCustom* event){ std::string str("Custom event received, "); char* buf = static_cast(event->getUserData()); str += buf; @@ -442,7 +442,7 @@ void CustomEventTest::onEnter() ++count; char* buf = new char[10]; sprintf(buf, "%d", count); - CustomEvent event("game_custom_event"); + EventCustom event("game_custom_event"); event.setUserData(buf); dispatcher->dispatchEvent(&event); }); @@ -483,15 +483,15 @@ void LabelKeyboardEventTest::onEnter() statusLabel->setPosition(origin + Point(size.width/2, size.height/2)); addChild(statusLabel); - auto listener = KeyboardEventListener::create(); - listener->onKeyPressed = [](KeyboardEvent::KeyCode keyCode, Event* event){ + auto listener = EventListenerKeyboard::create(); + listener->onKeyPressed = [](EventKeyboard::KeyCode keyCode, Event* event){ char buf[100] = {0}; sprintf(buf, "Key %d was pressed!", (int)keyCode); auto label = static_cast(event->getCurrentTarget()); label->setString(buf); }; - listener->onKeyReleased = [](KeyboardEvent::KeyCode keyCode, Event* event){ + listener->onKeyReleased = [](EventKeyboard::KeyCode keyCode, Event* event){ char buf[100] = {0}; sprintf(buf, "Key %d was released!", (int)keyCode); auto label = static_cast(event->getCurrentTarget()); @@ -533,7 +533,7 @@ _pos = _max; \ sprite->setPosition(origin + Point(size.width/2, size.height/2)); addChild(sprite); - auto listener = AccelerationEventListener::create([=](Acceleration* acc, Event* event){ + auto listener = EventListenerAcceleration::create([=](Acceleration* acc, Event* event){ auto ballSize = sprite->getContentSize(); auto ptNow = sprite->getPosition(); diff --git a/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.h b/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.h index 3677fdff96..2f5c186438 100644 --- a/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.h +++ b/samples/Cpp/TestCpp/Classes/NewEventDispatcherTest/NewEventDispatcherTest.h @@ -63,7 +63,7 @@ public: virtual std::string title() override; virtual std::string subtitle() override; private: - CustomEventListener* _listener; + EventListenerCustom* _listener; }; class LabelKeyboardEventTest : public EventDispatcherTestDemo diff --git a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceTouchesTest.cpp b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceTouchesTest.cpp index 4fe99f2323..60c5341463 100644 --- a/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceTouchesTest.cpp +++ b/samples/Cpp/TestCpp/Classes/PerformanceTest/PerformanceTouchesTest.cpp @@ -243,15 +243,15 @@ void TouchesPerformTest3::onEnter() CC_PROFILER_PURGE_ALL(); std::vector touches; - for (int i = 0; i < TouchEvent::MAX_TOUCHES; ++i) + for (int i = 0; i < EventTouch::MAX_TOUCHES; ++i) { Touch* touch = new Touch(); touch->setTouchInfo(i, 10, (i+1) * 10); touches.push_back(touch); } - TouchEvent event; - event.setEventCode(TouchEvent::EventCode::BEGAN); + EventTouch event; + event.setEventCode(EventTouch::EventCode::BEGAN); event.setTouches(touches); auto dispatcher = EventDispatcher::getInstance(); diff --git a/samples/Cpp/TestCpp/Classes/TextInputTest/TextInputTest.cpp b/samples/Cpp/TestCpp/Classes/TextInputTest/TextInputTest.cpp index ff0aadb032..3392a3e9f8 100644 --- a/samples/Cpp/TestCpp/Classes/TextInputTest/TextInputTest.cpp +++ b/samples/Cpp/TestCpp/Classes/TextInputTest/TextInputTest.cpp @@ -129,7 +129,7 @@ KeyboardNotificationLayer::KeyboardNotificationLayer() setTouchEnabled(true); // Register Touch Event - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->onTouchBegan = CC_CALLBACK_2(KeyboardNotificationLayer::onTouchBegan, this); listener->onTouchEnded = CC_CALLBACK_2(KeyboardNotificationLayer::onTouchEnded, this); diff --git a/samples/Cpp/TestCpp/Classes/TouchesTest/Paddle.cpp b/samples/Cpp/TestCpp/Classes/TouchesTest/Paddle.cpp index c576147f45..2e3720d10c 100644 --- a/samples/Cpp/TestCpp/Classes/TouchesTest/Paddle.cpp +++ b/samples/Cpp/TestCpp/Classes/TouchesTest/Paddle.cpp @@ -38,7 +38,7 @@ void Paddle::onEnter() Sprite::onEnter(); // Register Touch Event - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->setSwallowTouches(true); listener->onTouchBegan = CC_CALLBACK_2(Paddle::onTouchBegan, this); diff --git a/samples/Cpp/TestCpp/Classes/controller.cpp b/samples/Cpp/TestCpp/Classes/controller.cpp index fc2b73c985..f78fb2c9af 100644 --- a/samples/Cpp/TestCpp/Classes/controller.cpp +++ b/samples/Cpp/TestCpp/Classes/controller.cpp @@ -125,7 +125,7 @@ TestController::TestController() addChild(menu, 1); // Register Touch Event - auto listener = TouchEventListener::create(Touch::DispatchMode::ONE_BY_ONE); + auto listener = EventListenerTouch::create(Touch::DispatchMode::ONE_BY_ONE); listener->setSwallowTouches(true); listener->onTouchBegan = CC_CALLBACK_2(TestController::onTouchBegan, this); From 2549804dec28b23d18a2bb181613cacb9ea5b419 Mon Sep 17 00:00:00 2001 From: minggo Date: Fri, 20 Sep 2013 20:09:39 +0800 Subject: [PATCH 2/2] fix compiling errors --- .../javascript/bindings/ScriptingCore.cpp | 36 +++++++++---------- scripting/javascript/bindings/ScriptingCore.h | 6 ++-- .../cocos2d_specifics.cpp.REMOVED.git-id | 2 +- .../javascript/bindings/cocos2d_specifics.hpp | 2 +- .../lua/cocos2dx_support/CCLuaEngine.cpp | 22 ++++++------ 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/scripting/javascript/bindings/ScriptingCore.cpp b/scripting/javascript/bindings/ScriptingCore.cpp index 9b51d0b503..3a6f4aa4ae 100644 --- a/scripting/javascript/bindings/ScriptingCore.cpp +++ b/scripting/javascript/bindings/ScriptingCore.cpp @@ -106,38 +106,38 @@ static void executeJSFunctionFromReservedSpot(JSContext *cx, JSObject *obj, } } -static void getTouchesFuncName(TouchEvent::EventCode eventCode, std::string &funcName) +static void getTouchesFuncName(EventTouch::EventCode eventCode, std::string &funcName) { switch(eventCode) { - case TouchEvent::EventCode::BEGAN: + case EventTouch::EventCode::BEGAN: funcName = "onTouchesBegan"; break; - case TouchEvent::EventCode::ENDED: + case EventTouch::EventCode::ENDED: funcName = "onTouchesEnded"; break; - case TouchEvent::EventCode::MOVED: + case EventTouch::EventCode::MOVED: funcName = "onTouchesMoved"; break; - case TouchEvent::EventCode::CANCELLED: + case EventTouch::EventCode::CANCELLED: funcName = "onTouchesCancelled"; break; } } -static void getTouchFuncName(TouchEvent::EventCode eventCode, std::string &funcName) +static void getTouchFuncName(EventTouch::EventCode eventCode, std::string &funcName) { switch(eventCode) { - case TouchEvent::EventCode::BEGAN: + case EventTouch::EventCode::BEGAN: funcName = "onTouchBegan"; break; - case TouchEvent::EventCode::ENDED: + case EventTouch::EventCode::ENDED: funcName = "onTouchEnded"; break; - case TouchEvent::EventCode::MOVED: + case EventTouch::EventCode::MOVED: funcName = "onTouchMoved"; break; - case TouchEvent::EventCode::CANCELLED: + case EventTouch::EventCode::CANCELLED: funcName = "onTouchCancelled"; break; } @@ -839,7 +839,7 @@ int ScriptingCore::handleTouchesEvent(void* data) return 0; Layer* pLayer = static_cast(touchesScriptData->nativeObject); - TouchEvent::EventCode eventType = touchesScriptData->actionType; + EventTouch::EventCode eventType = touchesScriptData->actionType; const std::vector& touches = touchesScriptData->touches; std::string funcName = ""; @@ -884,7 +884,7 @@ int ScriptingCore::handleTouchEvent(void* data) return 0; Layer* pLayer = static_cast(touchScriptData->nativeObject); - TouchEvent::EventCode eventType = touchScriptData->actionType; + EventTouch::EventCode eventType = touchScriptData->actionType; Touch *pTouch = touchScriptData->touch; @@ -980,7 +980,7 @@ int ScriptingCore::handleKeypadEvent(void* data) if (NULL == keypadScriptData->nativeObject) return 0; - KeyboardEvent::KeyCode action = keypadScriptData->actionType; + EventKeyboard::KeyCode action = keypadScriptData->actionType; js_proxy_t * p = jsb_get_native_proxy(keypadScriptData->nativeObject); @@ -989,7 +989,7 @@ int ScriptingCore::handleKeypadEvent(void* data) JSBool ret = JS_FALSE; switch(action) { - case KeyboardEvent::KeyCode::KEY_BACKSPACE: + case EventKeyboard::KeyCode::KEY_BACKSPACE: ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "onBackClicked"); if (!ret) { @@ -1000,7 +1000,7 @@ int ScriptingCore::handleKeypadEvent(void* data) } } break; - case KeyboardEvent::KeyCode::KEY_MENU: + case EventKeyboard::KeyCode::KEY_MENU: ret = executeFunctionWithOwner(OBJECT_TO_JSVAL(p->obj), "onMenuClicked"); if (!ret) { @@ -1021,7 +1021,7 @@ int ScriptingCore::handleKeypadEvent(void* data) } -int ScriptingCore::executeCustomTouchesEvent(TouchEvent::EventCode eventType, +int ScriptingCore::executeCustomTouchesEvent(EventTouch::EventCode eventType, const std::vector& touches, JSObject *obj) { jsval retval; @@ -1055,7 +1055,7 @@ int ScriptingCore::executeCustomTouchesEvent(TouchEvent::EventCode eventType, } -int ScriptingCore::executeCustomTouchEvent(TouchEvent::EventCode eventType, +int ScriptingCore::executeCustomTouchEvent(EventTouch::EventCode eventType, Touch *pTouch, JSObject *obj) { jsval retval; @@ -1074,7 +1074,7 @@ int ScriptingCore::executeCustomTouchEvent(TouchEvent::EventCode eventType, } -int ScriptingCore::executeCustomTouchEvent(TouchEvent::EventCode eventType, +int ScriptingCore::executeCustomTouchEvent(EventTouch::EventCode eventType, Touch *pTouch, JSObject *obj, jsval &retval) { diff --git a/scripting/javascript/bindings/ScriptingCore.h b/scripting/javascript/bindings/ScriptingCore.h index a6ce6c5348..f7b8cb29e1 100644 --- a/scripting/javascript/bindings/ScriptingCore.h +++ b/scripting/javascript/bindings/ScriptingCore.h @@ -140,11 +140,11 @@ public: static void removeAllRoots(JSContext *cx); - int executeCustomTouchEvent(TouchEvent::EventCode eventType, + int executeCustomTouchEvent(EventTouch::EventCode eventType, Touch *pTouch, JSObject *obj, jsval &retval); - int executeCustomTouchEvent(TouchEvent::EventCode eventType, + int executeCustomTouchEvent(EventTouch::EventCode eventType, Touch *pTouch, JSObject *obj); - int executeCustomTouchesEvent(TouchEvent::EventCode eventType, + int executeCustomTouchesEvent(EventTouch::EventCode eventType, const std::vector& touches, JSObject *obj); /** * @return the global context diff --git a/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id b/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id index ec646e0263..ec4aa352c7 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id +++ b/scripting/javascript/bindings/cocos2d_specifics.cpp.REMOVED.git-id @@ -1 +1 @@ -7756f6d4cf4b992057e4f9b619a10021af30cd11 \ No newline at end of file +b88df18e2512b5111debda3991f51c2e72a2e5da \ No newline at end of file diff --git a/scripting/javascript/bindings/cocos2d_specifics.hpp b/scripting/javascript/bindings/cocos2d_specifics.hpp index 72b452a73e..1072cc8064 100644 --- a/scripting/javascript/bindings/cocos2d_specifics.hpp +++ b/scripting/javascript/bindings/cocos2d_specifics.hpp @@ -218,7 +218,7 @@ private: typedef std::pair TouchDelegatePair; static TouchDelegateMap sTouchDelegateMap; bool _needUnroot; - TouchEventListener* _touchListener; + EventListenerTouch* _touchListener; }; diff --git a/scripting/lua/cocos2dx_support/CCLuaEngine.cpp b/scripting/lua/cocos2dx_support/CCLuaEngine.cpp index ea380dcd76..21ded3f9b9 100644 --- a/scripting/lua/cocos2dx_support/CCLuaEngine.cpp +++ b/scripting/lua/cocos2dx_support/CCLuaEngine.cpp @@ -400,14 +400,14 @@ int LuaEngine::handleKeypadEvent(void* data) if (0 == handler) return 0; - KeyboardEvent::KeyCode action = keypadScriptData->actionType; + EventKeyboard::KeyCode action = keypadScriptData->actionType; switch(action) { - case KeyboardEvent::KeyCode::KEY_BACKSPACE: + case EventKeyboard::KeyCode::KEY_BACKSPACE: _stack->pushString("backClicked"); break; - case KeyboardEvent::KeyCode::KEY_MENU: + case EventKeyboard::KeyCode::KEY_MENU: _stack->pushString("menuClicked"); break; default: @@ -484,19 +484,19 @@ int LuaEngine::handleTouchEvent(void* data) switch (touchScriptData->actionType) { - case TouchEvent::EventCode::BEGAN: + case EventTouch::EventCode::BEGAN: _stack->pushString("began"); break; - case TouchEvent::EventCode::MOVED: + case EventTouch::EventCode::MOVED: _stack->pushString("moved"); break; - case TouchEvent::EventCode::ENDED: + case EventTouch::EventCode::ENDED: _stack->pushString("ended"); break; - case TouchEvent::EventCode::CANCELLED: + case EventTouch::EventCode::CANCELLED: _stack->pushString("cancelled"); break; @@ -533,19 +533,19 @@ int LuaEngine::handleTouchesEvent(void* data) switch (touchesScriptData->actionType) { - case TouchEvent::EventCode::BEGAN: + case EventTouch::EventCode::BEGAN: _stack->pushString("began"); break; - case TouchEvent::EventCode::MOVED: + case EventTouch::EventCode::MOVED: _stack->pushString("moved"); break; - case TouchEvent::EventCode::ENDED: + case EventTouch::EventCode::ENDED: _stack->pushString("ended"); break; - case TouchEvent::EventCode::CANCELLED: + case EventTouch::EventCode::CANCELLED: _stack->pushString("cancelled"); break;