mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-19 11:09:19 +02:00
renderer changes, time and environment window
This commit is contained in:
41
widgets/time.cpp
Normal file
41
widgets/time.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "stdafx.h"
|
||||
#include "widgets/time.h"
|
||||
#include "simulationtime.h"
|
||||
#include "Globals.h"
|
||||
|
||||
ui::time_panel::time_panel()
|
||||
: ui_panel(LOC_STR(time_window), false)
|
||||
{
|
||||
size.x = 450;
|
||||
}
|
||||
|
||||
void ui::time_panel::render_contents()
|
||||
{
|
||||
ImGui::SliderFloat(LOC_STR(time_time), &time, 0.0f, 24.0f, "%.1f");
|
||||
ImGui::SliderInt(LOC_STR(time_yearday), &yearday, 1, 365);
|
||||
ImGui::SliderFloat(LOC_STR(time_visibility), &fog, 50.0f, 3000.0f, "%.0f");
|
||||
ImGui::SliderFloat(LOC_STR(time_weather), &overcast, 0.0f, 2.0f, "%.1f");
|
||||
ImGui::SliderFloat(LOC_STR(time_temperature), &temperature, -20.0f, 40.0f, "%.0f");
|
||||
|
||||
if (ImGui::Button(LOC_STR(time_apply))) {
|
||||
m_relay.post(user_command::setdatetime, (double)yearday, time, 1, 0);
|
||||
m_relay.post(user_command::setweather, fog, overcast, 1, 0);
|
||||
m_relay.post(user_command::settemperature, temperature, 0.0, 1, 0);
|
||||
|
||||
is_open = false;
|
||||
}
|
||||
}
|
||||
|
||||
void ui::time_panel::open()
|
||||
{
|
||||
auto &data = simulation::Time.data();
|
||||
time = (float)data.wHour + (float)data.wMinute / 60.0f;
|
||||
|
||||
yearday = simulation::Time.year_day();
|
||||
fog = Global.fFogEnd;
|
||||
|
||||
overcast = Global.Overcast;
|
||||
temperature = Global.AirTemperature;
|
||||
|
||||
is_open = true;
|
||||
}
|
||||
Reference in New Issue
Block a user