mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-11-13 10:49:05 +00:00
Fix #162: Center ingame mouse cursor after login
This commit is contained in:
parent
2efdca688e
commit
868ff2d106
3 changed files with 9 additions and 5 deletions
|
@ -53,12 +53,14 @@ namespace NLGUI
|
||||||
bool show() const {return _PointerVisible;}
|
bool show() const {return _PointerVisible;}
|
||||||
|
|
||||||
void draw(){}
|
void draw(){}
|
||||||
|
|
||||||
/// set button state
|
/// set button state
|
||||||
void setButtonState(NLMISC::TMouseButton state) { _Buttons = state; }
|
void setButtonState(NLMISC::TMouseButton state) { _Buttons = state; }
|
||||||
/// get buttons state
|
/// get buttons state
|
||||||
NLMISC::TMouseButton getButtonState() const { return _Buttons; }
|
NLMISC::TMouseButton getButtonState() const { return _Buttons; }
|
||||||
|
|
||||||
|
static const sint32 InvalidCoord = 0x80000000;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// (x,y) is from the TopLeft corner of the window
|
// (x,y) is from the TopLeft corner of the window
|
||||||
sint32 _PointerX; // Current pointer position (raw, before snapping)
|
sint32 _PointerX; // Current pointer position (raw, before snapping)
|
||||||
|
|
|
@ -25,7 +25,7 @@ namespace NLGUI
|
||||||
CViewBase( param ),
|
CViewBase( param ),
|
||||||
_Buttons( NLMISC::noButton )
|
_Buttons( NLMISC::noButton )
|
||||||
{
|
{
|
||||||
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = 0;
|
_PointerX = _PointerY = _PointerOldX = _PointerOldY = _PointerDownX = _PointerDownY = InvalidCoord;
|
||||||
_PointerDown = false;
|
_PointerDown = false;
|
||||||
_PointerVisible = true;
|
_PointerVisible = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -263,7 +263,6 @@ bool IsMouseFreeLook()
|
||||||
return MouseFreeLook;
|
return MouseFreeLook;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// *********************************************************************************
|
// *********************************************************************************
|
||||||
// Use this method to toggle the mouse (freelook -> cursor)
|
// Use this method to toggle the mouse (freelook -> cursor)
|
||||||
void SetMouseCursor (bool updatePos)
|
void SetMouseCursor (bool updatePos)
|
||||||
|
@ -287,8 +286,11 @@ void SetMouseCursor (bool updatePos)
|
||||||
{
|
{
|
||||||
sint32 ix, iy;
|
sint32 ix, iy;
|
||||||
cursor->getPointerPos (ix, iy);
|
cursor->getPointerPos (ix, iy);
|
||||||
x = (float)ix / (float)width;
|
if (ix != CViewPointer::InvalidCoord && iy != CViewPointer::InvalidCoord)
|
||||||
y = (float)iy / (float)height;
|
{
|
||||||
|
x = (float)ix / (float)width;
|
||||||
|
y = (float)iy / (float)height;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue