diff --git a/CMakeLists.txt b/CMakeLists.txt index c8b11ba58..730d2ee98 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1229,8 +1229,6 @@ set(EXPECTED_DATA countryflags/default.png countryflags/index.txt debug_font.png - demo_buttons.png - demo_buttons2.png editor/audio_source.png editor/background.png editor/basic_freeze.rules diff --git a/data/demo_buttons.png b/data/demo_buttons.png deleted file mode 100644 index 7bcd6ba5b..000000000 Binary files a/data/demo_buttons.png and /dev/null differ diff --git a/data/demo_buttons2.png b/data/demo_buttons2.png deleted file mode 100644 index 2d5bfc48a..000000000 Binary files a/data/demo_buttons2.png and /dev/null differ diff --git a/data/fonts/Icons.otf b/data/fonts/Icons.otf index dc287d5c6..d9390449d 100644 Binary files a/data/fonts/Icons.otf and b/data/fonts/Icons.otf differ diff --git a/datasrc/content.py b/datasrc/content.py index 7675d7958..29f09d387 100644 --- a/datasrc/content.py +++ b/datasrc/content.py @@ -230,12 +230,10 @@ image_particles = Image("particles", "particles.png") image_game = Image("game", "game.png") image_emoticons = Image("emoticons", "emoticons.png") image_speedup_arrow = Image("speedup_arrow", "editor/speed_arrow.png") -image_demobuttons = Image("demobuttons", "demo_buttons.png") image_fileicons = Image("fileicons", "file_icons.png") image_guibuttons = Image("guibuttons", "gui_buttons.png") image_guiicons = Image("guiicons", "gui_icons.png") image_arrow = Image("arrow", "arrow.png") -image_demobuttons2 = Image("demobuttons2", "demo_buttons2.png") image_audio_source = Image("audio_source", "editor/audio_source.png") image_strongweak = Image("strongweak", "strong_weak.png") image_hud = Image("hud", "hud.png") @@ -250,12 +248,10 @@ container.images.Add(image_emoticons) container.images.Add(Image("console_bg", "console.png")) container.images.Add(Image("console_bar", "console_bar.png")) container.images.Add(image_speedup_arrow) -container.images.Add(image_demobuttons) container.images.Add(image_fileicons) container.images.Add(image_guibuttons) container.images.Add(image_guiicons) container.images.Add(image_arrow) -container.images.Add(image_demobuttons2) container.images.Add(image_audio_source) container.images.Add(image_strongweak) container.images.Add(image_hud) @@ -275,11 +271,9 @@ set_game = SpriteSet("game", image_game, 32, 16) set_tee = SpriteSet("tee", image_null, 8, 4) set_emoticons = SpriteSet("emoticons", image_emoticons, 4, 4) set_speedup_arrow = SpriteSet("speedup_arrow", image_speedup_arrow, 1, 1) -set_demobuttons = SpriteSet("demobuttons", image_demobuttons, 5, 1) set_fileicons = SpriteSet("fileicons", image_fileicons, 8, 1) set_guibuttons = SpriteSet("guibuttons", image_guibuttons, 12, 4) set_guiicons = SpriteSet("guiicons", image_guiicons, 12, 2) -set_demobuttons2 = SpriteSet("demobuttons2", image_demobuttons2, 4, 1) set_audio_source = SpriteSet("audio_source", image_audio_source, 1, 1) set_strongweak = SpriteSet("strongweak", image_strongweak, 2, 1) set_hud = SpriteSet("hud", image_hud, 16, 16) @@ -290,11 +284,9 @@ container.spritesets.Add(set_game) container.spritesets.Add(set_tee) container.spritesets.Add(set_emoticons) container.spritesets.Add(set_speedup_arrow) -container.spritesets.Add(set_demobuttons) container.spritesets.Add(set_fileicons) container.spritesets.Add(set_guibuttons) container.spritesets.Add(set_guiicons) -container.spritesets.Add(set_demobuttons2) container.spritesets.Add(set_audio_source) container.spritesets.Add(set_strongweak) container.spritesets.Add(set_hud) @@ -416,17 +408,6 @@ container.sprites.Add(Sprite("question", set_emoticons, 3, 3, 1, 1)) container.sprites.Add(Sprite("speedup_arrow", set_speedup_arrow, 0,0,1,1)) -container.sprites.Add(Sprite("demobutton_play", set_demobuttons, 0,0,1,1)) -container.sprites.Add(Sprite("demobutton_pause", set_demobuttons, 1,0,1,1)) -container.sprites.Add(Sprite("demobutton_stop", set_demobuttons, 2,0,1,1)) -container.sprites.Add(Sprite("demobutton_slower", set_demobuttons, 3,0,1,1)) -container.sprites.Add(Sprite("demobutton_faster", set_demobuttons, 4,0,1,1)) - -container.sprites.Add(Sprite("demobutton_slice_begin", set_demobuttons2, 0,0,1,1)) -container.sprites.Add(Sprite("demobutton_slice_end", set_demobuttons2, 1,0,1,1)) -container.sprites.Add(Sprite("demobutton_shortcuts_enabled", set_demobuttons2, 2,0,1,1)) -container.sprites.Add(Sprite("demobutton_shortcuts_disabled", set_demobuttons2, 3,0,1,1)) - container.sprites.Add(Sprite("file_demo1", set_fileicons, 0,0,1,1)) container.sprites.Add(Sprite("file_demo2", set_fileicons, 1,0,1,1)) container.sprites.Add(Sprite("file_folder", set_fileicons, 2,0,1,1)) diff --git a/src/game/client/components/menus.cpp b/src/game/client/components/menus.cpp index 4e28328bd..907525b78 100644 --- a/src/game/client/components/menus.cpp +++ b/src/game/client/components/menus.cpp @@ -2075,14 +2075,14 @@ int CMenus::Render() Part.VSplitLeft(5.0f, 0, &Part); Part.VSplitLeft(ButtonSize, &Button, &Part); static CButtonContainer s_SlowDownButton; - if(DoButton_Sprite(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, 0, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_SlowDownButton, "\xEF\x81\x8A", 0, &Button, IGraphics::CORNER_ALL)) DecDemoSpeed = true; // fastforward Part.VSplitLeft(5.0f, 0, &Part); Part.VSplitLeft(ButtonSize, &Button, &Part); static CButtonContainer s_FastForwardButton; - if(DoButton_Sprite(&s_FastForwardButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_FASTER, 0, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_FastForwardButton, "\xEF\x81\x8e", 0, &Button, IGraphics::CORNER_ALL)) IncDemoSpeed = true; // speed meter diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index a3476aae4..73e33cf9a 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -78,7 +78,7 @@ class CMenus : public CComponent char m_aLocalStringHelper[1024]; int DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, const CUIRect *pRect); - int DoButton_Sprite(CButtonContainer *pButtonContainer, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners); + int DoButton_Sprite(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners); int DoButton_Toggle(const void *pID, int Checked, const CUIRect *pRect, bool Active); int DoButton_Menu(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, const char *pImageName = nullptr, int Corners = IGraphics::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(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners, SUIAnimator *pAnimator = nullptr, const ColorRGBA *pDefaultColor = nullptr, const ColorRGBA *pActiveColor = nullptr, const ColorRGBA *pHoverColor = nullptr, float EdgeRounding = 10, int AlignVertically = 1); diff --git a/src/game/client/components/menus_demo.cpp b/src/game/client/components/menus_demo.cpp index adac73fc8..e31f80282 100644 --- a/src/game/client/components/menus_demo.cpp +++ b/src/game/client/components/menus_demo.cpp @@ -34,17 +34,17 @@ int CMenus::DoButton_DemoPlayer(const void *pID, const char *pText, int Checked, return UI()->DoButtonLogic(pID, Checked, pRect); } -int CMenus::DoButton_Sprite(CButtonContainer *pButtonContainer, int ImageID, int SpriteID, int Checked, const CUIRect *pRect, int Corners) -{ +int CMenus::DoButton_Sprite(CButtonContainer *pButtonContainer, const char *pText, int Checked, const CUIRect *pRect, int Corners) +{ pRect->Draw(ColorRGBA(1.0f, 1.0f, 1.0f, (Checked ? 0.10f : 0.5f) * UI()->ButtonColorMul(pButtonContainer)), Corners, 5.0f); - Graphics()->TextureSet(g_pData->m_aImages[ImageID].m_Id); - Graphics()->QuadsBegin(); - if(!Checked) - Graphics()->SetColor(1.0f, 1.0f, 1.0f, 0.5f); - RenderTools()->SelectSprite(SpriteID); - IGraphics::CQuadItem QuadItem(pRect->x, pRect->y, pRect->w, pRect->h); - Graphics()->QuadsDrawTL(&QuadItem, 1); - Graphics()->QuadsEnd(); + + TextRender()->SetCurFont(TextRender()->GetFont(TEXT_FONT_ICON_FONT)); + CUIRect Rect = *pRect; + CUIRect Temp; + Rect.HMargin(2.0f, &Temp); + SLabelProperties Props; + UI()->DoLabel(&Temp, pText, Temp.h * CUI::ms_FontmodHeight, TEXTALIGN_CENTER, Props); + TextRender()->SetCurFont(NULL); return UI()->DoButtonLogic(pButtonContainer, Checked, pRect); } @@ -393,7 +393,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) // combined play and pause button ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static CButtonContainer s_PlayPauseButton; - if(DoButton_Sprite(&s_PlayPauseButton, IMAGE_DEMOBUTTONS, pInfo->m_Paused ? SPRITE_DEMOBUTTON_PLAY : SPRITE_DEMOBUTTON_PAUSE, false, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_PlayPauseButton, pInfo->m_Paused ? "\xEF\x81\x8B" : "\xEF\x81\x8C", false, &Button, IGraphics::CORNER_ALL)) + //IMAGE_DEMOBUTTONS, pInfo->m_Paused ? SPRITE_DEMOBUTTON_PLAY : SPRITE_DEMOBUTTON_PAUSE { if(pInfo->m_Paused) { @@ -410,7 +411,8 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static CButtonContainer s_ResetButton; - if(DoButton_Sprite(&s_ResetButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_STOP, false, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_ResetButton, "\xEF\x81\x8D", false, &Button, IGraphics::CORNER_ALL)) + //IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_STOP { DemoPlayer()->Pause(); DemoPlayer()->SeekPercent(0.0f); @@ -420,14 +422,14 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static CButtonContainer s_SlowDownButton; - if(DoButton_Sprite(&s_SlowDownButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_SLOWER, 0, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_SlowDownButton, "\xEF\x81\x8A", 0, &Button, IGraphics::CORNER_ALL)) DecreaseDemoSpeed = true; // fastforward ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static CButtonContainer s_FastForwardButton; - if(DoButton_Sprite(&s_FastForwardButton, IMAGE_DEMOBUTTONS, SPRITE_DEMOBUTTON_FASTER, 0, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_FastForwardButton, "\xEF\x81\x8e", 0, &Button, IGraphics::CORNER_ALL)) IncreaseDemoSpeed = true; // speed meter @@ -440,21 +442,21 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) ButtonBar.VSplitLeft(Margins * 10, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static CButtonContainer s_SliceBeginButton; - if(DoButton_Sprite(&s_SliceBeginButton, IMAGE_DEMOBUTTONS2, SPRITE_DEMOBUTTON_SLICE_BEGIN, 0, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_SliceBeginButton, "\xEF\x8B\xB5", 0, &Button, IGraphics::CORNER_ALL)) Client()->DemoSliceBegin(); // slice end button ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static CButtonContainer s_SliceEndButton; - if(DoButton_Sprite(&s_SliceEndButton, IMAGE_DEMOBUTTONS2, SPRITE_DEMOBUTTON_SLICE_END, 0, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_SliceEndButton, "\xEF\x8B\xB6", 0, &Button, IGraphics::CORNER_ALL)) Client()->DemoSliceEnd(); // slice save button ButtonBar.VSplitLeft(Margins, 0, &ButtonBar); ButtonBar.VSplitLeft(ButtonbarHeight, &Button, &ButtonBar); static CButtonContainer s_SliceSaveButton; - if(DoButton_Sprite(&s_SliceSaveButton, IMAGE_FILEICONS, SPRITE_FILE_DEMO2, 0, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_SliceSaveButton, "\xF0\x9F\x96\xAA", 0, &Button, IGraphics::CORNER_ALL)) { str_copy(m_aCurrentDemoFile, m_vDemos[m_DemolistSelectedIndex].m_aFilename); m_aDemoPlayerPopupHint[0] = '\0'; @@ -474,8 +476,7 @@ void CMenus::RenderDemoPlayer(CUIRect MainView) ButtonBar.VSplitRight(Margins * 3, &ButtonBar, 0); ButtonBar.VSplitRight(ButtonbarHeight, &ButtonBar, &Button); static CButtonContainer s_KeyboardShortcutsButton; - int Sprite = g_Config.m_ClDemoKeyboardShortcuts ? SPRITE_DEMOBUTTON_SHORTCUTS_ENABLED : SPRITE_DEMOBUTTON_SHORTCUTS_DISABLED; - if(DoButton_Sprite(&s_KeyboardShortcutsButton, IMAGE_DEMOBUTTONS2, Sprite, 0, &Button, IGraphics::CORNER_ALL)) + if(DoButton_Sprite(&s_KeyboardShortcutsButton, g_Config.m_ClDemoKeyboardShortcuts ? "\xE2\x8C\xA8" : "\xEF\x81\xAE", 0, &Button, IGraphics::CORNER_ALL)) { g_Config.m_ClDemoKeyboardShortcuts ^= 1; }