Let CUI::Screen return a const pointer

Callers should never modify the UI screen.
This commit is contained in:
Robert Müller 2023-04-07 11:50:30 +02:00
parent b4c114450c
commit 72775f236b
5 changed files with 5 additions and 5 deletions

View file

@ -2431,7 +2431,7 @@ void CMenus::OnRender()
ms_ColorTabbarHoverIngame = ColorRGBA(1, 1, 1, 0.75f);
// update the ui
CUIRect *pScreen = UI()->Screen();
const CUIRect *pScreen = UI()->Screen();
float mx = (m_MousePos.x / (float)Graphics()->WindowWidth()) * pScreen->w;
float my = (m_MousePos.y / (float)Graphics()->WindowHeight()) * pScreen->h;

View file

@ -2263,7 +2263,7 @@ ColorHSLA CMenus::RenderHSLColorPicker(const CUIRect *pRect, unsigned int *pColo
return HSLColor;
}
CUIRect *pScreen = UI()->Screen();
const CUIRect *pScreen = UI()->Screen();
ms_ColorPicker.m_X = minimum(UI()->MouseX(), pScreen->w - ms_ColorPicker.ms_Width);
ms_ColorPicker.m_Y = minimum(UI()->MouseY(), pScreen->h - ms_ColorPicker.ms_Height);
ms_ColorPicker.m_pColor = pColor;

View file

@ -80,7 +80,7 @@ void CTooltips::OnRender()
Rect.w = TextRender()->TextWidth(14.0f, Tooltip.m_pText, -1, -1.0f) + 4.0f;
Rect.h = 30.0f;
CUIRect *pScreen = UI()->Screen();
const CUIRect *pScreen = UI()->Screen();
// Try the top side.
if(Tooltip.m_Rect.y - Rect.h - MARGIN > pScreen->y)

View file

@ -294,7 +294,7 @@ float CUI::ButtonColorMul(const void *pID)
return ButtonColorMulDefault();
}
CUIRect *CUI::Screen()
const CUIRect *CUI::Screen()
{
float Aspect = Graphics()->ScreenAspect();
float w, h;

View file

@ -331,7 +331,7 @@ public:
float ButtonColorMulDefault() { return 1.0f; }
float ButtonColorMul(const void *pID);
CUIRect *Screen();
const CUIRect *Screen();
void MapScreen();
float PixelSize();