mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-10-17 05:09:20 +02:00
feat(ui): imgui 1.91.9b-docking in place of 1.73: local changes of the backends carried over (glad as the gl loader, srgb and gamma of the ui, gles glsl string), BufferingBar/Spinner kept, imgui_tables in cmake; cursor position, cursor enter and focus of the main window passed to the glfw backend, which works with events now; code adapted to the api: ImGuiListClipper::Begin, BeginListBox, ImTextureID as an integer, ImageButton with an id, ImGuiKey without GetKeyIndex, logarithmic sliders in place of the removed power argument; ImGuizmo with the math operators defined before imgui.h and SetNextFrameWantCaptureMouse
This commit is contained in:
@@ -81,7 +81,7 @@ void ui::keymapper_panel::render_contents()
|
||||
|
||||
label += "##" + std::to_string((int)binding.first);
|
||||
|
||||
ImGui::SameLine(ImGui::GetContentRegionAvailWidth() - 150);
|
||||
ImGui::SameLine(ImGui::GetContentRegionAvail().x - 150);
|
||||
if (ImGui::Button(label.c_str(), ImVec2(150, 0))) {
|
||||
if (bind_active == binding.first)
|
||||
bind_active = user_command::none;
|
||||
|
||||
@@ -105,10 +105,10 @@ void ui::scenerylist_panel::draw_scenery_image()
|
||||
tex.create();
|
||||
|
||||
if (tex.get_is_ready()) {
|
||||
float avail_width = ImGui::GetContentRegionAvailWidth();
|
||||
float avail_width = ImGui::GetContentRegionAvail().x;
|
||||
float height = avail_width / tex.get_width() * tex.get_height();
|
||||
|
||||
ImGui::Image(reinterpret_cast<void *>(tex.get_id()), ImVec2(avail_width, height), ImVec2(0, 1), ImVec2(1, 0));
|
||||
ImGui::Image((ImTextureID)(intptr_t)(tex.get_id()), ImVec2(avail_width, height), ImVec2(0, 1), ImVec2(1, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -194,7 +194,8 @@ void ui::scenerylist_panel::add_replace_entry(const trainset_desc &trainset)
|
||||
|
||||
void ui::scenerylist_panel::draw_trainset_box()
|
||||
{
|
||||
ImGuiListClipper clipper(selected_scenery->trainsets.size());
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(selected_scenery->trainsets.size());
|
||||
while (clipper.Step()) for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++)
|
||||
draw_trainset(selected_scenery->trainsets[i]);
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ void ui::scenerywizard_panel::render_map(glm::vec2 const &Size)
|
||||
drawlist->PushClipRect(origin, ImVec2(origin.x + Size.x, origin.y + Size.y), true);
|
||||
drawlist->AddRectFilled(origin, ImVec2(origin.x + Size.x, origin.y + Size.y), IM_COL32(200, 214, 222, 255));
|
||||
if (m_texture != 0)
|
||||
drawlist->AddImage(reinterpret_cast<ImTextureID>(static_cast<std::intptr_t>(m_texture)), to_screen({m_image_low.x, m_image_high.y}), to_screen({m_image_high.x, m_image_low.y}));
|
||||
drawlist->AddImage((ImTextureID)(static_cast<std::intptr_t>(m_texture)), to_screen({m_image_low.x, m_image_high.y}), to_screen({m_image_high.x, m_image_low.y}));
|
||||
if (m_picked)
|
||||
{
|
||||
auto const at{to_screen(m_point)};
|
||||
|
||||
@@ -78,7 +78,8 @@ void ui::vehiclepicker_panel::render_contents()
|
||||
}
|
||||
|
||||
if (ImGui::BeginChild("box2")) {
|
||||
ImGuiListClipper clipper(model_list.size());
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(model_list.size());
|
||||
while (clipper.Step())
|
||||
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
auto group = model_list[i];
|
||||
@@ -109,7 +110,8 @@ void ui::vehiclepicker_panel::render_contents()
|
||||
}
|
||||
|
||||
if (ImGui::BeginChild("box2")) {
|
||||
ImGuiListClipper clipper(model_list.size());
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(model_list.size());
|
||||
while (clipper.Step())
|
||||
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
auto &desc = model_list[i];
|
||||
@@ -141,7 +143,8 @@ void ui::vehiclepicker_panel::render_contents()
|
||||
skinset_list.end());
|
||||
|
||||
if (ImGui::BeginChild("box3")) {
|
||||
ImGuiListClipper clipper(skinset_list.size());
|
||||
ImGuiListClipper clipper;
|
||||
clipper.Begin(skinset_list.size());
|
||||
while (clipper.Step())
|
||||
for (int i = clipper.DisplayStart; i < clipper.DisplayEnd; i++) {
|
||||
auto skin = skinset_list[i];
|
||||
|
||||
Reference in New Issue
Block a user