Skip to content

Commit

Permalink
Fix ingame cursor position in windowed mode.
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Kovalenko committed Oct 1, 2014
1 parent ac222fe commit 12cebe5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
12 changes: 6 additions & 6 deletions src/xrEngine/IInputReceiver.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
class ENGINE_API IInputReceiver
{
public:
void IR_GetLastMouseDelta (Ivector2& p);
void IR_GetMousePosScreen (Ivector2& p);
void IR_GetMousePosReal (HWND hwnd, Ivector2 &p);
void IR_GetMousePosReal (Ivector2 &p);
void IR_GetMousePosIndependent (Fvector2 &f);
void IR_GetMousePosIndependentCrop (Fvector2 &f);
static void IR_GetLastMouseDelta (Ivector2& p);
static void IR_GetMousePosScreen (Ivector2& p);
static void IR_GetMousePosReal (HWND hwnd, Ivector2 &p);
static void IR_GetMousePosReal (Ivector2 &p);
static void IR_GetMousePosIndependent (Fvector2 &f);
static void IR_GetMousePosIndependentCrop (Fvector2 &f);
BOOL IR_GetKeyState (int dik);
BOOL IR_GetBtnState (int btn);
void IR_Capture (void);
Expand Down
14 changes: 7 additions & 7 deletions src/xrGame/UICursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "ui/UIStatic.h"
#include "ui/UIBtnHint.h"

#include "xrEngine/IInputReceiver.h"

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

Expand Down Expand Up @@ -97,11 +97,10 @@ void CUICursor::UpdateCursorPosition(int _dx, int _dy)
{
Fvector2 p;
vPrevPos = vPos;
if(m_b_use_win_cursor)
if (m_b_use_win_cursor)
{
POINT pti;
BOOL r = GetCursorPos(&pti);
if(!r) return;
Ivector2 pti;
IInputReceiver::IR_GetMousePosReal(pti);
p.x = (float)pti.x;
p.y = (float)pti.y;
vPos.x = p.x * (UI_BASE_WIDTH/(float)Device.dwWidth);
Expand All @@ -122,6 +121,7 @@ void CUICursor::SetUICursorPosition(Fvector2 pos)
POINT p;
p.x = iFloor(vPos.x / (UI_BASE_WIDTH/(float)Device.dwWidth));
p.y = iFloor(vPos.y / (UI_BASE_HEIGHT/(float)Device.dwHeight));

SetCursorPos(p.x, p.y);
if (m_b_use_win_cursor)
ClientToScreen(Device.m_hWnd, (LPPOINT)&p);
SetCursorPos(p.x, p.y);
}

0 comments on commit 12cebe5

Please sign in to comment.