diff --git a/src/ui/mainui.cpp b/src/ui/mainui.cpp index cdc57702..4248822b 100644 --- a/src/ui/mainui.cpp +++ b/src/ui/mainui.cpp @@ -20,8 +20,6 @@ #include "ui/mainui.h" -#include "common/config.h" - #include "app/app.h" #include "common/event.h" @@ -35,6 +33,8 @@ #include "sound/sound.h" +#include "ui/maindialog.h" + #include "ui/screen/screen.h" #include "ui/screen/screen_apperance.h" #include "ui/screen/screen_io_read.h" @@ -53,7 +53,6 @@ #include "ui/controls/interface.h" #include "ui/controls/label.h" -#include "ui/maindialog.h" #include "ui/controls/window.h" namespace Ui @@ -224,26 +223,6 @@ void CMainUserInterface::ChangePhase(Phase phase) } } - if ( IsMainMenuPhase(m_phase) && - m_phase != PHASE_WELCOME1 && - m_phase != PHASE_WELCOME2 && - m_phase != PHASE_WELCOME3 ) - { - CWindow* pw = static_cast(m_interface->SearchControl(EVENT_WINDOW5)); - if (pw != nullptr) - { - Math::Point pos, ddim; - - pos.x = 540.0f/640.0f; - pos.y = 9.0f/480.0f; - ddim.x = 90.0f/640.0f; - ddim.y = 10.0f/480.0f; - CLabel* pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY); - pl->SetFontType(Gfx::FONT_COURIER); - pl->SetFontSize(9.0f); - } - } - m_engine->LoadAllTextures(); } diff --git a/src/ui/screen/screen.cpp b/src/ui/screen/screen.cpp index 7c72ef6d..a433d18e 100644 --- a/src/ui/screen/screen.cpp +++ b/src/ui/screen/screen.cpp @@ -19,12 +19,18 @@ #include "ui/screen/screen.h" +#include "common/config.h" + #include "app/app.h" #include "graphics/engine/engine.h" #include "object/robotmain.h" +#include "ui/controls/interface.h" +#include "ui/controls/label.h" +#include "ui/controls/window.h" + namespace Ui { @@ -53,4 +59,21 @@ void CScreen::SetBackground(const std::string& filename, bool scaled) m_engine->SetBackForce(true); } +void CScreen::CreateVersionDisplay() +{ + CWindow* pw = static_cast(m_interface->SearchControl(EVENT_WINDOW5)); + if (pw != nullptr) + { + Math::Point pos, ddim; + + pos.x = 540.0f/640.0f; + pos.y = 9.0f/480.0f; + ddim.x = 90.0f/640.0f; + ddim.y = 10.0f/480.0f; + CLabel* pl = pw->CreateLabel(pos, ddim, 0, EVENT_LABEL1, COLOBOT_VERSION_DISPLAY); + pl->SetFontType(Gfx::FONT_COURIER); + pl->SetFontSize(9.0f); + } +} + } // namespace Ui diff --git a/src/ui/screen/screen.h b/src/ui/screen/screen.h index b231a333..361248db 100644 --- a/src/ui/screen/screen.h +++ b/src/ui/screen/screen.h @@ -49,6 +49,7 @@ public: virtual bool EventProcess(const Event &event) = 0; protected: + void CreateVersionDisplay(); void SetBackground(const std::string& filename, bool scaled = false); protected: diff --git a/src/ui/screen/screen_io_read.cpp b/src/ui/screen/screen_io_read.cpp index f4096bec..827148ee 100644 --- a/src/ui/screen/screen_io_read.cpp +++ b/src/ui/screen/screen_io_read.cpp @@ -114,6 +114,7 @@ void CScreenIORead::CreateInterface() if ( !m_inSimulation ) { SetBackground("textures/interface/interface.png"); + CreateVersionDisplay(); } } diff --git a/src/ui/screen/screen_level_list.cpp b/src/ui/screen/screen_level_list.cpp index 1fe60e11..a88c95be 100644 --- a/src/ui/screen/screen_level_list.cpp +++ b/src/ui/screen/screen_level_list.cpp @@ -235,6 +235,7 @@ void CScreenLevelList::CreateInterface() pb->SetState(STATE_SHADOW); SetBackground("textures/interface/interface.png"); + CreateVersionDisplay(); if (m_category == LevelCategory::CustomLevels) { diff --git a/src/ui/screen/screen_loading.cpp b/src/ui/screen/screen_loading.cpp index 0a297f2a..18ee7a35 100644 --- a/src/ui/screen/screen_loading.cpp +++ b/src/ui/screen/screen_loading.cpp @@ -93,6 +93,7 @@ void CScreenLoading::CreateInterface() pw->CreateGauge(pos, ddim, 0, EVENT_LOADING); SetBackground("textures/interface/interface.png"); + CreateVersionDisplay(); m_engine->SetDrawWorld(false); m_app->Render(); diff --git a/src/ui/screen/screen_main_menu.cpp b/src/ui/screen/screen_main_menu.cpp index 1e5b43ab..9a42fe01 100644 --- a/src/ui/screen/screen_main_menu.cpp +++ b/src/ui/screen/screen_main_menu.cpp @@ -160,6 +160,7 @@ void CScreenMainMenu::CreateInterface() pl->SetFontSize(Gfx::FONT_SIZE_SMALL); SetBackground("textures/interface/interface.png"); + CreateVersionDisplay(); } bool CScreenMainMenu::EventProcess(const Event &event) diff --git a/src/ui/screen/screen_player_select.cpp b/src/ui/screen/screen_player_select.cpp index e36269cc..4b36ebb2 100644 --- a/src/ui/screen/screen_player_select.cpp +++ b/src/ui/screen/screen_player_select.cpp @@ -140,11 +140,12 @@ void CScreenPlayerSelect::CreateInterface() pb = pw->CreateButton(pos, ddim, -1, EVENT_INTERFACE_NCANCEL); pb->SetState(STATE_SHADOW); + SetBackground("textures/interface/interface.png"); + CreateVersionDisplay(); + ReadNameList(); UpdateNameList(); UpdateNameControl(); - - SetBackground("textures/interface/interface.png"); } bool CScreenPlayerSelect::EventProcess(const Event &event) diff --git a/src/ui/screen/screen_setup.cpp b/src/ui/screen/screen_setup.cpp index 34043c21..66694f2e 100644 --- a/src/ui/screen/screen_setup.cpp +++ b/src/ui/screen/screen_setup.cpp @@ -139,6 +139,7 @@ void CScreenSetup::CreateInterface() if ( !m_simulationSetup ) { SetBackground("textures/interface/interface.png"); + CreateVersionDisplay(); } }