mirror of
https://github.com/ENSL/NS.git
synced 2024-11-10 07:11:38 +00:00
Fixed pop-up menu and commander UI cursor centering
This commit is contained in:
parent
873c7b1403
commit
9c6f780336
3 changed files with 42 additions and 0 deletions
|
@ -2237,6 +2237,27 @@ void AvHHud::ResetComponentsForUser3()
|
|||
this->GetManager().UnhideComponent(kSelectAllImpulsePanel);
|
||||
//this->GetManager().UnhideComponent(kTopDownHUDTopSpritePanel);
|
||||
//this->GetManager().UnhideComponent(kTopDownHUDBottomSpritePanel);
|
||||
|
||||
if (this->mFramesSinceEnteredTopdownMode > 2)
|
||||
{
|
||||
// Workaround for not being able to center mouse with raw input enabled.
|
||||
if (CVAR_GET_FLOAT("m_rawinput") != 0)
|
||||
{
|
||||
if (SDL_GetRelativeMouseMode() != SDL_TRUE)
|
||||
{
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
#ifdef WIN32
|
||||
ShowCursor(TRUE);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this->mFramesSinceEnteredTopdownMode++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//this->GetManager().UnhideComponent(kReinforcementsLabel);
|
||||
break;
|
||||
|
@ -2853,6 +2874,19 @@ int AvHHud::MsgFunc_SetTopDown(const char* pszName, int iSize, void* pbuf)
|
|||
// Switch to top down mode!
|
||||
this->mInTopDownMode = true;
|
||||
this->ShowMouse();
|
||||
|
||||
// Workaround for not being able to center mouse with raw input enabled.
|
||||
if (CVAR_GET_FLOAT("m_rawinput") != 0)
|
||||
{
|
||||
SDL_SetRelativeMouseMode(SDL_FALSE);
|
||||
gEngfuncs.pfnSetMousePos(gEngfuncs.GetWindowCenterX(), gEngfuncs.GetWindowCenterY());
|
||||
}
|
||||
|
||||
this->mFramesSinceEnteredTopdownMode = 0;
|
||||
#ifdef WIN32
|
||||
ShowCursor(FALSE);
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
if(is_top_down)
|
||||
|
|
|
@ -673,6 +673,7 @@ private:
|
|||
|
||||
float mTimeLastOverwatchPulse;
|
||||
bool mInTopDownMode;
|
||||
int mFramesSinceEnteredTopdownMode;
|
||||
int mNumLocalSelectEvents;
|
||||
AvHMapMode mMapMode;
|
||||
//@2014 make this work for linux
|
||||
|
|
|
@ -291,6 +291,13 @@ void AvHPieMenuHandler::cursorMoved(int x,int y,Panel* panel)
|
|||
// char theMessage[128];
|
||||
// sprintf(theMessage, "AvHPieMenuHandler::cursorMoved %d, %d (panel ptr: %d).\n", x, y, (int)panel);
|
||||
// CenterPrint(theMessage);
|
||||
if (sPieMenuOpen && CVAR_GET_FLOAT("m_rawinput") != 0)
|
||||
{
|
||||
if (SDL_GetRelativeMouseMode() != SDL_TRUE)
|
||||
{
|
||||
SDL_SetRelativeMouseMode(SDL_TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AvHPieMenuHandler::cursorEntered(Panel* panel)
|
||||
|
|
Loading…
Reference in a new issue