Skip to content

Commit

Permalink
T-panel narrowed to 255px (to accomodate at 1024x768)
Browse files Browse the repository at this point in the history
  • Loading branch information
ohlidalp committed Aug 4, 2024
1 parent f07d6d5 commit 02a6cbc
Showing 1 changed file with 6 additions and 40 deletions.
46 changes: 6 additions & 40 deletions source/main/gui/panels/GUI_VehicleInfoTPanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ using namespace GUI;
const float HELP_TEXTURE_WIDTH = 512.f;
const float HELP_TEXTURE_HEIGHT = 128.f;
const ImVec2 MAX_PREVIEW_SIZE(100.f, 100.f);
const float MIN_PANEL_WIDTH = 325.f;
const float MIN_PANEL_WIDTH = 225.f;

void VehicleInfoTPanel::Draw(RoR::GfxActor* actorx)
{
Expand Down Expand Up @@ -130,7 +130,7 @@ void VehicleInfoTPanel::Draw(RoR::GfxActor* actorx)
// === DRAW THE WINDOW HEADER - MINI IMAGE (if available) AND VEHICLE NAME ===

ImVec2 name_pos = ImGui::GetCursorPos();
ImVec2 content_pos;
ImVec2 tabs_pos;
if (actorx->GetActor()->getUsedActorEntry()->filecachename != "")
{
Ogre::TexturePtr preview_tex = Ogre::TextureManager::getSingleton().load(
Expand All @@ -145,86 +145,52 @@ void VehicleInfoTPanel::Draw(RoR::GfxActor* actorx)
}
// Draw the image
ImGui::Image(reinterpret_cast<ImTextureID>(preview_tex->getHandle()), size);
content_pos = ImGui::GetCursorPos();
tabs_pos = ImGui::GetCursorPos();
// Move name to the right
name_pos.x += size.x + ImGui::GetStyle().ItemSpacing.x;
ImGui::SetCursorPos(name_pos);
}

ImGui::SetCursorPos(name_pos);
RoR::ImTextWrappedColorMarked(actorx->GetActor()->getTruckName());
ImGui::Dummy(ImVec2(MIN_PANEL_WIDTH, 20));

// === DRAW TAB BAR ===

if (actorx->GetActor()->getUsedActorEntry()->filecachename != "")
{
ImGui::SetCursorPos(ImVec2(name_pos.x, content_pos.y - 21));
ImGui::SetCursorPos(tabs_pos);
}
ImGui::BeginTabBar("VehicleInfoTPanelTabs", ImGuiTabBarFlags_None);
if (ImGui::BeginTabItem(_LC("TPanel", "Basics"), nullptr, tabflags_basics))
{
// If the tab bar is drawn next to the image, we need to reset the cursor position
if (actorx->GetActor()->getUsedActorEntry()->filecachename != "")
{
ImGui::SetCursorPos(content_pos);
ImGui::Separator();
}

m_current_focus = TPANELFOCUS_BASICS;
this->DrawVehicleBasicsUI(actorx);

ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(_LC("TPanel", "Stats"), nullptr, tabflags_stats))
{
// If the tab bar is drawn next to the image, we need to reset the cursor position
if (actorx->GetActor()->getUsedActorEntry()->filecachename != "")
{
ImGui::SetCursorPos(content_pos);
ImGui::Separator();
}

m_current_focus = TPANELFOCUS_STATS;
this->DrawVehicleStatsUI(actorx);

ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(_LC("TPanel", "Commands"), nullptr, tabflags_commands))
{
// If the tab bar is drawn next to the image, we need to reset the cursor position
if (actorx->GetActor()->getUsedActorEntry()->filecachename != "")
{
ImGui::SetCursorPos(content_pos);
ImGui::Separator();
}

m_current_focus = TPANELFOCUS_COMMANDS;
this->DrawVehicleCommandsUI(actorx);

ImGui::EndTabItem();
}
if (ImGui::BeginTabItem(_LC("TPanel", "Diag"), nullptr, tabflags_diag))
{
// If the tab bar is drawn next to the image, we need to reset the cursor position
if (actorx->GetActor()->getUsedActorEntry()->filecachename != "")
{
ImGui::SetCursorPos(content_pos);
ImGui::Separator();
}

m_current_focus = TPANELFOCUS_DIAG;
this->DrawVehicleDiagUI(actorx);

ImGui::EndTabItem();
}

ImGui::EndTabBar();

if (actorx->GetActor()->getUsedActorEntry()->filecachename != "")
{
ImGui::SetCursorPos(content_pos);
}
ImGui::Separator();

ImGui::End();
ImGui::PopStyleColor(2); // WindowBg, TextDisabled
Expand Down

0 comments on commit 02a6cbc

Please sign in to comment.