mirror of https://github.com/axmolengine/axmol.git
Merge pull request #3720 from minggo/rename-class-name
rename some class names to obey cocos2d-x coding style
This commit is contained in:
commit
919d88db4a
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<void(Acceleration*, Event* event)> callback)
|
||||
EventListenerAcceleration* EventListenerAcceleration::create(std::function<void(Acceleration*, Event* event)> 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<void(
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool AccelerationEventListener::init(std::function<void(Acceleration*, Event* event)> callback)
|
||||
bool EventListenerAcceleration::init(std::function<void(Acceleration*, Event* event)> callback)
|
||||
{
|
||||
auto listener = [this](Event* event){
|
||||
auto accEvent = static_cast<AccelerationEvent*>(event);
|
||||
auto accEvent = static_cast<EventAcceleration*>(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::function<void(Acceleration*, Event* ev
|
|||
return false;
|
||||
}
|
||||
|
||||
AccelerationEventListener* AccelerationEventListener::clone()
|
||||
EventListenerAcceleration* EventListenerAcceleration::clone()
|
||||
{
|
||||
auto ret = new AccelerationEventListener();
|
||||
auto ret = new EventListenerAcceleration();
|
||||
|
||||
if (ret && ret->init(onAccelerationEvent))
|
||||
{
|
||||
|
@ -84,7 +84,7 @@ AccelerationEventListener* AccelerationEventListener::clone()
|
|||
return ret;
|
||||
}
|
||||
|
||||
bool AccelerationEventListener::checkAvaiable()
|
||||
bool EventListenerAcceleration::checkAvaiable()
|
||||
{
|
||||
CCASSERT(onAccelerationEvent, "");
|
||||
|
||||
|
|
|
@ -30,17 +30,17 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class AccelerationEventListener : public EventListener
|
||||
class EventListenerAcceleration : public EventListener
|
||||
{
|
||||
public:
|
||||
static AccelerationEventListener* create(std::function<void(Acceleration*, Event* event)> callback);
|
||||
~AccelerationEventListener();
|
||||
static EventListenerAcceleration* create(std::function<void(Acceleration*, Event* event)> callback);
|
||||
virtual ~EventListenerAcceleration();
|
||||
|
||||
/// Overrides
|
||||
virtual AccelerationEventListener* clone() override;
|
||||
virtual EventListenerAcceleration* clone() override;
|
||||
virtual bool checkAvaiable() override;
|
||||
private:
|
||||
AccelerationEventListener();
|
||||
EventListenerAcceleration();
|
||||
|
||||
bool init(std::function<void(Acceleration*, Event* event)> callback);
|
||||
std::function<void(Acceleration*, Event*)> onAccelerationEvent;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
CustomEvent::CustomEvent(const std::string& eventName)
|
||||
EventCustom::EventCustom(const std::string& eventName)
|
||||
: Event(eventName)
|
||||
, _userData(nullptr)
|
||||
{
|
||||
|
|
|
@ -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; };
|
||||
|
|
|
@ -27,14 +27,14 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
CustomEventListener::CustomEventListener()
|
||||
EventListenerCustom::EventListenerCustom()
|
||||
: _onCustomEvent(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
CustomEventListener* CustomEventListener::create(const std::string& eventName, std::function<void(CustomEvent*)> callback)
|
||||
EventListenerCustom* EventListenerCustom::create(const std::string& eventName, std::function<void(EventCustom*)> 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::function<void(CustomEvent*)>callback)
|
||||
bool EventListenerCustom::init(const std::string& eventName, std::function<void(EventCustom*)>callback)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
|
@ -55,7 +55,7 @@ bool CustomEventListener::init(const std::string& eventName, std::function<void(
|
|||
auto listener = [this](Event* event){
|
||||
if (_onCustomEvent != nullptr)
|
||||
{
|
||||
_onCustomEvent(static_cast<CustomEvent*>(event));
|
||||
_onCustomEvent(static_cast<EventCustom*>(event));
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -66,9 +66,9 @@ bool CustomEventListener::init(const std::string& eventName, std::function<void(
|
|||
return ret;
|
||||
}
|
||||
|
||||
CustomEventListener* CustomEventListener::clone()
|
||||
EventListenerCustom* EventListenerCustom::clone()
|
||||
{
|
||||
CustomEventListener* ret = new CustomEventListener();
|
||||
EventListenerCustom* ret = new EventListenerCustom();
|
||||
if (ret && ret->init(_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)
|
||||
|
|
|
@ -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<void(CustomEvent*)> callback);
|
||||
static EventListenerCustom* create(const std::string& eventName, std::function<void(EventCustom*)> 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<void(CustomEvent*)> callback);
|
||||
bool init(const std::string& eventName, std::function<void(EventCustom*)> callback);
|
||||
|
||||
std::function<void(CustomEvent*)> _onCustomEvent;
|
||||
std::function<void(EventCustom*)> _onCustomEvent;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -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<TouchEvent*>(event));
|
||||
dispatchTouchEvent(static_cast<EventTouch*>(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<EventDispatcher::EventListenerItem*> allInOnelisteners;
|
||||
allInOnelisteners.reserve(touchListeners->size());
|
||||
|
||||
TouchEventListener* touchEventListener = nullptr;
|
||||
EventListenerTouch* touchEventListener = nullptr;
|
||||
|
||||
std::for_each(touchListeners->begin(), touchListeners->end(), [&](EventListenerItem*& item){
|
||||
|
||||
touchEventListener = static_cast<TouchEventListener*>(item->listener);
|
||||
touchEventListener = static_cast<EventListenerTouch*>(item->listener);
|
||||
|
||||
if (touchEventListener->_dispatchMode == Touch::DispatchMode::ONE_BY_ONE)
|
||||
{
|
||||
|
@ -353,10 +353,10 @@ void EventDispatcher::dispatchTouchEvent(TouchEvent* event)
|
|||
bool isClaimed = false;
|
||||
std::vector<Touch*>::iterator removedIter;
|
||||
|
||||
auto touchEventListener = static_cast<TouchEventListener*>(item->listener);
|
||||
TouchEvent::EventCode eventCode = event->getEventCode();
|
||||
auto touchEventListenerTouch = static_cast<EventListener*>(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<TouchEventListener*>(item->listener);
|
||||
auto touchEventListener = static_cast<EventListenerTouch*>(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);
|
||||
|
|
|
@ -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<EventListenerItem*>* getListenerItemsForType(const std::string& eventType);
|
||||
|
|
|
@ -27,6 +27,6 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
const char* KeyboardEvent::EVENT_TYPE = "KeyboardEvent";
|
||||
const char* EventKeyboard::EVENT_TYPE = "KeyboardEvent";
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<KeyboardEvent*>(event);
|
||||
auto keyboardEvent = static_cast<EventKeyboard*>(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;
|
||||
}
|
||||
|
|
|
@ -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<void(KeyboardEvent::KeyCode, Event* event)> onKeyPressed;
|
||||
std::function<void(KeyboardEvent::KeyCode, Event* event)> onKeyReleased;
|
||||
std::function<void(EventKeyboard::KeyCode, Event* event)> onKeyPressed;
|
||||
std::function<void(EventKeyboard::KeyCode, Event* event)> onKeyReleased;
|
||||
private:
|
||||
KeyboardEventListener();
|
||||
EventListenerKeyboard();
|
||||
bool init();
|
||||
};
|
||||
|
||||
|
|
|
@ -26,6 +26,6 @@
|
|||
|
||||
NS_CC_BEGIN
|
||||
|
||||
const char* TouchEvent::EVENT_TYPE = "TouchEvent";
|
||||
const char* EventTouch::EVENT_TYPE = "TouchEvent";
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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<Touch*>& touches)
|
||||
int Layer::executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& 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<Touch*>& 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<Touch*>& 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<Touch*>& 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<Touch*>& pTouches, Event *pEven
|
|||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
executeScriptTouchesHandler(TouchEvent::EventCode::CANCELLED, pTouches);
|
||||
executeScriptTouchesHandler(EventTouch::EventCode::CANCELLED, pTouches);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -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<Touch*>& touches);
|
||||
int executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch);
|
||||
int executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& touches);
|
||||
};
|
||||
|
||||
#ifdef __apple__
|
||||
|
|
|
@ -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<int, int> 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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -95,7 +95,7 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher;
|
|||
break;
|
||||
}
|
||||
|
||||
cocos2d::AccelerationEvent event(*_acceleration);
|
||||
cocos2d::EventAcceleration event(*_acceleration);
|
||||
cocos2d::EventDispatcher::getInstance()->dispatchEvent(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,134 +18,134 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
|
||||
static std::map<int, KeyboardEvent::KeyCode> g_keyCodeMap = {
|
||||
static std::map<int, EventKeyboard::KeyCode> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,134 +33,134 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
|
||||
static std::map<int, KeyboardEvent::KeyCode> g_keyCodeMap = {
|
||||
static std::map<int, EventKeyboard::KeyCode> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -38,140 +38,140 @@ NS_CC_BEGIN
|
|||
struct keyCodeItem
|
||||
{
|
||||
int glfwKeyCode;
|
||||
KeyboardEvent::KeyCode keyCode;
|
||||
EventKeyboard::KeyCode keyCode;
|
||||
};
|
||||
|
||||
static std::map<int, KeyboardEvent::KeyCode> g_keyCodeMap;
|
||||
static std::map<int, EventKeyboard::KeyCode> 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);
|
||||
}
|
||||
|
||||
|
|
|
@ -254,7 +254,7 @@ struct SchedulerScriptData
|
|||
|
||||
struct TouchesScriptData
|
||||
{
|
||||
TouchEvent::EventCode actionType;
|
||||
EventTouch::EventCode actionType;
|
||||
void* nativeObject;
|
||||
const std::vector<Touch*>& touches;
|
||||
|
||||
|
@ -263,7 +263,7 @@ struct TouchesScriptData
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
TouchesScriptData(TouchEvent::EventCode inActionType, void* inNativeObject, const std::vector<Touch*>& inTouches)
|
||||
TouchesScriptData(EventTouch::EventCode inActionType, void* inNativeObject, const std::vector<Touch*>& 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)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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!");
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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<MenuItemFont*>(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<char*>(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<LabelTTF*>(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<LabelTTF*>(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();
|
||||
|
|
|
@ -63,7 +63,7 @@ public:
|
|||
virtual std::string title() override;
|
||||
virtual std::string subtitle() override;
|
||||
private:
|
||||
CustomEventListener* _listener;
|
||||
EventListenerCustom* _listener;
|
||||
};
|
||||
|
||||
class LabelKeyboardEventTest : public EventDispatcherTestDemo
|
||||
|
|
|
@ -243,15 +243,15 @@ void TouchesPerformTest3::onEnter()
|
|||
CC_PROFILER_PURGE_ALL();
|
||||
|
||||
std::vector<Touch*> 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();
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<Layer*>(touchesScriptData->nativeObject);
|
||||
TouchEvent::EventCode eventType = touchesScriptData->actionType;
|
||||
EventTouch::EventCode eventType = touchesScriptData->actionType;
|
||||
const std::vector<Touch*>& touches = touchesScriptData->touches;
|
||||
|
||||
std::string funcName = "";
|
||||
|
@ -884,7 +884,7 @@ int ScriptingCore::handleTouchEvent(void* data)
|
|||
return 0;
|
||||
|
||||
Layer* pLayer = static_cast<Layer*>(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<Touch*>& 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)
|
||||
{
|
||||
|
|
|
@ -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<Touch*>& touches, JSObject *obj);
|
||||
/**
|
||||
* @return the global context
|
||||
|
|
|
@ -1 +1 @@
|
|||
7756f6d4cf4b992057e4f9b619a10021af30cd11
|
||||
b88df18e2512b5111debda3991f51c2e72a2e5da
|
|
@ -218,7 +218,7 @@ private:
|
|||
typedef std::pair<JSObject*, JSTouchDelegate*> TouchDelegatePair;
|
||||
static TouchDelegateMap sTouchDelegateMap;
|
||||
bool _needUnroot;
|
||||
TouchEventListener* _touchListener;
|
||||
EventListenerTouch* _touchListener;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
Loading…
Reference in New Issue