mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-14 03:58:18 +00:00
Color picker: Settings UI + Picker Logic, Editboxes left
This commit is contained in:
parent
e817a179da
commit
94e227c8c3
|
@ -775,6 +775,12 @@ public:
|
||||||
pCursor->m_Y += y;
|
pCursor->m_Y += y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void SetCursorPosition(CTextCursor *pCursor, float x, float y)
|
||||||
|
{
|
||||||
|
pCursor->m_X = x;
|
||||||
|
pCursor->m_Y = y;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, float LineWidth)
|
virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, float LineWidth)
|
||||||
{
|
{
|
||||||
CTextCursor Cursor;
|
CTextCursor Cursor;
|
||||||
|
|
|
@ -85,6 +85,7 @@ class ITextRender : public IInterface
|
||||||
public:
|
public:
|
||||||
virtual void SetCursor(CTextCursor *pCursor, float x, float y, float FontSize, int Flags) = 0;
|
virtual void SetCursor(CTextCursor *pCursor, float x, float y, float FontSize, int Flags) = 0;
|
||||||
virtual void MoveCursor(CTextCursor *pCursor, float x, float y) = 0;
|
virtual void MoveCursor(CTextCursor *pCursor, float x, float y) = 0;
|
||||||
|
virtual void SetCursorPosition(CTextCursor *pCursor, float x, float y) = 0;
|
||||||
|
|
||||||
virtual CFont *LoadFont(const char *pFilename, const unsigned char *pBuf, size_t Size) = 0;
|
virtual CFont *LoadFont(const char *pFilename, const unsigned char *pBuf, size_t Size) = 0;
|
||||||
virtual bool LoadFallbackFont(CFont *pFont, const char *pFilename, const unsigned char *pBuf, size_t Size) = 0;
|
virtual bool LoadFallbackFont(CFont *pFont, const char *pFilename, const unsigned char *pBuf, size_t Size) = 0;
|
||||||
|
|
|
@ -11,13 +11,6 @@ class CChat : public CComponent
|
||||||
{
|
{
|
||||||
CLineInput m_Input;
|
CLineInput m_Input;
|
||||||
|
|
||||||
static constexpr float MESSAGE_PADDING_X = 5.0f;
|
|
||||||
static constexpr float MESSAGE_TEE_SIZE = 8.0f;
|
|
||||||
static constexpr float MESSAGE_TEE_PADDING_RIGHT = 0.5f;
|
|
||||||
static constexpr float FONT_SIZE = 6.0f;
|
|
||||||
static constexpr float MESSAGE_PADDING_Y = 3.f;
|
|
||||||
static_assert(FONT_SIZE + MESSAGE_PADDING_Y >= 8.0f, "Corners for background chat are too huge for this combination of font size and message padding.");
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
MAX_LINES = 25
|
MAX_LINES = 25
|
||||||
|
@ -119,6 +112,13 @@ class CChat : public CComponent
|
||||||
public:
|
public:
|
||||||
CChat();
|
CChat();
|
||||||
|
|
||||||
|
static constexpr float MESSAGE_PADDING_X = 5.0f;
|
||||||
|
static constexpr float MESSAGE_TEE_SIZE = 8.0f;
|
||||||
|
static constexpr float MESSAGE_TEE_PADDING_RIGHT = 0.5f;
|
||||||
|
static constexpr float FONT_SIZE = 6.0f;
|
||||||
|
static constexpr float MESSAGE_PADDING_Y = 3.f;
|
||||||
|
static_assert(FONT_SIZE + MESSAGE_PADDING_Y >= 8.0f, "Corners for background chat are too huge for this combination of font size and message padding.");
|
||||||
|
|
||||||
bool IsActive() const { return m_Mode != MODE_NONE; }
|
bool IsActive() const { return m_Mode != MODE_NONE; }
|
||||||
void AddLine(int ClientID, int Team, const char *pLine);
|
void AddLine(int ClientID, int Team, const char *pLine);
|
||||||
void EnableMode(int Team);
|
void EnableMode(int Team);
|
||||||
|
|
|
@ -159,10 +159,27 @@ int CMenus::DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect,
|
||||||
return Active ? UI()->DoButtonLogic(pID, "", Checked, pRect) : 0;
|
return Active ? UI()->DoButtonLogic(pID, "", Checked, pRect) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName, int Corners, float r, float FontFactor, vec4 ColorHot, vec4 Color, int AlignVertically)
|
int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName, int Corners, float r, float FontFactor, vec4 ColorHot, vec4 Color, int AlignVertically, bool CheckForActiveColorPicker)
|
||||||
{
|
{
|
||||||
CUIRect Text = *pRect;
|
CUIRect Text = *pRect;
|
||||||
|
|
||||||
|
bool MouseInsideColorPicker = false;
|
||||||
|
|
||||||
|
if(CheckForActiveColorPicker)
|
||||||
|
{
|
||||||
|
if(ms_ColorPicker.m_Active)
|
||||||
|
{
|
||||||
|
CUIRect PickerRect;
|
||||||
|
PickerRect.x = ms_ColorPicker.m_X;
|
||||||
|
PickerRect.y = ms_ColorPicker.m_Y;
|
||||||
|
PickerRect.w = ms_ColorPicker.ms_Width;
|
||||||
|
PickerRect.h = ms_ColorPicker.ms_Height;
|
||||||
|
|
||||||
|
MouseInsideColorPicker = UI()->MouseInside(&PickerRect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!MouseInsideColorPicker)
|
||||||
Color.a *= ButtonColorMul(pID);
|
Color.a *= ButtonColorMul(pID);
|
||||||
RenderTools()->DrawUIRect(pRect, Color, Corners, r);
|
RenderTools()->DrawUIRect(pRect, Color, Corners, r);
|
||||||
|
|
||||||
|
@ -189,6 +206,10 @@ int CMenus::DoButton_Menu(const void *pID, const char *pText, int Checked, const
|
||||||
Text.HMargin(pRect->h >= 20.0f ? 2.0f : 1.0f, &Text);
|
Text.HMargin(pRect->h >= 20.0f ? 2.0f : 1.0f, &Text);
|
||||||
Text.HMargin((Text.h * FontFactor) / 2.0f, &Text);
|
Text.HMargin((Text.h * FontFactor) / 2.0f, &Text);
|
||||||
UI()->DoLabel(&Text, pText, Text.h * ms_FontmodHeight, 0, -1, AlignVertically);
|
UI()->DoLabel(&Text, pText, Text.h * ms_FontmodHeight, 0, -1, AlignVertically);
|
||||||
|
|
||||||
|
if(MouseInsideColorPicker)
|
||||||
|
return 0;
|
||||||
|
|
||||||
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
|
return UI()->DoButtonLogic(pID, pText, Checked, pRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,6 +294,120 @@ int CMenus::DoButton_CheckBox_Common(const void *pID, const char *pText, const c
|
||||||
return UI()->DoButtonLogic(pID, pText, 0, pRect);
|
return UI()->DoButtonLogic(pID, pText, 0, pRect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CMenus::DoLaserPreview(const CUIRect *pRect, const ColorHSLA LaserOutlineColor, const ColorHSLA LaserInnerColor)
|
||||||
|
{
|
||||||
|
ColorRGBA LaserRGB;
|
||||||
|
CUIRect Section = *pRect;
|
||||||
|
vec2 From = vec2(Section.x, Section.y + Section.h / 2.0f);
|
||||||
|
vec2 Pos = vec2(Section.x + Section.w - 10.0f, Section.y + Section.h / 2.0f);
|
||||||
|
|
||||||
|
vec2 Out, Border;
|
||||||
|
|
||||||
|
Graphics()->BlendNormal();
|
||||||
|
Graphics()->TextureClear();
|
||||||
|
Graphics()->QuadsBegin();
|
||||||
|
|
||||||
|
LaserRGB = color_cast<ColorRGBA, ColorHSLA>(LaserOutlineColor);
|
||||||
|
ColorRGBA OuterColor(LaserRGB.r, LaserRGB.g, LaserRGB.b, 1.0f);
|
||||||
|
Graphics()->SetColor(LaserRGB.r, LaserRGB.g, LaserRGB.b, 1.0f);
|
||||||
|
Out = vec2(0.0f, -1.0f) * (3.15f);
|
||||||
|
|
||||||
|
IGraphics::CFreeformItem Freeform(From.x - Out.x, From.y - Out.y, From.x + Out.x, From.y + Out.y, Pos.x - Out.x, Pos.y - Out.y, Pos.x + Out.x, Pos.y + Out.y);
|
||||||
|
Graphics()->QuadsDrawFreeform(&Freeform, 1);
|
||||||
|
|
||||||
|
LaserRGB = color_cast<ColorRGBA, ColorHSLA>(LaserInnerColor);
|
||||||
|
ColorRGBA InnerColor(LaserRGB.r, LaserRGB.g, LaserRGB.b, 1.0f);
|
||||||
|
Out = vec2(0.0f, -1.0f) * (2.25f);
|
||||||
|
Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f);
|
||||||
|
|
||||||
|
Freeform = IGraphics::CFreeformItem(From.x - Out.x, From.y - Out.y, From.x + Out.x, From.y + Out.y, Pos.x - Out.x, Pos.y - Out.y, Pos.x + Out.x, Pos.y + Out.y);
|
||||||
|
Graphics()->QuadsDrawFreeform(&Freeform, 1);
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
|
Graphics()->BlendNormal();
|
||||||
|
int SpriteIndex = time_get() % 3;
|
||||||
|
Graphics()->TextureSet(GameClient()->m_ParticlesSkin.m_SpriteParticleSplat[SpriteIndex]);
|
||||||
|
Graphics()->QuadsBegin();
|
||||||
|
Graphics()->QuadsSetRotation(time_get());
|
||||||
|
Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f);
|
||||||
|
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, 24, 24);
|
||||||
|
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||||
|
Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f);
|
||||||
|
QuadItem = IGraphics::CQuadItem(Pos.x, Pos.y, 20, 20);
|
||||||
|
Graphics()->QuadsDraw(&QuadItem, 1);
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
|
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteWeaponLaser);
|
||||||
|
Graphics()->QuadsBegin();
|
||||||
|
RenderTools()->SelectSprite(SPRITE_WEAPON_LASER_BODY);
|
||||||
|
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
||||||
|
RenderTools()->DrawSprite(Section.x, Section.y + Section.h / 2.0f, 60.0f);
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
ColorHSLA CMenus::DoLine_ColorPicker(int *pResetID, const float LineSize, const float WantedPickerPosition, const float LabelSize, const float BottomMargin, CUIRect *pMainRect, const char *pText, unsigned int *pColorValue, const ColorRGBA DefaultColor, bool CheckBoxSpacing, bool UseCheckBox, int *pCheckBoxValue)
|
||||||
|
{
|
||||||
|
CUIRect Section, Button, Label;
|
||||||
|
|
||||||
|
pMainRect->HSplitTop(LineSize, &Section, pMainRect);
|
||||||
|
pMainRect->HSplitTop(BottomMargin, 0x0, pMainRect);
|
||||||
|
|
||||||
|
float SectionWidth = Section.w;
|
||||||
|
|
||||||
|
if(CheckBoxSpacing || UseCheckBox)
|
||||||
|
Section.VSplitLeft(20.0f, &Button, &Section);
|
||||||
|
|
||||||
|
if(UseCheckBox)
|
||||||
|
{
|
||||||
|
CUIRect CheckBox;
|
||||||
|
Button.Margin(2.0f, &CheckBox);
|
||||||
|
|
||||||
|
if(DoButton_CheckBox(pCheckBoxValue, "", *pCheckBoxValue, &CheckBox))
|
||||||
|
*pCheckBoxValue ^= 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Section.VSplitLeft(5.0f, 0x0, &Section);
|
||||||
|
float LabelWidth = TextRender()->TextWidth(0, 14.0f, pText, -1, -1.0f);
|
||||||
|
Section.VSplitLeft(LabelWidth, &Label, &Section);
|
||||||
|
|
||||||
|
UI()->DoLabelScaled(&Label, pText, LabelSize, -1);
|
||||||
|
|
||||||
|
float Cut = WantedPickerPosition - (SectionWidth - Section.w);
|
||||||
|
if(Cut < 5)
|
||||||
|
Cut = 5.0f;
|
||||||
|
|
||||||
|
Section.VSplitLeft(Cut, 0x0, &Section);
|
||||||
|
Section.VSplitLeft(LineSize, &Button, &Section);
|
||||||
|
|
||||||
|
ColorHSLA PickedColor = RenderHSLColorPicker(&Button, pColorValue, false);
|
||||||
|
|
||||||
|
Section.VSplitLeft(7.5f, 0x0, &Section);
|
||||||
|
Section.VSplitLeft(55.0f, &Button, &Section);
|
||||||
|
Button.HSplitTop(2.0f, 0x0, &Button);
|
||||||
|
Button.HSplitBottom(2.0f, &Button, 0x0);
|
||||||
|
|
||||||
|
if(DoButton_Menu(pResetID, Localize("Reset"), 0, &Button, 0, CUI::CORNER_ALL, 8.0f, 0, vec4(1, 1, 1, 0.5f), vec4(1, 1, 1, 0.25f), 1, true))
|
||||||
|
{
|
||||||
|
ColorHSLA HSL = color_cast<ColorHSLA>(DefaultColor);
|
||||||
|
*pColorValue = HSL.Pack(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
return PickedColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
int CMenus::DoButton_CheckBoxAutoVMarginAndSet(const void *pID, const char *pText, int *pValue, CUIRect *pRect, float VMargin)
|
||||||
|
{
|
||||||
|
CUIRect CheckBoxRect;
|
||||||
|
pRect->HSplitTop(VMargin, &CheckBoxRect, pRect);
|
||||||
|
|
||||||
|
int Logic = DoButton_CheckBox_Common(pID, pText, *pValue ? "X" : "", &CheckBoxRect);
|
||||||
|
|
||||||
|
if(Logic)
|
||||||
|
*pValue ^= 1;
|
||||||
|
|
||||||
|
return Logic;
|
||||||
|
}
|
||||||
|
|
||||||
int CMenus::DoButton_CheckBox(const void *pID, const char *pText, int Checked, const CUIRect *pRect)
|
int CMenus::DoButton_CheckBox(const void *pID, const char *pText, int Checked, const CUIRect *pRect)
|
||||||
{
|
{
|
||||||
return DoButton_CheckBox_Common(pID, pText, Checked ? "X" : "", pRect);
|
return DoButton_CheckBox_Common(pID, pText, Checked ? "X" : "", pRect);
|
||||||
|
@ -1159,15 +1294,15 @@ void CMenus::RenderColorPicker()
|
||||||
PickerRect.w = ms_ColorPicker.ms_Width;
|
PickerRect.w = ms_ColorPicker.ms_Width;
|
||||||
PickerRect.h = ms_ColorPicker.ms_Height;
|
PickerRect.h = ms_ColorPicker.ms_Height;
|
||||||
|
|
||||||
if(UI()->MouseButtonClicked(0) && !UI()->MouseInside(&PickerRect) && !UI()->MouseInside(&ms_ColorPicker.m_AttachedRect))
|
if(UI()->MouseButtonReleased(1) || (UI()->MouseButtonClicked(0) && !UI()->MouseInside(&PickerRect) && !UI()->MouseInside(&ms_ColorPicker.m_AttachedRect)))
|
||||||
{
|
{
|
||||||
ms_ColorPicker.m_Active = false;
|
ms_ColorPicker.m_Active = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render
|
// Render
|
||||||
ColorRGBA BackgroundColor(0.1f, 0.1f, 0.1f, 1.0f);
|
ColorRGBA BackgroundColor(0.15f, 0.15f, 0.15f, 1.0f);
|
||||||
ColorRGBA OutlineColor(0.21f, 0.21f, 0.21f, 1);
|
ColorRGBA OutlineColor(0.25f, 0.25f, 0.25f, 1);
|
||||||
RenderTools()->DrawUIRect(&PickerRect, BackgroundColor, 0, 0);
|
RenderTools()->DrawUIRect(&PickerRect, BackgroundColor, 0, 0);
|
||||||
|
|
||||||
CUIRect ColorsArea, HueArea, BottomArea, AlphaSliderArea, HexCodeArea;
|
CUIRect ColorsArea, HueArea, BottomArea, AlphaSliderArea, HexCodeArea;
|
||||||
|
@ -1188,8 +1323,7 @@ void CMenus::RenderColorPicker()
|
||||||
RenderTools()->DrawUIRect(&ColorsArea, OutlineColor, 0, 0);
|
RenderTools()->DrawUIRect(&ColorsArea, OutlineColor, 0, 0);
|
||||||
ColorsArea.Margin(1, &ColorsArea);
|
ColorsArea.Margin(1, &ColorsArea);
|
||||||
|
|
||||||
ColorHSLA HSLColor(*ms_ColorPicker.m_pColor, false);
|
ColorHSVA PickerColor = ms_ColorPicker.m_HSVColor;
|
||||||
ColorHSVA PickerColor = color_cast<ColorHSVA, ColorHSLA>(HSLColor);
|
|
||||||
|
|
||||||
// Color Area
|
// Color Area
|
||||||
ColorRGBA rgb;
|
ColorRGBA rgb;
|
||||||
|
@ -1246,7 +1380,6 @@ void CMenus::RenderColorPicker()
|
||||||
|
|
||||||
// Logic
|
// Logic
|
||||||
float PickerX, PickerY;
|
float PickerX, PickerY;
|
||||||
bool PickerClicked = false;
|
|
||||||
|
|
||||||
if(UI()->HotItem() != &ms_HuePickerID)
|
if(UI()->HotItem() != &ms_HuePickerID)
|
||||||
{
|
{
|
||||||
|
@ -1254,17 +1387,13 @@ void CMenus::RenderColorPicker()
|
||||||
{
|
{
|
||||||
PickerColor.y = PickerX / ColorsArea.w;
|
PickerColor.y = PickerX / ColorsArea.w;
|
||||||
PickerColor.z = 1.0f - PickerY / ColorsArea.h;
|
PickerColor.z = 1.0f - PickerY / ColorsArea.h;
|
||||||
PickerClicked = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(UI()->HotItem() != &ms_ColorPickerID)
|
if(UI()->HotItem() != &ms_ColorPickerID)
|
||||||
{
|
{
|
||||||
if(UI()->DoPickerLogic(&ms_HuePickerID, &HueArea, &PickerX, &PickerY))
|
if(UI()->DoPickerLogic(&ms_HuePickerID, &HueArea, &PickerX, &PickerY))
|
||||||
{
|
|
||||||
PickerColor.x = 1.0f - PickerY / HueArea.h;
|
PickerColor.x = 1.0f - PickerY / HueArea.h;
|
||||||
PickerClicked = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Marker Color Area
|
// Marker Color Area
|
||||||
|
@ -1281,6 +1410,21 @@ void CMenus::RenderColorPicker()
|
||||||
RenderTools()->DrawCircle(MarkerX, MarkerY, 4.0f, 32);
|
RenderTools()->DrawCircle(MarkerX, MarkerY, 4.0f, 32);
|
||||||
Graphics()->QuadsEnd();
|
Graphics()->QuadsEnd();
|
||||||
|
|
||||||
|
|
||||||
|
// Marker Hue Area
|
||||||
|
CUIRect HueMarker;
|
||||||
|
HueArea.Margin(-2.5f, &HueMarker);
|
||||||
|
HueMarker.h = 5.0f;
|
||||||
|
HueMarker.y = (HueArea.y + HueArea.h * (1.0f - PickerColor.x)) - HueMarker.h / 2.0f;
|
||||||
|
|
||||||
|
ColorRGBA HueMarkerOutline(1 * PickerColor.x, 1 * PickerColor.x, 1 * PickerColor.x, 1);
|
||||||
|
ColorRGBA HueMarkerColor = color_cast<ColorRGBA, ColorHSVA>(ColorHSVA(PickerColor.x, 1, 1, 1));
|
||||||
|
|
||||||
|
RenderTools()->DrawUIRect(&HueMarker, HueMarkerOutline, 0, 0);
|
||||||
|
HueMarker.Margin(1, &HueMarker);
|
||||||
|
RenderTools()->DrawUIRect(&HueMarker, HueMarkerColor, 0, 0);
|
||||||
|
|
||||||
|
ms_ColorPicker.m_HSVColor = PickerColor;
|
||||||
*ms_ColorPicker.m_pColor = color_cast<ColorHSLA, ColorHSVA>(PickerColor).Pack(false);
|
*ms_ColorPicker.m_pColor = color_cast<ColorHSLA, ColorHSVA>(PickerColor).Pack(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,6 +30,9 @@ public:
|
||||||
const float ms_Width = 160.0f;
|
const float ms_Width = 160.0f;
|
||||||
const float ms_Height = 200.0f;
|
const float ms_Height = 200.0f;
|
||||||
|
|
||||||
|
static int ms_ColorPickerID;
|
||||||
|
static int ms_HuePickerID;
|
||||||
|
|
||||||
float m_X;
|
float m_X;
|
||||||
float m_Y;
|
float m_Y;
|
||||||
|
|
||||||
|
@ -37,6 +40,7 @@ public:
|
||||||
|
|
||||||
CUIRect m_AttachedRect;
|
CUIRect m_AttachedRect;
|
||||||
unsigned int *m_pColor;
|
unsigned int *m_pColor;
|
||||||
|
ColorHSVA m_HSVColor;
|
||||||
};
|
};
|
||||||
|
|
||||||
// compnent to fetch keypresses, override all other input
|
// compnent to fetch keypresses, override all other input
|
||||||
|
@ -78,13 +82,15 @@ class CMenus : public CComponent
|
||||||
int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||||
int DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners);
|
int DoButton_Sprite(const void *pID, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners);
|
||||||
int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active);
|
int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active);
|
||||||
int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName = 0, int Corners = CUI::CORNER_ALL, float r = 5.0f, float FontFactor = 0.0f, vec4 ColorHot = vec4(1.0f, 1.0f, 1.0f, 0.75f), vec4 Color = vec4(1, 1, 1, 0.5f), int AlignVertically = 1);
|
int DoButton_Menu(const void *pID, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName = 0, int Corners = CUI::CORNER_ALL, float r = 5.0f, float FontFactor = 0.0f, vec4 ColorHot = vec4(1.0f, 1.0f, 1.0f, 0.75f), vec4 Color = vec4(1, 1, 1, 0.5f), int AlignVertically = 1, bool CheckForActiveColorPicker = false);
|
||||||
int DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners, const ColorRGBA *pDefaultColor = NULL, const ColorRGBA *pActiveColor = NULL, const ColorRGBA *pHoverColor = NULL, float EdgeRounding = 10, int AlignVertically = 1);
|
int DoButton_MenuTab(const void *pID, const char *pText, int Checked, const CUIRect *pRect, int Corners, const ColorRGBA *pDefaultColor = NULL, const ColorRGBA *pActiveColor = NULL, const ColorRGBA *pHoverColor = NULL, float EdgeRounding = 10, int AlignVertically = 1);
|
||||||
|
|
||||||
int DoButton_CheckBox_Common(const void *pID, const char *pText, const char *pBoxText, const CUIRect *pRect);
|
int DoButton_CheckBox_Common(const void *pID, const char *pText, const char *pBoxText, const CUIRect *pRect);
|
||||||
int DoButton_CheckBox(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
int DoButton_CheckBox(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||||
|
int DoButton_CheckBoxAutoVMarginAndSet(const void *pID, const char *pText, int *pValue, CUIRect *pRect, float VMargin);
|
||||||
int DoButton_CheckBox_Number(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
int DoButton_CheckBox_Number(const void *pID, const char *pText, int Checked, const CUIRect *pRect);
|
||||||
|
ColorHSLA DoLine_ColorPicker(int *pResetID, const float LineSize, const float WantedPickerPosition, const float LabelSize, const float BottomMargin, CUIRect *pMainRect, const char *pText, unsigned int *pColorValue, const ColorRGBA DefaultColor, bool CheckBoxSpacing = true, bool UseCheckBox = false, int *pCheckBoxValue = NULL);
|
||||||
|
void DoLaserPreview(const CUIRect *pRect, const ColorHSLA OutlineColor, const ColorHSLA InnerColor);
|
||||||
/*static void ui_draw_menu_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
/*static void ui_draw_menu_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
||||||
static void ui_draw_keyselect_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
static void ui_draw_keyselect_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
||||||
static void ui_draw_menu_tab_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
static void ui_draw_menu_tab_button(const void *id, const char *text, int checked, const CUIRect *r, const void *extra);
|
||||||
|
@ -655,7 +661,7 @@ private:
|
||||||
// found in menus_settings.cpp
|
// found in menus_settings.cpp
|
||||||
void RenderSettingsDDNet(CUIRect MainView);
|
void RenderSettingsDDNet(CUIRect MainView);
|
||||||
void RenderSettingsHUD(CUIRect MainView);
|
void RenderSettingsHUD(CUIRect MainView);
|
||||||
ColorHSLA RenderHSLColorPicker(CUIRect *pRect, unsigned int *pColor, bool Alpha);
|
ColorHSLA RenderHSLColorPicker(const CUIRect *pRect, unsigned int *pColor, bool Alpha);
|
||||||
ColorHSLA RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool Alpha = false);
|
ColorHSLA RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool Alpha = false);
|
||||||
|
|
||||||
CServerProcess m_ServerProcess;
|
CServerProcess m_ServerProcess;
|
||||||
|
|
|
@ -1564,22 +1564,20 @@ void CMenus::RenderSettings(CUIRect MainView)
|
||||||
UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, -1);
|
UI()->DoLabelScaled(&RestartWarning, Localize("You must restart the game for all settings to take effect."), 14.0f, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
ColorHSLA CMenus::RenderHSLColorPicker(CUIRect *pRect, unsigned int *pColor, bool Alpha)
|
ColorHSLA CMenus::RenderHSLColorPicker(const CUIRect *pRect, unsigned int *pColor, bool Alpha)
|
||||||
{
|
{
|
||||||
ColorHSLA HSLColor(*pColor, false);
|
ColorHSLA HSLColor(*pColor, false);
|
||||||
ColorRGBA RGBColor = color_cast<ColorRGBA>(HSLColor);
|
ColorRGBA RGBColor = color_cast<ColorRGBA>(HSLColor);
|
||||||
|
|
||||||
float OutlineCol = UI()->MouseInside(pRect) ? 0.7f : 0.5f;
|
ColorRGBA Outline(1, 1, 1, 0.25f);
|
||||||
|
const float OutlineSize = 2.5f;
|
||||||
ColorRGBA Outline(OutlineCol, OutlineCol, OutlineCol, 1);
|
Outline.a *= ButtonColorMul(pColor);
|
||||||
|
|
||||||
const float OutlineSize = 2.0f;
|
|
||||||
|
|
||||||
CUIRect Rect;
|
CUIRect Rect;
|
||||||
pRect->Margin(OutlineSize, &Rect);
|
pRect->Margin(OutlineSize, &Rect);
|
||||||
|
|
||||||
RenderTools()->DrawUIRect(pRect, Outline, 0, 0);
|
RenderTools()->DrawUIRect(pRect, Outline, CUI::CORNER_ALL, 4.0f);
|
||||||
RenderTools()->DrawUIRect(&Rect, RGBColor, 0, 0);
|
RenderTools()->DrawUIRect(&Rect, RGBColor, CUI::CORNER_ALL, 4.0f);
|
||||||
|
|
||||||
if(UI()->DoButtonLogic(pColor, 0, pRect))
|
if(UI()->DoButtonLogic(pColor, 0, pRect))
|
||||||
{
|
{
|
||||||
|
@ -1598,6 +1596,7 @@ ColorHSLA CMenus::RenderHSLColorPicker(CUIRect *pRect, unsigned int *pColor, boo
|
||||||
ms_ColorPicker.m_pColor = pColor;
|
ms_ColorPicker.m_pColor = pColor;
|
||||||
ms_ColorPicker.m_Active = true;
|
ms_ColorPicker.m_Active = true;
|
||||||
ms_ColorPicker.m_AttachedRect = *pRect;
|
ms_ColorPicker.m_AttachedRect = *pRect;
|
||||||
|
ms_ColorPicker.m_HSVColor = color_cast<ColorHSVA, ColorHSLA>(HSLColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -1607,6 +1606,7 @@ ColorHSLA CMenus::RenderHSLColorPicker(CUIRect *pRect, unsigned int *pColor, boo
|
||||||
ms_ColorPicker.m_pColor = pColor;
|
ms_ColorPicker.m_pColor = pColor;
|
||||||
ms_ColorPicker.m_Active = true;
|
ms_ColorPicker.m_Active = true;
|
||||||
ms_ColorPicker.m_AttachedRect = *pRect;
|
ms_ColorPicker.m_AttachedRect = *pRect;
|
||||||
|
ms_ColorPicker.m_HSVColor = color_cast<ColorHSVA, ColorHSLA>(HSLColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1638,459 +1638,286 @@ ColorHSLA CMenus::RenderHSLScrollbars(CUIRect *pRect, unsigned int *pColor, bool
|
||||||
|
|
||||||
void CMenus::RenderSettingsHUD(CUIRect MainView)
|
void CMenus::RenderSettingsHUD(CUIRect MainView)
|
||||||
{
|
{
|
||||||
static int pIDP1 = 0, pIDP2 = 0;
|
CUIRect HUD, Chat, Section, SectionTwo;
|
||||||
static int Page = 1;
|
|
||||||
CUIRect Left, Right, HUD, Chat, Button, Label, Weapon, Laser, Page1Tab, Page2Tab, Enable, Heart;
|
|
||||||
|
|
||||||
MainView.VSplitMid(&HUD, &Chat);
|
MainView.VSplitMid(&HUD, &Chat);
|
||||||
|
|
||||||
ColorRGBA test(1, 1, 1, 0.1f);
|
HUD.HSplitTop(30.0f, &Section, &HUD);
|
||||||
RenderTools()->DrawUIRect(&MainView, test, 0, 0);
|
UI()->DoLabelScaled(&Section, Localize("HUD"), 20.0f, -1);
|
||||||
|
HUD.VSplitLeft(5.0f, 0x0, &HUD);
|
||||||
|
HUD.HSplitTop(5.0f, 0x0, &HUD);
|
||||||
|
|
||||||
HUD.HSplitTop(30.0f, &Label, &HUD);
|
Chat.HSplitTop(30.0f, &Section, &Chat);
|
||||||
float tw = TextRender()->TextWidth(0, 20.0f, Localize("HUD"), -1, -1.0f);
|
UI()->DoLabelScaled(&Section, Localize("Chat"), 20.0f, -1);
|
||||||
Label.VSplitLeft(tw + 10.0f, &Label, &Page1Tab);
|
Chat.VSplitLeft(5.0f, 0x0, &Chat);
|
||||||
Page1Tab.VSplitLeft(60.0f, &Page1Tab, 0);
|
Chat.HSplitTop(5.0f, 0x0, &Chat);
|
||||||
Page1Tab.VSplitLeft(30.0f, &Page1Tab, &Page2Tab);
|
|
||||||
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("HUD"), 20.0f, -1);
|
const float LineMargin = 20.0f;
|
||||||
if(DoButton_MenuTab((void *)&pIDP1, "1", Page == 1, &Page1Tab, 5))
|
|
||||||
Page = 1;
|
|
||||||
if(DoButton_MenuTab((void *)&pIDP2, "2", Page == 2, &Page2Tab, 10))
|
|
||||||
Page = 2;
|
|
||||||
|
|
||||||
HUD.Margin(5.0f, &HUD);
|
// ***** HUD ***** //
|
||||||
HUD.VSplitMid(&Left, &Right);
|
|
||||||
Left.VSplitRight(5.0f, &Left, 0);
|
|
||||||
Right.VMargin(5.0f, &Right);
|
|
||||||
|
|
||||||
if(Page == 1)
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowhud, Localize("Show ingame HUD"), &g_Config.m_ClShowhud, &HUD, LineMargin);
|
||||||
{
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClDDRaceScoreBoard, Localize("Use DDRace Scoreboard"), &g_Config.m_ClDDRaceScoreBoard, &HUD, LineMargin);
|
||||||
// show hud1
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowIDs, Localize("Show client IDs"), &g_Config.m_ClShowIDs, &HUD, LineMargin);
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowhudScore, Localize("Show score"), &g_Config.m_ClShowhudScore, &HUD, LineMargin);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowhud, Localize("Show ingame HUD"), g_Config.m_ClShowhud, &Button))
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowhudHealthAmmo, Localize("Show health + ammo"), &g_Config.m_ClShowhudHealthAmmo, &HUD, LineMargin);
|
||||||
g_Config.m_ClShowhud ^= 1;
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowChat, Localize("Show chat"), &g_Config.m_ClShowChat, &HUD, LineMargin);
|
||||||
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClChatTeamColors, Localize("Show names in chat in team colors"), &g_Config.m_ClChatTeamColors, &HUD, LineMargin);
|
||||||
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowKillMessages, Localize("Show kill messages"), &g_Config.m_ClShowKillMessages, &HUD, LineMargin);
|
||||||
|
DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClShowVotesAfterVoting, Localize("Show votes window after voting"), &g_Config.m_ClShowVotesAfterVoting, &HUD, LineMargin);
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
// Laser
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClDDRaceScoreBoard, Localize("Use DDRace Scoreboard"), g_Config.m_ClDDRaceScoreBoard, &Button))
|
|
||||||
{
|
|
||||||
g_Config.m_ClDDRaceScoreBoard ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
HUD.HSplitTop(15.0f, 0x0, &HUD);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowIDs, Localize("Show client IDs in Scoreboard"), g_Config.m_ClShowIDs, &Button))
|
HUD.HSplitTop(50.0f, &Section, &HUD);
|
||||||
{
|
Section.VSplitRight(110.0f, &Section, 0x0);
|
||||||
g_Config.m_ClShowIDs ^= 1;
|
HUD.HSplitTop(25.0f, &SectionTwo, &HUD);
|
||||||
}
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
static int LasterOutResetID, LaserInResetID;
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowhudScore, Localize("Show score"), g_Config.m_ClShowhudScore, &Button))
|
|
||||||
{
|
|
||||||
g_Config.m_ClShowhudScore ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
ColorHSLA LaserOutlineColor = DoLine_ColorPicker(&LasterOutResetID, 25.0f, 194.0f, 13.0f, 5.0f, &SectionTwo, Localize("Laser Outline Color"), &g_Config.m_ClLaserOutlineColor, ColorRGBA(0.074402f, 0.074402f, 0.247166f, 1.0f), false);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowhudHealthAmmo, Localize("Show health + ammo"), g_Config.m_ClShowhudHealthAmmo, &Button))
|
|
||||||
{
|
|
||||||
g_Config.m_ClShowhudHealthAmmo ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
HUD.HSplitTop(5.0f, 0x0, &HUD);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowChat, Localize("Show chat"), g_Config.m_ClShowChat, &Button))
|
HUD.HSplitTop(25.0f, &SectionTwo, &HUD);
|
||||||
{
|
|
||||||
g_Config.m_ClShowChat ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
ColorHSLA LaserInnerColor = DoLine_ColorPicker(&LaserInResetID, 25.0f, 194.0f, 13.0f, 5.0f, &SectionTwo, Localize("Laser Inner Color"), &g_Config.m_ClLaserInnerColor, ColorRGBA(0.498039f, 0.498039f, 1.0f, 1.0f), false);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClChatTeamColors, Localize("Show names in chat in team colors"), g_Config.m_ClChatTeamColors, &Button))
|
|
||||||
{
|
|
||||||
g_Config.m_ClChatTeamColors ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
Section.VSplitLeft(30.0f, 0, &Section);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowKillMessages, Localize("Show kill messages"), g_Config.m_ClShowKillMessages, &Button))
|
|
||||||
{
|
|
||||||
g_Config.m_ClShowKillMessages ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Left.HSplitTop(20.0f, &Button, &Left);
|
DoLaserPreview(&Section, LaserOutlineColor, LaserInnerColor);
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowVotesAfterVoting, Localize("Show votes window after voting"), g_Config.m_ClShowVotesAfterVoting, &Button))
|
|
||||||
{
|
|
||||||
g_Config.m_ClShowVotesAfterVoting ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Chat
|
// ***** Chat ***** //
|
||||||
|
|
||||||
Chat.HSplitTop(30.0f, &Label, &Chat);
|
if(DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClChatTee, Localize("Show Tee icons in chat"), &g_Config.m_ClChatTee, &Chat, LineMargin))
|
||||||
UI()->DoLabelScaled(&Label, Localize("Chat"), 20.0f, -1);
|
|
||||||
|
|
||||||
bool IsOldChat = !(g_Config.m_ClChatTee || g_Config.m_ClChatBackground);
|
|
||||||
|
|
||||||
Chat.HSplitTop(20.0f, &Button, &Chat);
|
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClChatTee, Localize("Use old chat style"), IsOldChat, &Button))
|
|
||||||
{
|
|
||||||
if(IsOldChat)
|
|
||||||
{
|
|
||||||
g_Config.m_ClChatTee = 1;
|
|
||||||
g_Config.m_ClChatBackground = 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
g_Config.m_ClChatTee = 0;
|
|
||||||
g_Config.m_ClChatBackground = 0;
|
|
||||||
}
|
|
||||||
GameClient()->m_pChat->RebuildChat();
|
GameClient()->m_pChat->RebuildChat();
|
||||||
}
|
|
||||||
/*
|
|
||||||
Right.HSplitTop(170.0f, &Chat, &MainView);
|
|
||||||
Chat.HSplitTop(30.0f, &Label, &Chat);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Chat"), 20.0f, -1);
|
|
||||||
Chat.Margin(5.0f, &Chat);
|
|
||||||
Chat.VSplitMid(&Left, &Right);
|
|
||||||
Left = Right;
|
|
||||||
Left.VSplitRight(5.0f, &Left, 0);
|
|
||||||
Right.VMargin(5.0f, &Right);
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
|
|
||||||
{
|
if(DoButton_CheckBoxAutoVMarginAndSet(&g_Config.m_ClChatBackground, Localize("Show backgrounds for chat messages"), &g_Config.m_ClChatBackground, &Chat, LineMargin))
|
||||||
|
GameClient()->m_pChat->RebuildChat();
|
||||||
|
|
||||||
|
Chat.HSplitTop(30.0f, 0x0, &Chat);
|
||||||
|
|
||||||
|
// Message Colors and extra
|
||||||
|
|
||||||
|
Chat.HSplitTop(20.0f, &Section, &Chat);
|
||||||
|
Chat.HSplitTop(10.0f, 0x0, &Chat);
|
||||||
|
|
||||||
|
UI()->DoLabelScaled(&Section, Localize("Messages"), 20.0f, -1);
|
||||||
|
|
||||||
|
const float LineSize = 25.0f;
|
||||||
|
const float WantedPickerPosition = 194.0f;
|
||||||
|
const float LabelSize = 13.0f;
|
||||||
|
const float LineSpacing = 5.0f;
|
||||||
|
|
||||||
char aBuf[64];
|
char aBuf[64];
|
||||||
Left.HSplitTop(20.0f, &Label, &Left);
|
|
||||||
Label.VSplitRight(50.0f, &Label, &Button);
|
|
||||||
Label.VSplitLeft(25.0f, &Enable, &Label);
|
|
||||||
|
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClShowChatSystem, "", g_Config.m_ClShowChatSystem, &Enable))
|
int i = 0;
|
||||||
g_Config.m_ClShowChatSystem ^= 1;
|
static int ResetIDs[24];
|
||||||
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("System message"), 16.0f, -1);
|
|
||||||
{
|
|
||||||
static int s_DefaultButton = 0;
|
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
|
||||||
{
|
|
||||||
ColorHSLA HSL = color_cast<ColorHSLA>(ColorRGBA(1.0f, 1.0f, 0.5f));
|
|
||||||
g_Config.m_ClMessageSystemColor = HSL.Pack(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
CUIRect PickerRect;
|
DoLine_ColorPicker(&ResetIDs[i++], LineSize, WantedPickerPosition, LabelSize, LineSpacing, &Chat, Localize("System message"), &g_Config.m_ClMessageSystemColor, ColorRGBA(1.0f, 1.0f, 0.5f), true, true, &g_Config.m_ClShowChatSystem);
|
||||||
Left.HSplitTop(5.0f, 0x0, &Left);
|
DoLine_ColorPicker(&ResetIDs[i++], LineSize, WantedPickerPosition, LabelSize, LineSpacing, &Chat, Localize("Highlighted message"), &g_Config.m_ClMessageHighlightColor, ColorRGBA(1.0f, 0.5f, 0.5f));
|
||||||
Left.HSplitTop(25.0f, &PickerRect, &Left);
|
DoLine_ColorPicker(&ResetIDs[i++], LineSize, WantedPickerPosition, LabelSize, LineSpacing, &Chat, Localize("Team message"), &g_Config.m_ClMessageTeamColor, ColorRGBA(0.65f, 1.0f, 0.65f));
|
||||||
PickerRect.w = 25.0f;
|
DoLine_ColorPicker(&ResetIDs[i++], LineSize, WantedPickerPosition, LabelSize, LineSpacing, &Chat, Localize("Friend message"), &g_Config.m_ClMessageFriendColor, ColorRGBA(1.0f, 0.137f, 0.137f), true, true, & g_Config.m_ClMessageFriend);
|
||||||
|
DoLine_ColorPicker(&ResetIDs[i++], LineSize, WantedPickerPosition, LabelSize, LineSpacing, &Chat, Localize("Normal message"), &g_Config.m_ClMessageColor, ColorRGBA(1.0f, 1.0f, 1.0f));
|
||||||
|
|
||||||
ColorHSLA SMColor = RenderHSLColorPicker(&PickerRect, &g_Config.m_ClMessageSystemColor, false);
|
|
||||||
ColorRGBA rgb = color_cast<ColorRGBA>(SMColor);
|
|
||||||
|
|
||||||
Left.HSplitTop(10.0f, &Label, &Left);
|
|
||||||
|
|
||||||
TextRender()->TextColor(rgb);
|
|
||||||
|
|
||||||
char aName[16];
|
|
||||||
str_copy(aName, Client()->PlayerName(), sizeof(aName));
|
|
||||||
str_format(aBuf, sizeof(aBuf), "*** '%s' entered and joined the spectators", aName);
|
|
||||||
while(TextRender()->TextWidth(0, 12.0f, aBuf, -1, -1.0f) > Label.w)
|
|
||||||
{
|
|
||||||
aName[str_length(aName) - 1] = 0;
|
|
||||||
str_format(aBuf, sizeof(aBuf), "*** '%s' entered and joined the spectators", aName);
|
|
||||||
}
|
|
||||||
UI()->DoLabelScaled(&Label, aBuf, 12.0f, -1);
|
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
Left.HSplitTop(20.0f, 0, &Left);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
char aBuf[64];
|
|
||||||
Right.HSplitTop(20.0f, &Label, &Right);
|
|
||||||
Label.VSplitRight(50.0f, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Highlighted message"), 16.0f, -1);
|
|
||||||
{
|
|
||||||
static int s_DefaultButton = 0;
|
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
|
||||||
{
|
|
||||||
ColorHSLA HSL = color_cast<ColorHSLA>(ColorRGBA(1.0f, 0.5f, 0.5f));
|
|
||||||
g_Config.m_ClMessageHighlightColor = HSL.Pack(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorHSLA HMColor = RenderHSLScrollbars(&Right, &g_Config.m_ClMessageHighlightColor);
|
|
||||||
|
|
||||||
Right.HSplitTop(10.0f, &Label, &Right);
|
|
||||||
|
|
||||||
TextRender()->TextColor(0.75f, 0.5f, 0.75f, 1.0f);
|
|
||||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Spectator"), -1, -1.0f);
|
|
||||||
Label.VSplitLeft(tw, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Spectator"), 12.0f, -1);
|
|
||||||
|
|
||||||
ColorRGBA rgb = color_cast<ColorRGBA>(HMColor);
|
|
||||||
TextRender()->TextColor(rgb);
|
|
||||||
char aName[16];
|
|
||||||
str_copy(aName, Client()->PlayerName(), sizeof(aName));
|
|
||||||
str_format(aBuf, sizeof(aBuf), ": %s: %s", aName, Localize("Look out!"));
|
|
||||||
while(TextRender()->TextWidth(0, 12.0f, aBuf, -1, -1.0f) > Button.w)
|
|
||||||
{
|
|
||||||
aName[str_length(aName) - 1] = 0;
|
|
||||||
str_format(aBuf, sizeof(aBuf), ": %s: %s", aName, Localize("Look out!"));
|
|
||||||
}
|
|
||||||
UI()->DoLabelScaled(&Button, aBuf, 12.0f, -1);
|
|
||||||
|
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
Right.HSplitTop(20.0f, 0, &Right);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
char aBuf[64];
|
|
||||||
Left.HSplitTop(20.0f, &Label, &Left);
|
|
||||||
Label.VSplitRight(50.0f, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Team message"), 16.0f, -1);
|
|
||||||
{
|
|
||||||
static int s_DefaultButton = 0;
|
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
|
||||||
{
|
|
||||||
ColorHSLA HSL = color_cast<ColorHSLA>(ColorRGBA(0.65f, 1.0f, 0.65f));
|
|
||||||
g_Config.m_ClMessageTeamColor = HSL.Pack(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorHSLA TMColor = RenderHSLScrollbars(&Left, &g_Config.m_ClMessageTeamColor);
|
|
||||||
|
|
||||||
Left.HSplitTop(10.0f, &Label, &Left);
|
|
||||||
|
|
||||||
ColorRGBA rgbn = CalculateNameColor(TMColor);
|
|
||||||
TextRender()->TextColor(rgbn);
|
|
||||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Player"), -1, -1.0f);
|
|
||||||
Label.VSplitLeft(tw, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Player"), 12.0f, -1);
|
|
||||||
|
|
||||||
ColorRGBA rgb = color_cast<ColorRGBA>(TMColor);
|
|
||||||
TextRender()->TextColor(rgb);
|
|
||||||
str_format(aBuf, sizeof(aBuf), ": %s!", Localize("We will win"));
|
|
||||||
UI()->DoLabelScaled(&Button, aBuf, 12.0f, -1);
|
|
||||||
|
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
Left.HSplitTop(20.0f, 0, &Left);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
char aBuf[64];
|
|
||||||
Right.HSplitTop(20.0f, &Label, &Right);
|
|
||||||
Label.VSplitRight(50.0f, &Label, &Button);
|
|
||||||
float twh = TextRender()->TextWidth(0, 16.0f, Localize("Friend message"), -1, -1.0f);
|
|
||||||
Label.VSplitLeft(twh + 5.0f, &Label, &Enable);
|
|
||||||
Enable.VSplitLeft(20.0f, &Enable, 0);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Friend message"), 16.0f, -1);
|
|
||||||
{
|
|
||||||
static int s_DefaultButton = 0;
|
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
|
||||||
g_Config.m_ClMessageFriendColor = ColorHSLA(0, 1, 145 / 255.0f).Pack(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(DoButton_CheckBox(&g_Config.m_ClMessageFriend, Localize("Highlight"), g_Config.m_ClMessageFriend, &Enable))
|
|
||||||
{
|
|
||||||
g_Config.m_ClMessageFriend ^= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorHSLA FMColor = RenderHSLScrollbars(&Right, &g_Config.m_ClMessageFriendColor);
|
|
||||||
|
|
||||||
Right.HSplitTop(10.0f, &Label, &Right);
|
|
||||||
|
|
||||||
ColorRGBA rgbf = color_cast<ColorRGBA>(FMColor);
|
|
||||||
TextRender()->TextColor(rgbf);
|
|
||||||
float hw = TextRender()->TextWidth(0, 12.0f, "♥ ", -1, -1.0f);
|
|
||||||
Label.VSplitLeft(hw, &Heart, &Label);
|
|
||||||
UI()->DoLabelScaled(&Heart, "♥ ", 12.0f, -1);
|
|
||||||
|
|
||||||
TextRender()->TextColor(0.8f, 0.8f, 0.8f, 1.0f);
|
|
||||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Friend"), -1, -1.0f);
|
|
||||||
Label.VSplitLeft(tw, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Friend"), 12.0f, -1);
|
|
||||||
|
|
||||||
ColorRGBA rgb = color_cast<ColorRGBA>(FMColor);
|
|
||||||
TextRender()->TextColor(rgb);
|
|
||||||
str_format(aBuf, sizeof(aBuf), ": %s", Localize("Hi o/"));
|
|
||||||
UI()->DoLabelScaled(&Button, aBuf, 12.0f, -1);
|
|
||||||
|
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
Right.HSplitTop(20.0f, 0, &Right);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
char aBuf[64];
|
|
||||||
Left.HSplitTop(20.0f, &Label, &Left);
|
|
||||||
Label.VSplitRight(50.0f, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Normal message"), 16.0f, -1);
|
|
||||||
{
|
|
||||||
static int s_DefaultButton = 0;
|
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
|
||||||
{
|
|
||||||
ColorHSLA HSL = color_cast<ColorHSLA>(ColorRGBA(1.0f, 1.0f, 1.0f));
|
|
||||||
g_Config.m_ClMessageColor = HSL.Pack(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorHSLA MColor = RenderHSLScrollbars(&Left, &g_Config.m_ClMessageColor);
|
|
||||||
|
|
||||||
Left.HSplitTop(10.0f, &Label, &Left);
|
|
||||||
|
|
||||||
TextRender()->TextColor(0.8f, 0.8f, 0.8f, 1.0f);
|
|
||||||
float tw = TextRender()->TextWidth(0, 12.0f, Localize("Player"), -1, -1.0f);
|
|
||||||
Label.VSplitLeft(tw, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Player"), 12.0f, -1);
|
|
||||||
|
|
||||||
ColorRGBA rgb = color_cast<ColorRGBA>(MColor);
|
|
||||||
TextRender()->TextColor(rgb);
|
|
||||||
str_format(aBuf, sizeof(aBuf), ": %s :D", Localize("Hello and welcome"));
|
|
||||||
UI()->DoLabelScaled(&Button, aBuf, 12.0f, -1);
|
|
||||||
|
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
}
|
|
||||||
{
|
|
||||||
char aBuf[64];
|
|
||||||
Right.HSplitTop(20.0f, &Label, &Right);
|
|
||||||
Label.VSplitRight(50.0f, &Label, &Button);
|
|
||||||
str_format(aBuf, sizeof(aBuf), "%s (echo)", Localize("Client message"));
|
str_format(aBuf, sizeof(aBuf), "%s (echo)", Localize("Client message"));
|
||||||
UI()->DoLabelScaled(&Label, aBuf, 16.0f, -1);
|
DoLine_ColorPicker(&ResetIDs[i++], LineSize, WantedPickerPosition, LabelSize, LineSpacing, &Chat, aBuf, &g_Config.m_ClMessageClientColor, ColorRGBA(0.5f, 0.78f, 1.0f));
|
||||||
|
|
||||||
|
|
||||||
|
// ***** Chat Preview ***** //
|
||||||
|
|
||||||
|
Chat.HSplitTop(10.0f, 0x0, &Chat);
|
||||||
|
Chat.HSplitTop(20.0f, &Section, &Chat);
|
||||||
|
|
||||||
|
UI()->DoLabelScaled(&Section, Localize("Preview"), 20.0f, -1);
|
||||||
|
|
||||||
|
Chat.HSplitTop(10.0f, 0x0, &Chat);
|
||||||
|
Chat.VSplitRight(100.0f, &Chat, 0x0);
|
||||||
|
RenderTools()->DrawUIRect(&Chat, ColorRGBA(0.5f, 0.5f, 0.5f, 1.0f), CUI::CORNER_ALL, 8.0f);
|
||||||
|
Chat.HSplitTop(10.0f, 0x0, &Chat);
|
||||||
|
|
||||||
|
ColorRGBA SystemColor = color_cast<ColorRGBA, ColorHSLA>(ColorHSLA(g_Config.m_ClMessageSystemColor));
|
||||||
|
ColorRGBA HighlightedColor = color_cast<ColorRGBA, ColorHSLA>(ColorHSLA(g_Config.m_ClMessageHighlightColor));
|
||||||
|
ColorRGBA TeamColor = color_cast<ColorRGBA, ColorHSLA>(ColorHSLA(g_Config.m_ClMessageTeamColor));
|
||||||
|
ColorRGBA FriendColor = color_cast<ColorRGBA, ColorHSLA>(ColorHSLA(g_Config.m_ClMessageFriendColor));
|
||||||
|
ColorRGBA NormalColor = color_cast<ColorRGBA, ColorHSLA>(ColorHSLA(g_Config.m_ClMessageColor));
|
||||||
|
ColorRGBA ClientColor = color_cast<ColorRGBA, ColorHSLA>(ColorHSLA(g_Config.m_ClMessageClientColor));
|
||||||
|
ColorRGBA DefaultNameColor(0.8f, 0.8f, 0.8f, 1.0f);
|
||||||
|
|
||||||
|
constexpr float RealFontSize = CChat::FONT_SIZE * 2;
|
||||||
|
const float RealMsgPaddingX = (g_Config.m_ClChatBackground ? CChat::MESSAGE_PADDING_X : 0) * 2;
|
||||||
|
const float RealMsgPaddingY = (g_Config.m_ClChatBackground ? CChat::MESSAGE_PADDING_Y : (g_Config.m_ClChatTee ? (CChat::MESSAGE_TEE_SIZE - CChat::FONT_SIZE) : 0)) * 2;
|
||||||
|
const float RealMsgPaddingTee = (g_Config.m_ClChatTee ? CChat::MESSAGE_TEE_SIZE + CChat::MESSAGE_TEE_PADDING_RIGHT : 0) * 2;
|
||||||
|
const float RealOffsetY = RealFontSize + RealMsgPaddingY;
|
||||||
|
|
||||||
|
const float X = 5.0f + RealMsgPaddingX / 2.0f + Chat.x;
|
||||||
|
float Y = Chat.y;
|
||||||
|
|
||||||
|
CTextCursor Cursor;
|
||||||
|
TextRender()->SetCursor(&Cursor, X, Y, RealFontSize, TEXTFLAG_RENDER);
|
||||||
|
|
||||||
|
str_copy(aBuf, Client()->PlayerName(), sizeof(aBuf));
|
||||||
|
|
||||||
|
// Backgrounds first
|
||||||
|
if(g_Config.m_ClChatBackground)
|
||||||
{
|
{
|
||||||
static int s_DefaultButton = 0;
|
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
|
||||||
{
|
|
||||||
ColorHSLA HSL = color_cast<ColorHSLA>(ColorRGBA(0.5f, 0.78f, 1.0f));
|
|
||||||
g_Config.m_ClMessageClientColor = HSL.Pack(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorHSLA CMColor = RenderHSLScrollbars(&Right, &g_Config.m_ClMessageClientColor);
|
|
||||||
|
|
||||||
Right.HSplitTop(10.0f, &Label, &Right);
|
|
||||||
|
|
||||||
ColorRGBA rgb = color_cast<ColorRGBA>(CMColor);
|
|
||||||
TextRender()->TextColor(rgb);
|
|
||||||
|
|
||||||
UI()->DoLabelScaled(&Label, "*** Dynamic camera activated", 12.0f, -1);
|
|
||||||
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 1.0f);
|
|
||||||
Right.HSplitTop(20.0f, 0, &Right);
|
|
||||||
}*/
|
|
||||||
}
|
|
||||||
else if(Page == 2)
|
|
||||||
{
|
|
||||||
Left.HSplitTop(220.0f, &Laser, &Left);
|
|
||||||
//RenderTools()->DrawUIRect(&Laser, vec4(1.0f, 1.0f, 1.0f, 0.1f), CUI::CORNER_ALL, 5.0f);
|
|
||||||
//Laser.Margin(10.0f, &Laser);
|
|
||||||
Laser.HSplitTop(30.0f, &Label, &Laser);
|
|
||||||
Label.VSplitLeft(TextRender()->TextWidth(0, 20.0f, Localize("Laser"), -1, -1.0f) + 5.0f, &Label, &Weapon);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Laser"), 20.0f, -1);
|
|
||||||
|
|
||||||
Laser.HSplitTop(20.0f, &Label, &Laser);
|
|
||||||
Label.VSplitLeft(5.0f, 0, &Label);
|
|
||||||
Label.VSplitRight(50.0f, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Inner color"), 16.0f, -1);
|
|
||||||
{
|
|
||||||
static int s_DefaultButton = 0;
|
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
|
||||||
{
|
|
||||||
ColorHSLA HSL = color_cast<ColorHSLA>(ColorRGBA(0.5f, 0.5f, 1.0f));
|
|
||||||
g_Config.m_ClLaserInnerColor = HSL.Pack(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorHSLA LIColor = RenderHSLScrollbars(&Laser, &g_Config.m_ClLaserInnerColor);
|
|
||||||
|
|
||||||
Laser.HSplitTop(10.0f, 0, &Laser);
|
|
||||||
|
|
||||||
Laser.HSplitTop(20.0f, &Label, &Laser);
|
|
||||||
Label.VSplitLeft(5.0f, 0, &Label);
|
|
||||||
Label.VSplitRight(50.0f, &Label, &Button);
|
|
||||||
UI()->DoLabelScaled(&Label, Localize("Outline color"), 16.0f, -1);
|
|
||||||
{
|
|
||||||
static int s_DefaultButton = 0;
|
|
||||||
if(DoButton_Menu(&s_DefaultButton, Localize("Reset"), 0, &Button))
|
|
||||||
{
|
|
||||||
ColorHSLA HSL = color_cast<ColorHSLA>(ColorRGBA(0.075f, 0.075f, 0.25f));
|
|
||||||
g_Config.m_ClLaserOutlineColor = HSL.Pack(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ColorHSLA LOColor = RenderHSLScrollbars(&Laser, &g_Config.m_ClLaserOutlineColor);
|
|
||||||
|
|
||||||
Weapon.VSplitLeft(30.0f, 0, &Weapon);
|
|
||||||
|
|
||||||
ColorRGBA RGB;
|
|
||||||
vec2 From = vec2(Weapon.x, Weapon.y + Weapon.h / 2.0f);
|
|
||||||
vec2 Pos = vec2(Weapon.x + Weapon.w - 10.0f, Weapon.y + Weapon.h / 2.0f);
|
|
||||||
|
|
||||||
vec2 Out, Border;
|
|
||||||
|
|
||||||
Graphics()->BlendNormal();
|
|
||||||
Graphics()->TextureClear();
|
Graphics()->TextureClear();
|
||||||
Graphics()->QuadsBegin();
|
Graphics()->QuadsBegin();
|
||||||
|
Graphics()->SetColor(0, 0, 0, 0.12f);
|
||||||
|
|
||||||
// do outline
|
char LineBuilder[128];
|
||||||
RGB = color_cast<ColorRGBA>(LOColor);
|
float Width;
|
||||||
ColorRGBA OuterColor(RGB.r, RGB.g, RGB.b, 1.0f);
|
float TempY = Y;
|
||||||
Graphics()->SetColor(RGB.r, RGB.g, RGB.b, 1.0f); // outline
|
|
||||||
Out = vec2(0.0f, -1.0f) * (3.15f);
|
|
||||||
|
|
||||||
IGraphics::CFreeformItem Freeform(
|
if(g_Config.m_ClShowChatSystem)
|
||||||
From.x - Out.x, From.y - Out.y,
|
|
||||||
From.x + Out.x, From.y + Out.y,
|
|
||||||
Pos.x - Out.x, Pos.y - Out.y,
|
|
||||||
Pos.x + Out.x, Pos.y + Out.y);
|
|
||||||
Graphics()->QuadsDrawFreeform(&Freeform, 1);
|
|
||||||
|
|
||||||
// do inner
|
|
||||||
RGB = color_cast<ColorRGBA>(LIColor);
|
|
||||||
ColorRGBA InnerColor(RGB.r, RGB.g, RGB.b, 1.0f);
|
|
||||||
Out = vec2(0.0f, -1.0f) * (2.25f);
|
|
||||||
Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f); // center
|
|
||||||
|
|
||||||
Freeform = IGraphics::CFreeformItem(
|
|
||||||
From.x - Out.x, From.y - Out.y,
|
|
||||||
From.x + Out.x, From.y + Out.y,
|
|
||||||
Pos.x - Out.x, Pos.y - Out.y,
|
|
||||||
Pos.x + Out.x, Pos.y + Out.y);
|
|
||||||
Graphics()->QuadsDrawFreeform(&Freeform, 1);
|
|
||||||
|
|
||||||
Graphics()->QuadsEnd();
|
|
||||||
|
|
||||||
// render head
|
|
||||||
{
|
{
|
||||||
Graphics()->BlendNormal();
|
Width = TextRender()->TextWidth(0, RealFontSize, "*** 'Evgesha' entered and joined the game", -1, -1);
|
||||||
int SpriteIndex = time_get() % 3;
|
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX, RealFontSize + RealMsgPaddingY, 8.0f, CUI::CORNER_ALL);
|
||||||
Graphics()->TextureSet(GameClient()->m_ParticlesSkin.m_SpriteParticleSplat[SpriteIndex]);
|
TempY += RealOffsetY;
|
||||||
Graphics()->QuadsBegin();
|
|
||||||
|
|
||||||
Graphics()->QuadsSetRotation(time_get());
|
|
||||||
Graphics()->SetColor(OuterColor.r, OuterColor.g, OuterColor.b, 1.0f);
|
|
||||||
IGraphics::CQuadItem QuadItem(Pos.x, Pos.y, 24, 24);
|
|
||||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
|
||||||
Graphics()->SetColor(InnerColor.r, InnerColor.g, InnerColor.b, 1.0f);
|
|
||||||
QuadItem = IGraphics::CQuadItem(Pos.x, Pos.y, 20, 20);
|
|
||||||
Graphics()->QuadsDraw(&QuadItem, 1);
|
|
||||||
Graphics()->QuadsEnd();
|
|
||||||
}
|
}
|
||||||
// draw laser weapon
|
|
||||||
Graphics()->TextureSet(GameClient()->m_GameSkin.m_SpriteWeaponLaser);
|
|
||||||
Graphics()->QuadsBegin();
|
|
||||||
|
|
||||||
RenderTools()->SelectSprite(SPRITE_WEAPON_LASER_BODY);
|
if(g_Config.m_ClShowIDs)
|
||||||
Graphics()->QuadsSetSubset(0, 0, 1, 1);
|
str_copy(LineBuilder, " 7: DDRacer2002: Hey, how are you ", sizeof(LineBuilder));
|
||||||
RenderTools()->DrawSprite(Weapon.x, Weapon.y + Weapon.h / 2.0f, 60.0f);
|
|
||||||
|
|
||||||
Graphics()->QuadsEnd();
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
Left.VSplitLeft(20.0f, 0, &Left);
|
|
||||||
Left.HSplitTop(20.0f, &Label, &Left);
|
|
||||||
Button.VSplitRight(20.0f, &Button, 0);
|
|
||||||
char aBuf[64];
|
|
||||||
if(g_Config.m_ClReconnectTimeout == 1)
|
|
||||||
{
|
|
||||||
str_format(aBuf, sizeof(aBuf), "%s %i %s", Localize("Wait before try for"), g_Config.m_ClReconnectTimeout, Localize("second"));
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
str_copy(LineBuilder, "DDRacer2002: Hey, how are you ", sizeof(LineBuilder));
|
||||||
str_format(aBuf, sizeof(aBuf), "%s %i %s", Localize("Wait before try for"), g_Config.m_ClReconnectTimeout, Localize("seconds"));
|
str_append(LineBuilder, aBuf, sizeof(LineBuilder));
|
||||||
|
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||||
|
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX + RealMsgPaddingTee, RealFontSize + RealMsgPaddingY, 8.0f, CUI::CORNER_ALL);
|
||||||
|
TempY += RealOffsetY;
|
||||||
|
|
||||||
|
if(g_Config.m_ClShowIDs)
|
||||||
|
str_copy(LineBuilder, "11: Your Teammate: Let's speedrun this!", sizeof(LineBuilder));
|
||||||
|
else
|
||||||
|
str_copy(LineBuilder, "Your Teammate: Let's speedrun this!", sizeof(LineBuilder));
|
||||||
|
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||||
|
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX + RealMsgPaddingTee, RealFontSize + RealMsgPaddingY, 8.0f, CUI::CORNER_ALL);
|
||||||
|
TempY += RealOffsetY;
|
||||||
|
|
||||||
|
if(g_Config.m_ClShowIDs)
|
||||||
|
str_copy(LineBuilder, "♥ 8: Friend: Hello there", sizeof(LineBuilder));
|
||||||
|
else
|
||||||
|
str_copy(LineBuilder, "♥ Friend: Hello there", sizeof(LineBuilder));
|
||||||
|
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||||
|
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX + RealMsgPaddingTee, RealFontSize + RealMsgPaddingY, 8.0f, CUI::CORNER_ALL);
|
||||||
|
TempY += RealOffsetY;
|
||||||
|
|
||||||
|
if(g_Config.m_ClShowIDs)
|
||||||
|
str_copy(LineBuilder, " 9: Spammer [6]: Hey fools, I'm spamming here!", sizeof(LineBuilder));
|
||||||
|
else
|
||||||
|
str_copy(LineBuilder, "Spammer [6]: Hey fools, I'm spamming here!", sizeof(LineBuilder));
|
||||||
|
Width = TextRender()->TextWidth(0, RealFontSize, LineBuilder, -1, -1);
|
||||||
|
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX + RealMsgPaddingTee, RealFontSize + RealMsgPaddingY, 8.0f, CUI::CORNER_ALL);
|
||||||
|
TempY += RealOffsetY;
|
||||||
|
|
||||||
|
Width = TextRender()->TextWidth(0, RealFontSize, "*** Echo command executed", -1, -1);
|
||||||
|
RenderTools()->DrawRoundRectExt(X - RealMsgPaddingX / 2.0f, TempY - RealMsgPaddingY / 2.0f, Width + RealMsgPaddingX, RealFontSize + RealMsgPaddingY, 8.0f, CUI::CORNER_ALL);
|
||||||
|
TempY += RealOffsetY;
|
||||||
|
|
||||||
|
Graphics()->QuadsEnd();
|
||||||
}
|
}
|
||||||
UI()->DoLabelScaled(&Label, aBuf, 13.0f, -1);
|
|
||||||
Left.HSplitTop(20.0f, &Button, 0);
|
CAnimState *pIdleState = CAnimState::GetIdle();
|
||||||
Button.HMargin(2.0f, &Button);
|
constexpr int PreviewTeeCount = 4;
|
||||||
g_Config.m_ClReconnectTimeout = static_cast<int>(DoScrollbarH(&g_Config.m_ClReconnectTimeout, &Button, g_Config.m_ClReconnectTimeout / 120.0f) * 120.0f);
|
constexpr float RealTeeSize = CChat::MESSAGE_TEE_SIZE * 2;
|
||||||
if(g_Config.m_ClReconnectTimeout < 5)
|
constexpr float RealTeeSizeHalved = CChat::MESSAGE_TEE_SIZE;
|
||||||
g_Config.m_ClReconnectTimeout = 5;*/
|
constexpr float TWSkinUnreliableOffset = 0.5f;
|
||||||
|
constexpr float OffsetTeeY = RealTeeSizeHalved / 2.0f;
|
||||||
|
const float FullHeightMinusTee = RealOffsetY - RealTeeSize;
|
||||||
|
|
||||||
|
CTeeRenderInfo RenderInfo[PreviewTeeCount];
|
||||||
|
|
||||||
|
if(g_Config.m_ClChatTee)
|
||||||
|
{
|
||||||
|
int DefaultInd = GameClient()->m_pSkins->Find("default");
|
||||||
|
|
||||||
|
for(int i = 0; i < PreviewTeeCount; i++)
|
||||||
|
{
|
||||||
|
RenderInfo[i].m_Size = RealTeeSize;
|
||||||
|
RenderInfo[i].m_CustomColoredSkin = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ind = -1;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
RenderInfo[i++].m_OriginalRenderSkin = GameClient()->m_pSkins->Get(DefaultInd)->m_OriginalSkin;
|
||||||
|
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_pSkins->Find("bluekitty")) != -1 ? GameClient()->m_pSkins->Get(ind)->m_OriginalSkin : GameClient()->m_pSkins->Get(DefaultInd)->m_OriginalSkin;
|
||||||
|
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_pSkins->Find("cammostripes")) != -1 ? GameClient()->m_pSkins->Get(ind)->m_OriginalSkin : GameClient()->m_pSkins->Get(DefaultInd)->m_OriginalSkin;
|
||||||
|
RenderInfo[i++].m_OriginalRenderSkin = (ind = GameClient()->m_pSkins->Find("beast")) != -1 ? GameClient()->m_pSkins->Get(ind)->m_OriginalSkin : GameClient()->m_pSkins->Get(DefaultInd)->m_OriginalSkin;
|
||||||
|
}
|
||||||
|
|
||||||
|
// System
|
||||||
|
if(g_Config.m_ClShowChatSystem)
|
||||||
|
{
|
||||||
|
TextRender()->TextColor(SystemColor);
|
||||||
|
TextRender()->TextEx(&Cursor, "*** 'Evgesha' entered and joined the game", -1);
|
||||||
|
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Highlighted
|
||||||
|
TextRender()->MoveCursor(&Cursor, RealMsgPaddingTee, 0);
|
||||||
|
TextRender()->TextColor(DefaultNameColor);
|
||||||
|
if(g_Config.m_ClShowIDs)
|
||||||
|
TextRender()->TextEx(&Cursor, " 7: DDRacer2002: ", -1);
|
||||||
|
else
|
||||||
|
TextRender()->TextEx(&Cursor, "DDRacer2002: ", -1);
|
||||||
|
TextRender()->TextColor(HighlightedColor);
|
||||||
|
TextRender()->TextEx(&Cursor, "Hey, how are you ", -1);
|
||||||
|
TextRender()->TextEx(&Cursor, aBuf, -1);
|
||||||
|
if(g_Config.m_ClChatTee)
|
||||||
|
RenderTools()->RenderTee(pIdleState, &RenderInfo[0], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||||
|
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||||
|
|
||||||
|
// Team
|
||||||
|
TextRender()->MoveCursor(&Cursor, RealMsgPaddingTee, 0);
|
||||||
|
TextRender()->TextColor(TeamColor);
|
||||||
|
if(g_Config.m_ClShowIDs)
|
||||||
|
TextRender()->TextEx(&Cursor, "11: Your Teammate: ", -1);
|
||||||
|
else
|
||||||
|
TextRender()->TextEx(&Cursor, "Your Teammate: ", -1);
|
||||||
|
TextRender()->TextEx(&Cursor, "Let's speedrun this!", -1);
|
||||||
|
if(g_Config.m_ClChatTee)
|
||||||
|
RenderTools()->RenderTee(pIdleState, &RenderInfo[1], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||||
|
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||||
|
|
||||||
|
// Friend
|
||||||
|
TextRender()->MoveCursor(&Cursor, RealMsgPaddingTee, 0);
|
||||||
|
if(g_Config.m_ClMessageFriend)
|
||||||
|
{
|
||||||
|
TextRender()->TextColor(FriendColor);
|
||||||
|
TextRender()->TextEx(&Cursor, "♥ ", -1);
|
||||||
|
}
|
||||||
|
TextRender()->TextColor(DefaultNameColor);
|
||||||
|
if(g_Config.m_ClShowIDs)
|
||||||
|
TextRender()->TextEx(&Cursor, " 8: Friend: ", -1);
|
||||||
|
else
|
||||||
|
TextRender()->TextEx(&Cursor, "Friend: ", -1);
|
||||||
|
TextRender()->TextColor(NormalColor);
|
||||||
|
TextRender()->TextEx(&Cursor, "Hello there", -1);
|
||||||
|
if(g_Config.m_ClChatTee)
|
||||||
|
RenderTools()->RenderTee(pIdleState, &RenderInfo[2], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||||
|
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||||
|
|
||||||
|
// Normal
|
||||||
|
TextRender()->MoveCursor(&Cursor, RealMsgPaddingTee, 0);
|
||||||
|
TextRender()->TextColor(DefaultNameColor);
|
||||||
|
if(g_Config.m_ClShowIDs)
|
||||||
|
TextRender()->TextEx(&Cursor, " 9: Spammer ", -1);
|
||||||
|
else
|
||||||
|
TextRender()->TextEx(&Cursor, "Spammer ", -1);
|
||||||
|
TextRender()->TextColor(1.0f, 1.0f, 1.0f, 0.3f);
|
||||||
|
TextRender()->TextEx(&Cursor, "[6]", -1);
|
||||||
|
TextRender()->TextColor(NormalColor);
|
||||||
|
TextRender()->TextEx(&Cursor, ": Hey fools, I'm spamming here!", -1);
|
||||||
|
if(g_Config.m_ClChatTee)
|
||||||
|
RenderTools()->RenderTee(pIdleState, &RenderInfo[3], EMOTE_NORMAL, vec2(1, 0.1f), vec2(X + RealTeeSizeHalved, Y + OffsetTeeY + FullHeightMinusTee / 2.0f + TWSkinUnreliableOffset));
|
||||||
|
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||||
|
|
||||||
|
// Client
|
||||||
|
TextRender()->TextColor(ClientColor);
|
||||||
|
TextRender()->TextEx(&Cursor, "*** Echo command executed", -1);
|
||||||
|
TextRender()->SetCursorPosition(&Cursor, X, Y += RealOffsetY);
|
||||||
|
|
||||||
|
TextRender()->TextColor(1, 1, 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
void CMenus::RenderSettingsDDNet(CUIRect MainView)
|
||||||
|
|
|
@ -224,6 +224,7 @@ public:
|
||||||
float MouseWorldY() const { return m_MouseWorldY; }
|
float MouseWorldY() const { return m_MouseWorldY; }
|
||||||
int MouseButton(int Index) const { return (m_MouseButtons >> Index) & 1; }
|
int MouseButton(int Index) const { return (m_MouseButtons >> Index) & 1; }
|
||||||
int MouseButtonClicked(int Index) { return MouseButton(Index) && !((m_LastMouseButtons >> Index) & 1); }
|
int MouseButtonClicked(int Index) { return MouseButton(Index) && !((m_LastMouseButtons >> Index) & 1); }
|
||||||
|
int MouseButtonReleased(int Index) {return ((m_LastMouseButtons >> Index) & 1) && !MouseButton(Index); }
|
||||||
|
|
||||||
void SetHotItem(const void *pID) { m_pBecommingHotItem = pID; }
|
void SetHotItem(const void *pID) { m_pBecommingHotItem = pID; }
|
||||||
void SetActiveItem(const void *pID)
|
void SetActiveItem(const void *pID)
|
||||||
|
|
Loading…
Reference in a new issue