Extract CRenderTools::RenderCursor

This commit is contained in:
Robert Müller 2022-05-27 19:30:20 +02:00
parent caa23bcfdd
commit fccfbd5b70
5 changed files with 16 additions and 28 deletions

View file

@ -171,14 +171,7 @@ void CEmoticon::OnRender()
else
m_SelectedEyeEmote = -1;
Graphics()->WrapClamp();
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CURSOR].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1, 1, 1, 1);
IGraphics::CQuadItem QuadItem(m_SelectorMouse.x + Screen.w / 2, m_SelectorMouse.y + Screen.h / 2, 24, 24);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
Graphics()->WrapNormal();
RenderTools()->RenderCursor(m_SelectorMouse + vec2(Screen.w, Screen.h) / 2, 24.0f);
}
void CEmoticon::Emote(int Emoticon)

View file

@ -2575,18 +2575,8 @@ void CMenus::OnRender()
UI()->Update(mx, my, mx * 3.0f, my * 3.0f);
// render
Render();
// render cursor
Graphics()->WrapClamp();
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CURSOR].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1, 1, 1, 1);
IGraphics::CQuadItem QuadItem(mx, my, 24, 24);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
Graphics()->WrapNormal();
RenderTools()->RenderCursor(vec2(mx, my), 24.0f);
// render debug information
if(g_Config.m_Debug)

View file

@ -435,15 +435,7 @@ void CSpectator::OnRender()
}
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
// draw cursor
Graphics()->WrapClamp();
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CURSOR].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
IGraphics::CQuadItem QuadItem(m_SelectorMouse.x + Width / 2.0f, m_SelectorMouse.y + Height / 2.0f, 48.0f, 48.0f);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
Graphics()->WrapNormal();
RenderTools()->RenderCursor(m_SelectorMouse + vec2(Width, Height) / 2, 48.0f);
}
void CSpectator::OnReset()

View file

@ -119,6 +119,18 @@ void CRenderTools::DrawSprite(float x, float y, float ScaledWidth, float ScaledH
Graphics()->QuadsDraw(&QuadItem, 1);
}
void CRenderTools::RenderCursor(vec2 Center, float Size)
{
Graphics()->WrapClamp();
Graphics()->TextureSet(g_pData->m_aImages[IMAGE_CURSOR].m_Id);
Graphics()->QuadsBegin();
Graphics()->SetColor(1.0f, 1.0f, 1.0f, 1.0f);
IGraphics::CQuadItem QuadItem(Center.x, Center.y, Size, Size);
Graphics()->QuadsDrawTL(&QuadItem, 1);
Graphics()->QuadsEnd();
Graphics()->WrapNormal();
}
int CRenderTools::QuadContainerAddSprite(int QuadContainerIndex, float x, float y, float Size)
{
IGraphics::CQuadItem QuadItem(x, y, Size, Size);

View file

@ -78,6 +78,7 @@ public:
void DrawSprite(float x, float y, float size);
void DrawSprite(float x, float y, float ScaledWidth, float ScaledHeight);
void RenderCursor(vec2 Center, float Size);
int QuadContainerAddSprite(int QuadContainerIndex, float x, float y, float size);
int QuadContainerAddSprite(int QuadContainerIndex, float size);
int QuadContainerAddSprite(int QuadContainerIndex, float Width, float Height);