|
@@ -276,7 +276,7 @@ namespace entry
|
|
|
static void joystickCb(int _jid, int _action);
|
|
static void joystickCb(int _jid, int _action);
|
|
|
|
|
|
|
|
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
|
// Based on cutef8 by Jeff Bezanson (Public Domain)
|
|
|
- static uint8_t encodeUTF8(uint8_t _chars[4], unsigned int _scancode)
|
|
|
|
|
|
|
+ static uint8_t encodeUTF8(uint8_t _chars[4], uint32_t _scancode)
|
|
|
{
|
|
{
|
|
|
uint8_t length = 0;
|
|
uint8_t length = 0;
|
|
|
|
|
|
|
@@ -432,6 +432,7 @@ namespace entry
|
|
|
glfwSetCursorPosCallback(m_windows[0], cursorPosCb);
|
|
glfwSetCursorPosCallback(m_windows[0], cursorPosCb);
|
|
|
glfwSetMouseButtonCallback(m_windows[0], mouseButtonCb);
|
|
glfwSetMouseButtonCallback(m_windows[0], mouseButtonCb);
|
|
|
glfwSetWindowSizeCallback(m_windows[0], windowSizeCb);
|
|
glfwSetWindowSizeCallback(m_windows[0], windowSizeCb);
|
|
|
|
|
+ glfwSetDropCallback(m_windows[0], dropFileCb);
|
|
|
|
|
|
|
|
glfwSetWindow(m_windows[0]);
|
|
glfwSetWindow(m_windows[0]);
|
|
|
m_eventQueue.postSizeEvent(handle, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT);
|
|
m_eventQueue.postSizeEvent(handle, ENTRY_DEFAULT_WIDTH, ENTRY_DEFAULT_HEIGHT);
|
|
@@ -491,6 +492,7 @@ namespace entry
|
|
|
glfwSetCursorPosCallback(window, cursorPosCb);
|
|
glfwSetCursorPosCallback(window, cursorPosCb);
|
|
|
glfwSetMouseButtonCallback(window, mouseButtonCb);
|
|
glfwSetMouseButtonCallback(window, mouseButtonCb);
|
|
|
glfwSetWindowSizeCallback(window, windowSizeCb);
|
|
glfwSetWindowSizeCallback(window, windowSizeCb);
|
|
|
|
|
+ glfwSetDropCallback(window, dropFileCb);
|
|
|
|
|
|
|
|
m_windows[msg->m_handle.idx] = window;
|
|
m_windows[msg->m_handle.idx] = window;
|
|
|
m_eventQueue.postSizeEvent(msg->m_handle, msg->m_width, msg->m_height);
|
|
m_eventQueue.postSizeEvent(msg->m_handle, msg->m_width, msg->m_height);
|
|
@@ -619,12 +621,13 @@ namespace entry
|
|
|
return invalid;
|
|
return invalid;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- static void keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods);
|
|
|
|
|
- static void charCb(GLFWwindow* _window, unsigned int _scancode);
|
|
|
|
|
|
|
+ static void keyCb(GLFWwindow* _window, int32_t _key, int32_t _scancode, int32_t _action, int32_t _mods);
|
|
|
|
|
+ static void charCb(GLFWwindow* _window, uint32_t _scancode);
|
|
|
static void scrollCb(GLFWwindow* _window, double _dx, double _dy);
|
|
static void scrollCb(GLFWwindow* _window, double _dx, double _dy);
|
|
|
static void cursorPosCb(GLFWwindow* _window, double _mx, double _my);
|
|
static void cursorPosCb(GLFWwindow* _window, double _mx, double _my);
|
|
|
- static void mouseButtonCb(GLFWwindow* _window, int _button, int _action, int _mods);
|
|
|
|
|
- static void windowSizeCb(GLFWwindow* _window, int _width, int _height);
|
|
|
|
|
|
|
+ static void mouseButtonCb(GLFWwindow* _window, int32_t _button, int32_t _action, int32_t _mods);
|
|
|
|
|
+ static void windowSizeCb(GLFWwindow* _window, int32_t _width, int32_t _height);
|
|
|
|
|
+ static void dropFileCb(GLFWwindow* _window, int32_t _count, const char** _filePaths);
|
|
|
|
|
|
|
|
MainThreadEntry m_mte;
|
|
MainThreadEntry m_mte;
|
|
|
bx::Thread m_thread;
|
|
bx::Thread m_thread;
|
|
@@ -649,7 +652,7 @@ namespace entry
|
|
|
|
|
|
|
|
Context s_ctx;
|
|
Context s_ctx;
|
|
|
|
|
|
|
|
- void Context::keyCb(GLFWwindow* _window, int _key, int _scancode, int _action, int _mods)
|
|
|
|
|
|
|
+ void Context::keyCb(GLFWwindow* _window, int32_t _key, int32_t _scancode, int32_t _action, int32_t _mods)
|
|
|
{
|
|
{
|
|
|
BX_UNUSED(_scancode);
|
|
BX_UNUSED(_scancode);
|
|
|
if (_key == GLFW_KEY_UNKNOWN)
|
|
if (_key == GLFW_KEY_UNKNOWN)
|
|
@@ -663,7 +666,7 @@ namespace entry
|
|
|
s_ctx.m_eventQueue.postKeyEvent(handle, key, mods, down);
|
|
s_ctx.m_eventQueue.postKeyEvent(handle, key, mods, down);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void Context::charCb(GLFWwindow* _window, unsigned int _scancode)
|
|
|
|
|
|
|
+ void Context::charCb(GLFWwindow* _window, uint32_t _scancode)
|
|
|
{
|
|
{
|
|
|
WindowHandle handle = s_ctx.findHandle(_window);
|
|
WindowHandle handle = s_ctx.findHandle(_window);
|
|
|
uint8_t chars[4];
|
|
uint8_t chars[4];
|
|
@@ -700,7 +703,7 @@ namespace entry
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void Context::mouseButtonCb(GLFWwindow* _window, int _button, int _action, int _mods)
|
|
|
|
|
|
|
+ void Context::mouseButtonCb(GLFWwindow* _window, int32_t _button, int32_t _action, int32_t _mods)
|
|
|
{
|
|
{
|
|
|
BX_UNUSED(_mods);
|
|
BX_UNUSED(_mods);
|
|
|
WindowHandle handle = s_ctx.findHandle(_window);
|
|
WindowHandle handle = s_ctx.findHandle(_window);
|
|
@@ -716,12 +719,21 @@ namespace entry
|
|
|
);
|
|
);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- void Context::windowSizeCb(GLFWwindow* _window, int _width, int _height)
|
|
|
|
|
|
|
+ void Context::windowSizeCb(GLFWwindow* _window, int32_t _width, int32_t _height)
|
|
|
{
|
|
{
|
|
|
WindowHandle handle = s_ctx.findHandle(_window);
|
|
WindowHandle handle = s_ctx.findHandle(_window);
|
|
|
s_ctx.m_eventQueue.postSizeEvent(handle, _width, _height);
|
|
s_ctx.m_eventQueue.postSizeEvent(handle, _width, _height);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ void Context::dropFileCb(GLFWwindow* _window, int32_t _count, const char** _filePaths)
|
|
|
|
|
+ {
|
|
|
|
|
+ WindowHandle handle = s_ctx.findHandle(_window);
|
|
|
|
|
+ for (int32_t ii = 0; ii < _count; ++ii)
|
|
|
|
|
+ {
|
|
|
|
|
+ s_ctx.m_eventQueue.postDropFileEvent(handle, _filePaths[ii]);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
static void joystickCb(int _jid, int _action)
|
|
static void joystickCb(int _jid, int _action)
|
|
|
{
|
|
{
|
|
|
if (_jid >= ENTRY_CONFIG_MAX_GAMEPADS)
|
|
if (_jid >= ENTRY_CONFIG_MAX_GAMEPADS)
|