mirror of
https://github.com/ddnet/ddnet.git
synced 2024-09-19 17:14:18 +00:00
Compare commits
6 commits
0767bbd66d
...
c4b30f85c7
Author | SHA1 | Date | |
---|---|---|---|
c4b30f85c7 | |||
0f12044fcd | |||
8f2c288698 | |||
9963a3e3db | |||
4b6f2e22a8 | |||
7bbd51cf73 |
|
@ -424,7 +424,10 @@ void CServerBrowserHttp::Refresh()
|
||||||
}
|
}
|
||||||
bool ServerbrowserParseUrl(NETADDR *pOut, const char *pUrl)
|
bool ServerbrowserParseUrl(NETADDR *pOut, const char *pUrl)
|
||||||
{
|
{
|
||||||
return net_addr_from_url(pOut, pUrl, nullptr, 0) != 0;
|
int Failure = net_addr_from_url(pOut, pUrl, nullptr, 0);
|
||||||
|
if(Failure || pOut->port == 0)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
bool CServerBrowserHttp::Validate(json_value *pJson)
|
bool CServerBrowserHttp::Validate(json_value *pJson)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1277,11 +1277,11 @@ void CHud::UpdateMovementInformationTextContainer(STextContainerIndex &TextConta
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHud::RenderMovementInformationTextContainer(STextContainerIndex &TextContainer, float X, float Y)
|
void CHud::RenderMovementInformationTextContainer(STextContainerIndex &TextContainer, const ColorRGBA &Color, float X, float Y)
|
||||||
{
|
{
|
||||||
if(TextContainer.Valid())
|
if(TextContainer.Valid())
|
||||||
{
|
{
|
||||||
TextRender()->RenderTextContainer(TextContainer, TextRender()->DefaultTextColor(), TextRender()->DefaultTextOutlineColor(), X - TextRender()->GetBoundingBoxTextContainer(TextContainer).m_W, Y);
|
TextRender()->RenderTextContainer(TextContainer, Color, TextRender()->DefaultTextOutlineColor(), X - TextRender()->GetBoundingBoxTextContainer(TextContainer).m_W, Y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1354,12 +1354,12 @@ void CHud::RenderMovementInformation(const int ClientId)
|
||||||
|
|
||||||
TextRender()->Text(xl, y, Fontsize, "X:", -1.0f);
|
TextRender()->Text(xl, y, Fontsize, "X:", -1.0f);
|
||||||
UpdateMovementInformationTextContainer(m_aPlayerPositionContainers[0], Fontsize, Pos.x, m_aaPlayerPositionText[0], sizeof(m_aaPlayerPositionText[0]));
|
UpdateMovementInformationTextContainer(m_aPlayerPositionContainers[0], Fontsize, Pos.x, m_aaPlayerPositionText[0], sizeof(m_aaPlayerPositionText[0]));
|
||||||
RenderMovementInformationTextContainer(m_aPlayerPositionContainers[0], xr, y);
|
RenderMovementInformationTextContainer(m_aPlayerPositionContainers[0], TextRender()->DefaultTextColor(), xr, y);
|
||||||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||||
|
|
||||||
TextRender()->Text(xl, y, Fontsize, "Y:", -1.0f);
|
TextRender()->Text(xl, y, Fontsize, "Y:", -1.0f);
|
||||||
UpdateMovementInformationTextContainer(m_aPlayerPositionContainers[1], Fontsize, Pos.y, m_aaPlayerPositionText[1], sizeof(m_aaPlayerPositionText[1]));
|
UpdateMovementInformationTextContainer(m_aPlayerPositionContainers[1], Fontsize, Pos.y, m_aaPlayerPositionText[1], sizeof(m_aaPlayerPositionText[1]));
|
||||||
RenderMovementInformationTextContainer(m_aPlayerPositionContainers[1], xr, y);
|
RenderMovementInformationTextContainer(m_aPlayerPositionContainers[1], TextRender()->DefaultTextColor(), xr, y);
|
||||||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1371,14 +1371,14 @@ void CHud::RenderMovementInformation(const int ClientId)
|
||||||
const char aaCoordinates[][4] = {"X:", "Y:"};
|
const char aaCoordinates[][4] = {"X:", "Y:"};
|
||||||
for(int i = 0; i < 2; i++)
|
for(int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
TextRender()->TextColor(ColorRGBA(1, 1, 1, 1));
|
ColorRGBA Color(1, 1, 1, 1);
|
||||||
if(m_aLastPlayerSpeedChange[i] == ESpeedChange::INCREASE)
|
if(m_aLastPlayerSpeedChange[i] == ESpeedChange::INCREASE)
|
||||||
TextRender()->TextColor(ColorRGBA(0, 1, 0, 1));
|
Color = ColorRGBA(0, 1, 0, 1);
|
||||||
if(m_aLastPlayerSpeedChange[i] == ESpeedChange::DECREASE)
|
if(m_aLastPlayerSpeedChange[i] == ESpeedChange::DECREASE)
|
||||||
TextRender()->TextColor(ColorRGBA(1, 0.5f, 0.5f, 1));
|
Color = ColorRGBA(1, 0.5f, 0.5f, 1);
|
||||||
TextRender()->Text(xl, y, Fontsize, aaCoordinates[i], -1.0f);
|
TextRender()->Text(xl, y, Fontsize, aaCoordinates[i], -1.0f);
|
||||||
UpdateMovementInformationTextContainer(m_aPlayerSpeedTextContainers[i], Fontsize, i == 0 ? DisplaySpeedX : DisplaySpeedY, m_aaPlayerSpeedText[i], sizeof(m_aaPlayerSpeedText[i]));
|
UpdateMovementInformationTextContainer(m_aPlayerSpeedTextContainers[i], Fontsize, i == 0 ? DisplaySpeedX : DisplaySpeedY, m_aaPlayerSpeedText[i], sizeof(m_aaPlayerSpeedText[i]));
|
||||||
RenderMovementInformationTextContainer(m_aPlayerSpeedTextContainers[i], xr, y);
|
RenderMovementInformationTextContainer(m_aPlayerSpeedTextContainers[i], Color, xr, y);
|
||||||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1391,7 +1391,7 @@ void CHud::RenderMovementInformation(const int ClientId)
|
||||||
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
y += MOVEMENT_INFORMATION_LINE_HEIGHT;
|
||||||
|
|
||||||
UpdateMovementInformationTextContainer(m_PlayerAngleTextContainerIndex, Fontsize, DisplayAngle, m_aPlayerAngleText, sizeof(m_aPlayerAngleText));
|
UpdateMovementInformationTextContainer(m_PlayerAngleTextContainerIndex, Fontsize, DisplayAngle, m_aPlayerAngleText, sizeof(m_aPlayerAngleText));
|
||||||
RenderMovementInformationTextContainer(m_PlayerAngleTextContainerIndex, xr, y);
|
RenderMovementInformationTextContainer(m_PlayerAngleTextContainerIndex, TextRender()->DefaultTextColor(), xr, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ class CHud : public CComponent
|
||||||
void RenderMovementInformation(const int ClientId);
|
void RenderMovementInformation(const int ClientId);
|
||||||
|
|
||||||
void UpdateMovementInformationTextContainer(STextContainerIndex &TextContainer, float FontSize, float Value, char *pPrevValue, size_t Size);
|
void UpdateMovementInformationTextContainer(STextContainerIndex &TextContainer, float FontSize, float Value, char *pPrevValue, size_t Size);
|
||||||
void RenderMovementInformationTextContainer(STextContainerIndex &TextContainer, float X, float Y);
|
void RenderMovementInformationTextContainer(STextContainerIndex &TextContainer, const ColorRGBA &Color, float X, float Y);
|
||||||
|
|
||||||
void RenderGameTimer();
|
void RenderGameTimer();
|
||||||
void RenderPauseNotification();
|
void RenderPauseNotification();
|
||||||
|
|
|
@ -1301,21 +1301,24 @@ float CUi::DoScrollbarV(const void *pId, const CUIRect *pRect, float Current)
|
||||||
}
|
}
|
||||||
else if(HotItem() == pId)
|
else if(HotItem() == pId)
|
||||||
{
|
{
|
||||||
if(MouseButton(0))
|
if(InsideHandle)
|
||||||
|
{
|
||||||
|
if(MouseButton(0))
|
||||||
|
{
|
||||||
|
SetActiveItem(pId);
|
||||||
|
m_ActiveScrollbarOffset = MouseY() - Handle.y;
|
||||||
|
Grabbed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(MouseButtonClicked(0))
|
||||||
{
|
{
|
||||||
SetActiveItem(pId);
|
SetActiveItem(pId);
|
||||||
m_ActiveScrollbarOffset = MouseY() - Handle.y;
|
m_ActiveScrollbarOffset = Handle.h / 2.0f;
|
||||||
Grabbed = true;
|
Grabbed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(MouseButtonClicked(0) && !InsideHandle && InsideRail)
|
|
||||||
{
|
|
||||||
SetActiveItem(pId);
|
|
||||||
m_ActiveScrollbarOffset = Handle.h / 2.0f;
|
|
||||||
Grabbed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(InsideHandle && !MouseButton(0))
|
if(InsideRail && !MouseButton(0))
|
||||||
{
|
{
|
||||||
SetHotItem(pId);
|
SetHotItem(pId);
|
||||||
}
|
}
|
||||||
|
@ -1380,19 +1383,22 @@ float CUi::DoScrollbarH(const void *pId, const CUIRect *pRect, float Current, co
|
||||||
}
|
}
|
||||||
else if(HotItem() == pId)
|
else if(HotItem() == pId)
|
||||||
{
|
{
|
||||||
if(MouseButton(0))
|
if(InsideHandle)
|
||||||
|
{
|
||||||
|
if(MouseButton(0))
|
||||||
|
{
|
||||||
|
SetActiveItem(pId);
|
||||||
|
m_ActiveScrollbarOffset = MouseX() - Handle.x;
|
||||||
|
Grabbed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if(MouseButtonClicked(0))
|
||||||
{
|
{
|
||||||
SetActiveItem(pId);
|
SetActiveItem(pId);
|
||||||
m_ActiveScrollbarOffset = MouseX() - Handle.x;
|
m_ActiveScrollbarOffset = Handle.w / 2.0f;
|
||||||
Grabbed = true;
|
Grabbed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(MouseButtonClicked(0) && !InsideHandle && InsideRail)
|
|
||||||
{
|
|
||||||
SetActiveItem(pId);
|
|
||||||
m_ActiveScrollbarOffset = Handle.w / 2.0f;
|
|
||||||
Grabbed = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!pColorInner && (InsideHandle || Grabbed) && (CheckActiveItem(pId) || HotItem() == pId))
|
if(!pColorInner && (InsideHandle || Grabbed) && (CheckActiveItem(pId) || HotItem() == pId))
|
||||||
{
|
{
|
||||||
|
@ -1400,7 +1406,7 @@ float CUi::DoScrollbarH(const void *pId, const CUIRect *pRect, float Current, co
|
||||||
Handle.y -= 1.5f;
|
Handle.y -= 1.5f;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(InsideHandle && !MouseButton(0))
|
if(InsideRail && !MouseButton(0))
|
||||||
{
|
{
|
||||||
SetHotItem(pId);
|
SetHotItem(pId);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue