summaryrefslogtreecommitdiffstatshomepage
path: root/3rdparty/bgfx/examples/common/entry
diff options
context:
space:
mode:
author Miodrag Milanovic <mmicko@gmail.com>2016-08-06 14:20:16 +0200
committer Miodrag Milanovic <mmicko@gmail.com>2016-08-06 14:20:16 +0200
commit3917850b6197950e5671f4d3b9cb0b9c921b798d (patch)
tree503b9690868a7c238ba10d73b5c6bece7ca8c338 /3rdparty/bgfx/examples/common/entry
parent057474989c1a92e9e935dbc8cb9d233ba3a4ea3a (diff)
Update BX and BGFX (nw)
Diffstat (limited to '3rdparty/bgfx/examples/common/entry')
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry.cpp18
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_android.cpp52
-rw-r--r--3rdparty/bgfx/examples/common/entry/entry_ios.mm2
3 files changed, 28 insertions, 44 deletions
diff --git a/3rdparty/bgfx/examples/common/entry/entry.cpp b/3rdparty/bgfx/examples/common/entry/entry.cpp
index 0e03876a17e..a72b8027864 100644
--- a/3rdparty/bgfx/examples/common/entry/entry.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry.cpp
@@ -473,11 +473,8 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const MouseEvent* mouse = static_cast<const MouseEvent*>(ev);
handle = mouse->m_handle;
- if (mouse->m_move)
- {
- inputSetMousePos(mouse->m_mx, mouse->m_my, mouse->m_mz);
- }
- else
+ inputSetMousePos(mouse->m_mx, mouse->m_my, mouse->m_mz);
+ if (!mouse->m_move)
{
inputSetMouseButtonState(mouse->m_button, mouse->m_down);
}
@@ -485,13 +482,10 @@ BX_PRAGMA_DIAGNOSTIC_POP();
if (NULL != _mouse
&& !mouseLock)
{
- if (mouse->m_move)
- {
- _mouse->m_mx = mouse->m_mx;
- _mouse->m_my = mouse->m_my;
- _mouse->m_mz = mouse->m_mz;
- }
- else
+ _mouse->m_mx = mouse->m_mx;
+ _mouse->m_my = mouse->m_my;
+ _mouse->m_mz = mouse->m_mz;
+ if (!mouse->m_move)
{
_mouse->m_buttons[mouse->m_button] = mouse->m_down;
}
diff --git a/3rdparty/bgfx/examples/common/entry/entry_android.cpp b/3rdparty/bgfx/examples/common/entry/entry_android.cpp
index 78c9dccbefa..90bfd131368 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_android.cpp
+++ b/3rdparty/bgfx/examples/common/entry/entry_android.cpp
@@ -82,7 +82,6 @@ namespace entry
{
Context()
: m_window(NULL)
- , m_count(0)
{
memset(m_value, 0, sizeof(m_value) );
@@ -297,43 +296,35 @@ namespace entry
int32_t action = (actionBits & AMOTION_EVENT_ACTION_MASK);
int32_t index = (actionBits & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT;
- count = m_count;
-
- switch (action)
- {
- case AMOTION_EVENT_ACTION_DOWN:
- case AMOTION_EVENT_ACTION_POINTER_DOWN:
- m_count++;
- break;
-
- case AMOTION_EVENT_ACTION_UP:
- case AMOTION_EVENT_ACTION_POINTER_UP:
- m_count--;
- break;
-
- default:
- break;
- }
-
- if (count != m_count)
+ // Simulate left mouse click with 1st touch and right mouse click with 2nd touch. ignore other touchs
+ if (count < 2)
{
- m_eventQueue.postMouseEvent(defaultWindow
- , (int32_t)mx
- , (int32_t)my
- , 0
- , 1 == count ? MouseButton::Left : MouseButton::Right
- , false
- );
-
- if (0 != m_count)
+ switch (action)
{
+ case AMOTION_EVENT_ACTION_DOWN:
+ case AMOTION_EVENT_ACTION_POINTER_DOWN:
m_eventQueue.postMouseEvent(defaultWindow
, (int32_t)mx
, (int32_t)my
, 0
- , 1 == m_count ? MouseButton::Left : MouseButton::Right
+ , action == AMOTION_EVENT_ACTION_DOWN ? MouseButton::Left : MouseButton::Right
, true
);
+ break;
+
+ case AMOTION_EVENT_ACTION_UP:
+ case AMOTION_EVENT_ACTION_POINTER_UP:
+ m_eventQueue.postMouseEvent(defaultWindow
+ , (int32_t)mx
+ , (int32_t)my
+ , 0
+ , action == AMOTION_EVENT_ACTION_UP ? MouseButton::Left : MouseButton::Right
+ , false
+ );
+ break;
+
+ default:
+ break;
}
}
@@ -405,7 +396,6 @@ namespace entry
ANativeWindow* m_window;
android_app* m_app;
- int32_t m_count;
int32_t m_value[GamepadAxis::Count];
int32_t m_deadzone[GamepadAxis::Count];
};
diff --git a/3rdparty/bgfx/examples/common/entry/entry_ios.mm b/3rdparty/bgfx/examples/common/entry/entry_ios.mm
index 052c161abd4..a5348212ef0 100644
--- a/3rdparty/bgfx/examples/common/entry/entry_ios.mm
+++ b/3rdparty/bgfx/examples/common/entry/entry_ios.mm
@@ -312,7 +312,7 @@ static void* m_device = NULL;
[m_window makeKeyAndVisible];
- //float scaleFactor = [[UIScreen mainScreen] scale]; // should use this, but ui is too small on ipad retina
+ //float scaleFactor = [[UIScreen mainScreen] scale]; // should use this, but needs to further pass the value to the `nvgBeginFrame()` call's `devicePixelRatio` parameter in `ExampleNanoVG` class' `update()` method so it can actually work properly.
float scaleFactor = 1.0f;
[m_view setContentScaleFactor: scaleFactor ];