mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-17 23:39:18 +02:00
Use texture id casting recommended by ImGui wiki
This commit is contained in:
@@ -291,7 +291,7 @@ void ui::scenerylist_panel::draw_trainset(trainset_desc &trainset)
|
||||
glm::ivec2 size = mini->size();
|
||||
float width = 30.0f / size.y * size.x;
|
||||
float beforeX = ImGui::GetCursorPosX();
|
||||
ImGui::Image(reinterpret_cast<void*>(mini->get()), ImVec2(width, 30), ImVec2(0, 1), ImVec2(1, 0));
|
||||
ImGui::Image((ImTextureID)(intptr_t)(mini->get()), ImVec2(width, 30), ImVec2(0, 1), ImVec2(1, 0));
|
||||
float afterX = ImGui::GetCursorPosX();
|
||||
|
||||
ImGui::SameLine(beforeX);
|
||||
@@ -299,7 +299,7 @@ void ui::scenerylist_panel::draw_trainset(trainset_desc &trainset)
|
||||
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAutoExpirePayload)) {
|
||||
vehicle_moved data(trainset, dyn_desc, position - 1);
|
||||
|
||||
ImGui::Image(reinterpret_cast<void*>(mini->get()), ImVec2(width, 30), ImVec2(0, 1), ImVec2(1, 0));
|
||||
ImGui::Image((ImTextureID)(intptr_t)mini->get(), ImVec2(width, 30), ImVec2(0, 1), ImVec2(1, 0));
|
||||
|
||||
ImGui::SetDragDropPayload("vehicle_set", &data, sizeof(vehicle_moved));
|
||||
ImGui::EndDragDropSource();
|
||||
|
||||
@@ -274,7 +274,7 @@ bool ui::vehiclepicker_panel::selectable_image(const char *desc, bool selected,
|
||||
glm::ivec2 size = image->size();
|
||||
float width = 30.0f / size.y * size.x;
|
||||
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
|
||||
ImGui::Image(reinterpret_cast<void*>(tex), ImVec2(width, 30), ImVec2(0, 1), ImVec2(1, 0));
|
||||
ImGui::Image((ImTextureID)(intptr_t)tex, ImVec2(width, 30), ImVec2(0, 1), ImVec2(1, 0));
|
||||
|
||||
if (pickable) {
|
||||
ImGui::PushID((void*)image);
|
||||
@@ -282,7 +282,7 @@ bool ui::vehiclepicker_panel::selectable_image(const char *desc, bool selected,
|
||||
ImGui::InvisibleButton(desc, ImVec2(width, 30));
|
||||
|
||||
if (ImGui::BeginDragDropSource(ImGuiDragDropFlags_SourceAutoExpirePayload)) {
|
||||
ImGui::Image(reinterpret_cast<void*>(tex), ImVec2(width, 30), ImVec2(0, 1), ImVec2(1, 0));
|
||||
ImGui::Image((ImTextureID)(intptr_t)tex, ImVec2(width, 30), ImVec2(0, 1), ImVec2(1, 0));
|
||||
|
||||
ImGui::SetDragDropPayload("vehicle_pure", &pickable, sizeof(skin_set*));
|
||||
ImGui::EndDragDropSource();
|
||||
|
||||
@@ -687,7 +687,7 @@ void opengl33_renderer::draw_debug_ui()
|
||||
|
||||
ImGui::SetNextWindowSize(ImVec2S(400, 400));
|
||||
if (ImGui::Begin("Pickbuffer") && m_pick_tex) {
|
||||
ImGui::Image(reinterpret_cast<void *>(m_pick_tex->id), ImGui::GetContentRegionAvail(), ImVec2(0, 1.0), ImVec2(1.0, 0));
|
||||
ImGui::Image((ImTextureID)(intptr_t)(m_pick_tex->id), ImGui::GetContentRegionAvail(), ImVec2(0, 1.0), ImVec2(1.0, 0));
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
@@ -113,7 +113,7 @@ void ui::cameraview_panel::render_contents()
|
||||
}
|
||||
|
||||
ImVec2 surface_size = ImGui::GetContentRegionAvail();
|
||||
ImGui::Image(reinterpret_cast<void*>(texture->id), surface_size);
|
||||
ImGui::Image((ImTextureID)(intptr_t)(texture->id), surface_size);
|
||||
}
|
||||
|
||||
void ui::cameraview_panel::capture_func()
|
||||
|
||||
@@ -299,7 +299,7 @@ void ui::map_panel::render_contents()
|
||||
|
||||
ImVec2 window_origin = ImGui::GetCursorPos();
|
||||
ImVec2 screen_origin = ImGui::GetCursorScreenPos();
|
||||
ImGui::ImageButton(reinterpret_cast<void *>(m_tex->id), surface_size_im, ImVec2(0, surface_size.y / fb_size), ImVec2(surface_size.x / fb_size, 0), 0);
|
||||
ImGui::ImageButton((ImTextureID)(intptr_t)(m_tex->id), surface_size_im, ImVec2(0, surface_size.y / fb_size), ImVec2(surface_size.x / fb_size, 0), 0);
|
||||
|
||||
if (ImGui::IsItemHovered())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user