mirror of https://github.com/axmolengine/axmol.git
issue #2087: Updating the constructor of XXXEvent.
This commit is contained in:
parent
6f53dcb49f
commit
e697b0fc0b
|
@ -28,8 +28,10 @@ NS_CC_BEGIN
|
|||
|
||||
const char* AccelerationEvent::EVENT_TYPE = "AccelerometerEvent";
|
||||
|
||||
AccelerationEvent::AccelerationEvent()
|
||||
AccelerationEvent::AccelerationEvent(Acceleration acc)
|
||||
: Event(EVENT_TYPE)
|
||||
{}
|
||||
, _acc(acc)
|
||||
{
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -35,8 +35,10 @@ class AccelerationEvent : public Event
|
|||
public:
|
||||
static const char* EVENT_TYPE;
|
||||
|
||||
AccelerationEvent();
|
||||
Acceleration acc;
|
||||
AccelerationEvent(Acceleration acc);
|
||||
|
||||
private:
|
||||
Acceleration _acc;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -198,7 +198,13 @@ public:
|
|||
|
||||
static const char* EVENT_TYPE;
|
||||
|
||||
KeyboardEvent() : Event(EVENT_TYPE) {};
|
||||
KeyboardEvent(KeyCode keyCode, bool isPressed)
|
||||
: Event(EVENT_TYPE)
|
||||
, _keyCode(keyCode)
|
||||
, _isPressed(isPressed)
|
||||
{};
|
||||
|
||||
private:
|
||||
KeyCode _keyCode;
|
||||
bool _isPressed;
|
||||
};
|
||||
|
|
|
@ -400,17 +400,13 @@ static int32_t handle_key_input(AInputEvent *event)
|
|||
{
|
||||
case AKEYCODE_BACK:
|
||||
{
|
||||
cocos2d::KeyboardEvent event;
|
||||
event._keyCode = cocos2d::KeyboardEvent::KeyCode::KEY_BACKSPACE;
|
||||
event._isPressed = false;
|
||||
cocos2d::KeyboardEvent event(cocos2d::KeyboardEvent::KeyCode::KEY_BACKSPACE, false);
|
||||
cocos2d::EventDispatcher::getInstance()->dispatchEvent(&event);
|
||||
}
|
||||
return 1;
|
||||
case AKEYCODE_MENU:
|
||||
{
|
||||
cocos2d::KeyboardEvent event;
|
||||
event._keyCode = cocos2d::KeyboardEvent::KeyCode::KEY_MENU;
|
||||
event._isPressed = false;
|
||||
cocos2d::KeyboardEvent event(cocos2d::KeyboardEvent::KeyCode::KEY_MENU, false);
|
||||
cocos2d::EventDispatcher::getInstance()->dispatchEvent(&event);
|
||||
}
|
||||
return 1;
|
||||
|
@ -601,21 +597,24 @@ void android_main(struct android_app* state) {
|
|||
// ACONFIGURATION_ORIENTATION_ANY
|
||||
// ACONFIGURATION_ORIENTATION_PORT
|
||||
// ACONFIGURATION_ORIENTATION_SQUARE
|
||||
cocos2d::AccelerationEvent accEvent;
|
||||
accEvent.acc.x = event.acceleration.x;
|
||||
accEvent.acc.y = event.acceleration.y;
|
||||
accEvent.acc.z = event.acceleration.z;
|
||||
accEvent.acc.timestamp = 0;
|
||||
cocos2d::Acceleration acc;
|
||||
acc.x = event.acceleration.x;
|
||||
acc.y = event.acceleration.y;
|
||||
acc.z = event.acceleration.z;
|
||||
acc.timestamp = 0;
|
||||
cocos2d::AccelerationEvent accEvent(acc);
|
||||
|
||||
cocos2d::EventDispatcher::getInstance()->dispatchEvent(&accEvent);
|
||||
} else {
|
||||
// ACONFIGURATION_ORIENTATION_LAND
|
||||
// swap x and y parameters
|
||||
cocos2d::Acceleration acc;
|
||||
acc.x = -event.acceleration.y;
|
||||
acc.y = event.acceleration.x;
|
||||
acc.z = event.acceleration.z;
|
||||
acc.timestamp = 0;
|
||||
cocos2d::AccelerationEvent accEvent(acc);
|
||||
|
||||
cocos2d::AccelerationEvent accEvent;
|
||||
accEvent.acc.x = -event.acceleration.y;
|
||||
accEvent.acc.y = event.acceleration.x;
|
||||
accEvent.acc.z = event.acceleration.z;
|
||||
accEvent.acc.timestamp = 0;
|
||||
cocos2d::EventDispatcher::getInstance()->dispatchEvent(&accEvent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -95,8 +95,7 @@ static CCAccelerometerDispatcher* s_pAccelerometerDispatcher;
|
|||
break;
|
||||
}
|
||||
|
||||
cocos2d::AccelerationEvent event;
|
||||
event.acc = *_acceleration;
|
||||
cocos2d::AccelerationEvent event(*_acceleration);
|
||||
cocos2d::EventDispatcher::getInstance()->dispatchEvent(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -222,9 +222,7 @@ void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x,
|
|||
|
||||
void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
KeyboardEvent event;
|
||||
event._keyCode = g_keyCodeMap[key];
|
||||
event._isPressed = (GLFW_PRESS == action);
|
||||
KeyboardEvent event(g_keyCodeMap[key], GLFW_PRESS == action);
|
||||
EventDispatcher::getInstance()->dispatchEvent(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -238,9 +238,7 @@ void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x,
|
|||
|
||||
void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
KeyboardEvent event;
|
||||
event._keyCode = g_keyCodeMap[key];
|
||||
event._isPressed = (GLFW_PRESS == action);
|
||||
KeyboardEvent event(g_keyCodeMap[key], GLFW_PRESS == action);
|
||||
EventDispatcher::getInstance()->dispatchEvent(&event);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@ THE SOFTWARE.
|
|||
#include "CCDirector.h"
|
||||
#include "text_input_node/CCIMEDispatcher.h"
|
||||
#include "CCApplication.h"
|
||||
#include "event_dispatcher/CCTouch.h"
|
||||
#include "event_dispatcher/CCEventDispatcher.h"
|
||||
#include "event_dispatcher/CCTouch.h"
|
||||
#include "event_dispatcher/CCEventDispatcher.h"
|
||||
#include "event_dispatcher/CCKeyboardEvent.h"
|
||||
|
||||
|
||||
|
@ -41,137 +41,137 @@ struct keyCodeItem
|
|||
KeyboardEvent::KeyCode keyCode;
|
||||
};
|
||||
|
||||
static std::map<int, KeyboardEvent::KeyCode> g_keyCodeMap;
|
||||
|
||||
static keyCodeItem g_keyCodeStructArray[] = {
|
||||
/* The unknown key */
|
||||
{ GLFW_KEY_UNKNOWN , KeyboardEvent::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 },
|
||||
|
||||
/* 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 }
|
||||
static std::map<int, KeyboardEvent::KeyCode> g_keyCodeMap;
|
||||
|
||||
static keyCodeItem g_keyCodeStructArray[] = {
|
||||
/* The unknown key */
|
||||
{ GLFW_KEY_UNKNOWN , KeyboardEvent::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 },
|
||||
|
||||
/* 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 }
|
||||
};
|
||||
|
||||
#if(_MSC_VER >= 1600) // Visual Studio 2010 or higher version.
|
||||
|
@ -340,9 +340,7 @@ void EGLViewEventHandler::OnGLFWMouseMoveCallBack(GLFWwindow* window, double x,
|
|||
|
||||
void EGLViewEventHandler::OnGLFWKeyCallback(GLFWwindow *window, int key, int scancode, int action, int mods)
|
||||
{
|
||||
KeyboardEvent event;
|
||||
event._keyCode = g_keyCodeMap[key];
|
||||
event._isPressed = (GLFW_PRESS == action);
|
||||
KeyboardEvent event(g_keyCodeMap[key], GLFW_PRESS == action);
|
||||
EventDispatcher::getInstance()->dispatchEvent(&event);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue