mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 19:49:19 +02:00
random start screen image
This commit is contained in:
@@ -802,6 +802,8 @@ eu07_application::init_data() {
|
|||||||
|
|
||||||
int
|
int
|
||||||
eu07_application::init_modes() {
|
eu07_application::init_modes() {
|
||||||
|
Global.local_random_engine.seed(std::random_device{}());
|
||||||
|
|
||||||
if ((!Global.network_servers.empty() || Global.network_client) && Global.SceneryFile.empty()) {
|
if ((!Global.network_servers.empty() || Global.network_client) && Global.SceneryFile.empty()) {
|
||||||
ErrorLog("launcher mode is currently not supported in network mode");
|
ErrorLog("launcher mode is currently not supported in network mode");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ void launcher_mode::enter()
|
|||||||
|
|
||||||
simulation::is_ready = false;
|
simulation::is_ready = false;
|
||||||
|
|
||||||
m_userinterface->set_background( "logo" );
|
|
||||||
Application.set_title(Global.AppName);
|
Application.set_title(Global.AppName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ launcher_ui::launcher_ui()
|
|||||||
add_external_panel(&m_scenerylist_panel);
|
add_external_panel(&m_scenerylist_panel);
|
||||||
add_external_panel(&m_keymapper_panel);
|
add_external_panel(&m_keymapper_panel);
|
||||||
add_external_panel(&m_vehiclepicker_panel);
|
add_external_panel(&m_vehiclepicker_panel);
|
||||||
|
|
||||||
|
load_random_background();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool launcher_ui::on_key(const int Key, const int Action)
|
bool launcher_ui::on_key(const int Key, const int Action)
|
||||||
|
|||||||
@@ -80,7 +80,6 @@ scenarioloader_mode::enter() {
|
|||||||
|
|
||||||
simulation::is_ready = false;
|
simulation::is_ready = false;
|
||||||
|
|
||||||
m_userinterface->set_background( "logo" );
|
|
||||||
Application.set_title( Global.AppName + " (" + Global.SceneryFile + ")" );
|
Application.set_title( Global.AppName + " (" + Global.SceneryFile + ")" );
|
||||||
m_userinterface->set_progress();
|
m_userinterface->set_progress();
|
||||||
m_userinterface->set_progress(STR("Loading scenery"));
|
m_userinterface->set_progress(STR("Loading scenery"));
|
||||||
|
|||||||
@@ -12,6 +12,9 @@ http://mozilla.org/MPL/2.0/.
|
|||||||
#include "uilayer.h"
|
#include "uilayer.h"
|
||||||
|
|
||||||
class scenarioloader_ui : public ui_layer {
|
class scenarioloader_ui : public ui_layer {
|
||||||
|
public:
|
||||||
|
scenarioloader_ui() : ui_layer() {
|
||||||
|
load_random_background();
|
||||||
|
}
|
||||||
// TODO: implement mode-specific elements
|
// TODO: implement mode-specific elements
|
||||||
};
|
};
|
||||||
|
|||||||
13
uilayer.cpp
13
uilayer.cpp
@@ -128,6 +128,19 @@ ui_layer::ui_layer()
|
|||||||
m_logpanel.size = { 700, 400 };
|
m_logpanel.size = { 700, 400 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void::ui_layer::load_random_background()
|
||||||
|
{
|
||||||
|
std::vector<std::string> images;
|
||||||
|
for (auto &f : std::filesystem::directory_iterator("textures/logo"))
|
||||||
|
if (f.is_regular_file())
|
||||||
|
images.emplace_back(std::filesystem::relative(f.path(), "textures/").string());
|
||||||
|
|
||||||
|
if (!images.empty()) {
|
||||||
|
std::string &selected = images[std::lround(LocalRandom(images.size() - 1))];
|
||||||
|
set_background(selected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static ImVec4 imvec_lerp(const ImVec4& a, const ImVec4& b, float t)
|
static ImVec4 imvec_lerp(const ImVec4& a, const ImVec4& b, float t)
|
||||||
{
|
{
|
||||||
return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t);
|
return ImVec4(a.x + (b.x - a.x) * t, a.y + (b.y - a.y) * t, a.z + (b.z - a.z) * t, a.w + (b.w - a.w) * t);
|
||||||
|
|||||||
@@ -156,6 +156,7 @@ protected:
|
|||||||
static ImGuiIO *m_imguiio;
|
static ImGuiIO *m_imguiio;
|
||||||
static bool m_cursorvisible;
|
static bool m_cursorvisible;
|
||||||
|
|
||||||
|
void load_random_background();
|
||||||
virtual void render_menu_contents();
|
virtual void render_menu_contents();
|
||||||
ui_log_panel m_logpanel { "Log", true };
|
ui_log_panel m_logpanel { "Log", true };
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user