Skip to content

Commit 12cebe5

Browse files
author
Pavel Kovalenko
committed
Fix ingame cursor position in windowed mode.
1 parent ac222fe commit 12cebe5

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/xrEngine/IInputReceiver.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
class ENGINE_API IInputReceiver
1010
{
1111
public:
12-
void IR_GetLastMouseDelta (Ivector2& p);
13-
void IR_GetMousePosScreen (Ivector2& p);
14-
void IR_GetMousePosReal (HWND hwnd, Ivector2 &p);
15-
void IR_GetMousePosReal (Ivector2 &p);
16-
void IR_GetMousePosIndependent (Fvector2 &f);
17-
void IR_GetMousePosIndependentCrop (Fvector2 &f);
12+
static void IR_GetLastMouseDelta (Ivector2& p);
13+
static void IR_GetMousePosScreen (Ivector2& p);
14+
static void IR_GetMousePosReal (HWND hwnd, Ivector2 &p);
15+
static void IR_GetMousePosReal (Ivector2 &p);
16+
static void IR_GetMousePosIndependent (Fvector2 &f);
17+
static void IR_GetMousePosIndependentCrop (Fvector2 &f);
1818
BOOL IR_GetKeyState (int dik);
1919
BOOL IR_GetBtnState (int btn);
2020
void IR_Capture (void);

src/xrGame/UICursor.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
#include "ui/UIStatic.h"
55
#include "ui/UIBtnHint.h"
6-
6+
#include "xrEngine/IInputReceiver.h"
77

88
#define C_DEFAULT D3DCOLOR_XRGB(0xff,0xff,0xff)
99

@@ -97,11 +97,10 @@ void CUICursor::UpdateCursorPosition(int _dx, int _dy)
9797
{
9898
Fvector2 p;
9999
vPrevPos = vPos;
100-
if(m_b_use_win_cursor)
100+
if (m_b_use_win_cursor)
101101
{
102-
POINT pti;
103-
BOOL r = GetCursorPos(&pti);
104-
if(!r) return;
102+
Ivector2 pti;
103+
IInputReceiver::IR_GetMousePosReal(pti);
105104
p.x = (float)pti.x;
106105
p.y = (float)pti.y;
107106
vPos.x = p.x * (UI_BASE_WIDTH/(float)Device.dwWidth);
@@ -122,6 +121,7 @@ void CUICursor::SetUICursorPosition(Fvector2 pos)
122121
POINT p;
123122
p.x = iFloor(vPos.x / (UI_BASE_WIDTH/(float)Device.dwWidth));
124123
p.y = iFloor(vPos.y / (UI_BASE_HEIGHT/(float)Device.dwHeight));
125-
126-
SetCursorPos(p.x, p.y);
124+
if (m_b_use_win_cursor)
125+
ClientToScreen(Device.m_hWnd, (LPPOINT)&p);
126+
SetCursorPos(p.x, p.y);
127127
}

0 commit comments

Comments
 (0)