mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
vehicle params graphical representation
This commit is contained in:
@@ -868,7 +868,7 @@ sound_source::update_counter( sound_handle const Sound, int const Value ) {
|
||||
ui::Transcripts.Add( buffer.caption );
|
||||
}
|
||||
}
|
||||
assert( sound( Sound ).playing >= 0 );
|
||||
assert( sound( Sound ).playing >= 0 );
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -122,6 +122,11 @@ ui_layer::ui_layer()
|
||||
m_logpanel.size = { 700, 400 };
|
||||
}
|
||||
|
||||
void ui_layer::imgui_style()
|
||||
{
|
||||
ImGui::StyleColorsDark();
|
||||
}
|
||||
|
||||
bool ui_layer::init(GLFWwindow *Window)
|
||||
{
|
||||
m_window = Window;
|
||||
@@ -145,7 +150,7 @@ bool ui_layer::init(GLFWwindow *Window)
|
||||
|
||||
m_imguiio->Fonts->AddFontFromFileTTF("fonts/dejavusansmono.ttf", 13.0f, nullptr, &ranges[0]);
|
||||
|
||||
ImGui::StyleColorsDark();
|
||||
imgui_style();
|
||||
ImGui_ImplGlfw_InitForOpenGL(m_window);
|
||||
#ifdef EU07_USEIMGUIIMPLOPENGL2
|
||||
ImGui_ImplOpenGL2_Init();
|
||||
|
||||
@@ -83,6 +83,10 @@ public:
|
||||
bool
|
||||
init( GLFWwindow *Window );
|
||||
|
||||
static
|
||||
void
|
||||
imgui_style();
|
||||
|
||||
// assign texturing hardware unit
|
||||
static
|
||||
void
|
||||
|
||||
@@ -202,7 +202,85 @@ void ui::vehicleparams_panel::render_contents()
|
||||
tex.create();
|
||||
|
||||
ImVec2 size = ImGui::GetContentRegionAvail();
|
||||
ImGui::Image(reinterpret_cast<void*>(tex.id), ImVec2(size.x, size.x * ((float)tex.height() / tex.width())), ImVec2(0, 1), ImVec2(1, 0));
|
||||
float x = size.x;
|
||||
float y = x * ((float)tex.height() / tex.width());
|
||||
float sx = size.x / 512.0f;
|
||||
float sy = y / 118.0f;
|
||||
|
||||
ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(0.0f, 0.0f, 0.0f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonActive, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
|
||||
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 1.0f, 0.0f, 1.0f));
|
||||
|
||||
if (ImGui::BeginChild("mini", ImVec2(x, y)))
|
||||
{
|
||||
ImGui::Image(reinterpret_cast<void*>(tex.id), ImVec2(x, y), ImVec2(0, 1), ImVec2(1, 0));
|
||||
|
||||
if (mover.PantRearUp) {
|
||||
ImGui::SetCursorPos(ImVec2(sx * 110, sy * 2));
|
||||
ImGui::Button(u8"╨╨╨");
|
||||
}
|
||||
if (mover.PantFrontUp) {
|
||||
ImGui::SetCursorPos(ImVec2(sx * 280, sy * 2));
|
||||
ImGui::Button(u8"╨╨╨");
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos(ImVec2(sx * 100, sy * 40));
|
||||
if (mover.Battery) {
|
||||
ImGui::Button(u8"BAT.");
|
||||
ImGui::SameLine();
|
||||
}
|
||||
if (mover.Mains) {
|
||||
ImGui::Button(u8"WS");
|
||||
ImGui::SameLine();
|
||||
}
|
||||
if (mover.ConverterFlag) {
|
||||
ImGui::Button(u8"PRZETW.");
|
||||
ImGui::SameLine();
|
||||
}
|
||||
if (mover.CompressorFlag) {
|
||||
ImGui::Button(u8"SPRĘŻ.");
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos(ImVec2(sx * 355, sy * 5));
|
||||
if (mover.WarningSignal) {
|
||||
ImGui::Button(u8"SYRENA");
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos(ImVec2(sx * 438, sy * 68));
|
||||
if (mover.iLights[end::front] & light::redmarker_left) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
|
||||
ImGui::Button(u8"o");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
else if (mover.iLights[end::front] & light::headlight_left) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
ImGui::Button(u8"O");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos(ImVec2(sx * 484, sy * 68));
|
||||
if (mover.iLights[end::front] & light::redmarker_right) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 0.0f, 0.0f, 1.0f));
|
||||
ImGui::Button(u8"o");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
else if (mover.iLights[end::front] & light::headlight_right) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
ImGui::Button(u8"O");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
|
||||
ImGui::SetCursorPos(ImVec2(sx * 460, sy * 15));
|
||||
if (mover.iLights[end::front] & light::headlight_upper) {
|
||||
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1.0f, 1.0f, 1.0f, 1.0f));
|
||||
ImGui::Button(u8"O");
|
||||
ImGui::PopStyleColor();
|
||||
}
|
||||
}
|
||||
ImGui::EndChild();
|
||||
|
||||
ImGui::PopStyleColor(4);
|
||||
}
|
||||
|
||||
if (ImGui::Button(STR_C("Radiostop")))
|
||||
|
||||
Reference in New Issue
Block a user