mirror of
https://github.com/scratchfoundation/bgfx.git
synced 2024-11-28 10:35:43 -05:00
imgui: Added handling middle mouse button.
This commit is contained in:
parent
06624bb7c2
commit
4018a4b690
13 changed files with 37 additions and 24 deletions
|
@ -298,8 +298,9 @@ class HDR : public entry::AppI
|
||||||
|
|
||||||
imguiBeginFrame(m_mouseState.m_mx
|
imguiBeginFrame(m_mouseState.m_mx
|
||||||
, m_mouseState.m_my
|
, m_mouseState.m_my
|
||||||
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, m_mouseState.m_mz
|
, m_mouseState.m_mz
|
||||||
, m_width
|
, m_width
|
||||||
, m_height
|
, m_height
|
||||||
|
|
|
@ -130,8 +130,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
{
|
{
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, mouseState.m_mz
|
, mouseState.m_mz
|
||||||
, width
|
, width
|
||||||
, height
|
, height
|
||||||
|
|
|
@ -117,8 +117,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
{
|
{
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, mouseState.m_mz
|
, mouseState.m_mz
|
||||||
, width
|
, width
|
||||||
, height
|
, height
|
||||||
|
|
|
@ -942,8 +942,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
{
|
{
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, mouseState.m_mz
|
, mouseState.m_mz
|
||||||
, viewState.m_width
|
, viewState.m_width
|
||||||
, viewState.m_height
|
, viewState.m_height
|
||||||
|
|
|
@ -2129,8 +2129,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
|
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, mouseState.m_mz
|
, mouseState.m_mz
|
||||||
, viewState.m_width
|
, viewState.m_width
|
||||||
, viewState.m_height
|
, viewState.m_height
|
||||||
|
|
|
@ -1971,8 +1971,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
// Imgui.
|
// Imgui.
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, mouseState.m_mz
|
, mouseState.m_mz
|
||||||
, viewState.m_width
|
, viewState.m_width
|
||||||
, viewState.m_height
|
, viewState.m_height
|
||||||
|
|
|
@ -209,8 +209,9 @@ class DrawStress : public entry::AppI
|
||||||
|
|
||||||
imguiBeginFrame(m_mouseState.m_mx
|
imguiBeginFrame(m_mouseState.m_mx
|
||||||
, m_mouseState.m_my
|
, m_mouseState.m_my
|
||||||
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, m_mouseState.m_mz
|
, m_mouseState.m_mz
|
||||||
, m_width
|
, m_width
|
||||||
, m_height
|
, m_height
|
||||||
|
|
|
@ -309,8 +309,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
{
|
{
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, mouseState.m_mz
|
, mouseState.m_mz
|
||||||
, width
|
, width
|
||||||
, height
|
, height
|
||||||
|
|
|
@ -242,8 +242,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
|
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, mouseState.m_mz
|
, mouseState.m_mz
|
||||||
, width
|
, width
|
||||||
, height
|
, height
|
||||||
|
|
|
@ -452,8 +452,9 @@ class Deferred : public entry::AppI
|
||||||
|
|
||||||
imguiBeginFrame(m_mouseState.m_mx
|
imguiBeginFrame(m_mouseState.m_mx
|
||||||
, m_mouseState.m_my
|
, m_mouseState.m_my
|
||||||
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (m_mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (m_mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (m_mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, m_mouseState.m_mz
|
, m_mouseState.m_mz
|
||||||
, m_width
|
, m_width
|
||||||
, m_height
|
, m_height
|
||||||
|
|
|
@ -219,8 +219,9 @@ int _main_(int /*_argc*/, char** /*_argv*/)
|
||||||
|
|
||||||
imguiBeginFrame(mouseState.m_mx
|
imguiBeginFrame(mouseState.m_mx
|
||||||
, mouseState.m_my
|
, mouseState.m_my
|
||||||
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
, (mouseState.m_buttons[entry::MouseButton::Left ] ? IMGUI_MBUT_LEFT : 0)
|
||||||
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
| (mouseState.m_buttons[entry::MouseButton::Right ] ? IMGUI_MBUT_RIGHT : 0)
|
||||||
|
| (mouseState.m_buttons[entry::MouseButton::Middle] ? IMGUI_MBUT_MIDDLE : 0)
|
||||||
, mouseState.m_mz
|
, mouseState.m_mz
|
||||||
, width
|
, width
|
||||||
, height
|
, height
|
||||||
|
|
|
@ -29,8 +29,9 @@
|
||||||
#include <bgfx.h>
|
#include <bgfx.h>
|
||||||
#include <ocornut-imgui/imgui.h>
|
#include <ocornut-imgui/imgui.h>
|
||||||
|
|
||||||
#define IMGUI_MBUT_LEFT 0x01
|
#define IMGUI_MBUT_LEFT 0x01
|
||||||
#define IMGUI_MBUT_RIGHT 0x02
|
#define IMGUI_MBUT_RIGHT 0x02
|
||||||
|
#define IMGUI_MBUT_MIDDLE 0x04
|
||||||
|
|
||||||
/// For custom values, define these macros before including imgui.h
|
/// For custom values, define these macros before including imgui.h
|
||||||
|
|
||||||
|
|
|
@ -235,6 +235,7 @@ struct OcornutImguiContext
|
||||||
io.MousePos = ImVec2( (float)_mx, (float)_my);
|
io.MousePos = ImVec2( (float)_mx, (float)_my);
|
||||||
io.MouseDown[0] = 0 != (_button & IMGUI_MBUT_LEFT);
|
io.MouseDown[0] = 0 != (_button & IMGUI_MBUT_LEFT);
|
||||||
io.MouseDown[1] = 0 != (_button & IMGUI_MBUT_RIGHT);
|
io.MouseDown[1] = 0 != (_button & IMGUI_MBUT_RIGHT);
|
||||||
|
io.MouseDown[2] = 0 != (_button & IMGUI_MBUT_MIDDLE);
|
||||||
io.MouseWheel = (float)(_scroll - m_lastScroll);
|
io.MouseWheel = (float)(_scroll - m_lastScroll);
|
||||||
m_lastScroll = _scroll;
|
m_lastScroll = _scroll;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue