mouse input improvement

This commit is contained in:
Turanszki Janos
2020-04-18 12:52:54 +01:00
parent a0690701aa
commit fde1db540f
5 changed files with 22 additions and 6 deletions
+4 -4
View File
@@ -242,12 +242,15 @@ namespace wiInput
switch (button)
{
case wiInput::MOUSE_BUTTON_LEFT:
if (mouse.left_button_press) return true;
keycode = VK_LBUTTON;
break;
case wiInput::MOUSE_BUTTON_RIGHT:
if (mouse.right_button_press) return true;
keycode = VK_RBUTTON;
break;
case wiInput::MOUSE_BUTTON_MIDDLE:
if (mouse.middle_button_press) return true;
keycode = VK_MBUTTON;
break;
case wiInput::KEYBOARD_BUTTON_UP:
@@ -383,14 +386,11 @@ namespace wiInput
}
XMFLOAT4 GetPointer()
{
MouseState state;
wiRawInput::GetMouseState(&state);
#ifndef WINSTORE_SUPPORT
POINT p;
GetCursorPos(&p);
ScreenToClient(wiPlatform::GetWindow(), &p);
return XMFLOAT4((float)p.x, (float)p.y, state.delta_wheel, 0);
return XMFLOAT4((float)p.x, (float)p.y, mouse.delta_wheel, 0);
#else
auto& p = Windows::UI::Core::CoreWindow::GetForCurrentThread()->PointerPosition;
return XMFLOAT4(p.X, p.Y, 0, 0);
+3
View File
@@ -86,6 +86,9 @@ namespace wiInput
XMINT2 position = XMINT2(0, 0);
XMINT2 delta_position = XMINT2(0, 0);
float delta_wheel = 0;
bool left_button_press = false;
bool middle_button_press = false;
bool right_button_press = false;
};
struct ControllerState
{
+1 -1
View File
@@ -234,7 +234,7 @@ namespace wiProfiler
fx.pos.y = (float)font.params.posY;
fx.siz.x = (float)font.textWidth();
fx.siz.y = (float)font.textHeight();
fx.color = wiColor(40, 40, 40, 140);
fx.color = wiColor(20, 20, 20, 230);
wiImage::Draw(wiTextureHelper::getWhite(), fx, cmd);
font.Draw(cmd);
+13
View File
@@ -111,6 +111,19 @@ namespace wiRawInput
mouse.position.x += rawmouse.lLastX;
mouse.position.y += rawmouse.lLastY;
}
if (rawmouse.usButtonFlags == RI_MOUSE_LEFT_BUTTON_DOWN)
{
mouse.left_button_press = true;
}
if (rawmouse.usButtonFlags == RI_MOUSE_MIDDLE_BUTTON_DOWN)
{
mouse.middle_button_press = true;
}
if (rawmouse.usButtonFlags == RI_MOUSE_RIGHT_BUTTON_DOWN)
{
mouse.right_button_press = true;
}
}
else if (raw.header.dwType == RIM_TYPEHID)
{
+1 -1
View File
@@ -9,7 +9,7 @@ namespace wiVersion
// minor features, major updates
const int minor = 39;
// minor bug fixes, alterations, refactors, updates
const int revision = 67;
const int revision = 68;
long GetVersion()