From 203ea7f2881cf72670a4e3eaad46d3df6300f59f Mon Sep 17 00:00:00 2001 From: milek7 Date: Mon, 23 Sep 2019 21:08:05 +0200 Subject: [PATCH] vehicleparams icons --- launcher/textures_scanner.cpp | 4 ++-- widgets/vehicleparams.cpp | 10 +++++++++- widgets/vehicleparams.h | 2 ++ 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/launcher/textures_scanner.cpp b/launcher/textures_scanner.cpp index be2d0a0a..6d575244 100644 --- a/launcher/textures_scanner.cpp +++ b/launcher/textures_scanner.cpp @@ -168,8 +168,8 @@ std::shared_ptr ui::vehicles_bank::parse_meta(const std::string & meta->photo_author = win1250_to_utf8(meta->photo_author); meta->search_lowered += - ToLower("n:" + meta->name + "i:" + meta->short_id + "d:" + meta->location + - "r:" + meta->rev_date + "c:" + meta->rev_company + "t:" + meta->texture_author + "p:" + meta->photo_author); + ToLower("n:" + meta->name + ":i:" + meta->short_id + ":d:" + meta->location + + ":r:" + meta->rev_date + ":c:" + meta->rev_company + ":t:" + meta->texture_author + ":p:" + meta->photo_author); std::replace(std::begin(meta->location), std::end(meta->location), '_', ' '); std::replace(std::begin(meta->rev_company), std::end(meta->rev_company), '_', ' '); diff --git a/widgets/vehicleparams.cpp b/widgets/vehicleparams.cpp index 86da1a9e..3f4fedf0 100644 --- a/widgets/vehicleparams.cpp +++ b/widgets/vehicleparams.cpp @@ -8,7 +8,7 @@ ui::vehicleparams_panel::vehicleparams_panel(const std::string &vehicle) : ui_panel(std::string(STR("Vehicle parameters")) + ": " + vehicle, false), m_vehicle_name(vehicle) { - + vehicle_mini = GfxRenderer.Fetch_Texture("vehicle_mini"); } void screen_window_callback(ImGuiSizeCallbackData *data) { @@ -197,6 +197,14 @@ void ui::vehicleparams_panel::render_contents() ImGui::TextUnformatted(buffer.data()); + if (vehicle_mini != null_handle) { + opengl_texture &tex = GfxRenderer.Texture(vehicle_mini); + tex.create(); + + ImVec2 size = ImGui::GetContentRegionAvail(); + ImGui::Image(reinterpret_cast(tex.id), ImVec2(size.x, size.x * ((float)tex.height() / tex.width())), ImVec2(0, 1), ImVec2(1, 0)); + } + if (ImGui::Button(STR_C("Radiostop"))) m_relay.post(user_command::radiostop, 0.0, 0.0, GLFW_PRESS, 0, vehicle_ptr->GetPosition()); ImGui::SameLine(); diff --git a/widgets/vehicleparams.h b/widgets/vehicleparams.h index 3311ad56..82cbb17b 100644 --- a/widgets/vehicleparams.h +++ b/widgets/vehicleparams.h @@ -1,6 +1,7 @@ #include "uilayer.h" #include "translation.h" #include "command.h" +#include "renderer.h" namespace ui { @@ -8,6 +9,7 @@ class vehicleparams_panel : public ui_panel { std::string m_vehicle_name; command_relay m_relay; + texture_handle vehicle_mini; public: vehicleparams_panel(const std::string &vehicle);