mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-11-15 14:05:06 -05:00
Fixed capacity on ammmo tracking
This commit is contained in:
parent
f69d9697e9
commit
377c030469
@ -393,17 +393,24 @@ void DrawItemCount(ItemTrackerItem item) {
|
|||||||
break;
|
break;
|
||||||
case ITEM_TRACKER_NUMBER_AMMO:
|
case ITEM_TRACKER_NUMBER_AMMO:
|
||||||
{
|
{
|
||||||
std::string currentAndMaxString = std::to_string((int)currentAndMax.currentAmmo) + "/" + std::to_string((int)currentAndMax.maxCapacity);
|
std::string currentAndMaxString = std::to_string((int)currentAndMax.currentAmmo) + "/" + std::to_string((int)currentAndMax.currentCapacity);
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentAndMaxString.c_str()).x / 2), p.y - 14));
|
ImGui::SetCursorScreenPos(ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentAndMaxString.c_str()).x / 2), p.y - 14));
|
||||||
|
if (currentAndMax.currentAmmo == 0) {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(150, 150, 150, 255));
|
||||||
|
} else if (currentAndMax.currentAmmo == currentAndMax.currentCapacity) {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 255, 0, 255));
|
||||||
|
} else {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255));
|
||||||
|
}
|
||||||
ImGui::Text("%d/", (int)currentAndMax.currentAmmo);
|
ImGui::Text("%d/", (int)currentAndMax.currentAmmo);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
ImGui::SameLine(0, 0.0f);
|
ImGui::SameLine(0, 0.0f);
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 255, 0, 255));
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 255, 0, 255));
|
||||||
ImGui::Text("%d", (int)currentAndMax.maxCapacity);
|
ImGui::Text("%d", (int)currentAndMax.currentCapacity);
|
||||||
ImGui::PopStyleColor();
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user