mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-23 06:02:08 -05:00
All color logic for all types
This commit is contained in:
parent
d4bc5875d7
commit
27f613b3f8
@ -350,40 +350,37 @@ void DrawItemCount(ItemTrackerItem item) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (currentAndMax.currentCapacity > 0) {
|
if (currentAndMax.currentCapacity > 0) {
|
||||||
/*if (currentAndMax.currentCapacity >= currentAndMax.maxCapacity) {
|
switch (CVar_GetS32("gItemTrackerCapacityTrack", 0)) {
|
||||||
std::string currentString = std::to_string((int)currentAndMax.currentCapacity);
|
case ITEM_TRACKER_NUMBER_NONE:
|
||||||
float x = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) ? p.x : p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2);
|
break;
|
||||||
|
case ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY:
|
||||||
|
{
|
||||||
|
std::string currentString = std::to_string((int)currentAndMax.currentCapacity); // Init like that else it would mess up with centering
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14));
|
|
||||||
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 255, 0, 255));
|
|
||||||
ImGui::Text("%d", (int)currentAndMax.currentCapacity);
|
|
||||||
ImGui::PopStyleColor();
|
|
||||||
} else {
|
|
||||||
if (item.id == QUEST_SKULL_TOKEN) {
|
if (item.id == QUEST_SKULL_TOKEN) {
|
||||||
switch (CVar_GetS32("gItemTrackerCapacityTrack", 0)) {
|
|
||||||
case ITEM_TRACKER_NUMBER_NONE:
|
|
||||||
case ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY:
|
|
||||||
case ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY:
|
|
||||||
std::string currentString = std::to_string((int)currentAndMax.currentAmmo);
|
std::string currentString = std::to_string((int)currentAndMax.currentAmmo);
|
||||||
float x = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) ? p.x : p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2);
|
} else {
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14));
|
|
||||||
ImGui::Text("%d", (int)currentAndMax.currentAmmo);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
|
|
||||||
switch (CVar_GetS32("gItemTrackerCapacityTrack", 0)) {
|
|
||||||
case ITEM_TRACKER_NUMBER_NONE:
|
|
||||||
break;
|
|
||||||
case ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY:
|
|
||||||
{
|
|
||||||
std::string currentString = std::to_string((int)currentAndMax.currentCapacity);
|
std::string currentString = std::to_string((int)currentAndMax.currentCapacity);
|
||||||
|
}
|
||||||
float x = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) ? p.x : p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2);
|
float x = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) ? p.x : p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2);
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14));
|
ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14));
|
||||||
|
if (item.id != QUEST_SKULL_TOKEN && currentAndMax.currentCapacity == currentAndMax.maxCapacity) {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 255, 0, 255));
|
||||||
|
} else if (item.id == QUEST_SKULL_TOKEN && currentAndMax.currentAmmo == currentAndMax.maxCapacity){
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 0, 0, 255));
|
||||||
|
} else {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.id == QUEST_SKULL_TOKEN) {
|
||||||
|
ImGui::Text("%d", (int)currentAndMax.currentAmmo);
|
||||||
|
} else {
|
||||||
ImGui::Text("%d", (int)currentAndMax.currentCapacity);
|
ImGui::Text("%d", (int)currentAndMax.currentCapacity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ImGui::PopStyleColor();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY:
|
case ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY:
|
||||||
{
|
{
|
||||||
@ -391,25 +388,46 @@ void DrawItemCount(ItemTrackerItem item) {
|
|||||||
float x = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) ? p.x : p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2);
|
float x = CVar_GetS32("gItemTrackerCurrentOnLeft", 0) ? p.x : p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentString.c_str()).x / 2);
|
||||||
|
|
||||||
ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14));
|
ImGui::SetCursorScreenPos(ImVec2(x, p.y - 14));
|
||||||
|
if (currentAndMax.currentAmmo == 0) {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(150, 150, 150, 255));
|
||||||
|
} else if (item.id == QUEST_SKULL_TOKEN && currentAndMax.currentAmmo == currentAndMax.currentCapacity) {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 0, 0, 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();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ITEM_TRACKER_NUMBER_CAPACITY:
|
case ITEM_TRACKER_NUMBER_CAPACITY:
|
||||||
{
|
{
|
||||||
std::string currentAndMaxString="0";
|
std::string currentAndMaxString = std::to_string((int)currentAndMax.currentCapacity) + "/" + std::to_string((int)currentAndMax.maxCapacity); // This one is there for a correc tspacing initialisation, else it would mess it up
|
||||||
|
|
||||||
if (item.id == QUEST_SKULL_TOKEN) {
|
if (item.id == QUEST_SKULL_TOKEN) {
|
||||||
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.maxCapacity);
|
||||||
|
ImGui::SetCursorScreenPos(ImVec2(p.x + (iconSize / 2) - (ImGui::CalcTextSize(currentAndMaxString.c_str()).x / 2), p.y - 18));
|
||||||
|
|
||||||
|
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(255, 0, 0, 255));
|
||||||
|
} else {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255));
|
||||||
|
}
|
||||||
|
ImGui::Text("%d/", (int)currentAndMax.currentAmmo);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
} else {
|
} else {
|
||||||
std::string currentAndMaxString = std::to_string((int)currentAndMax.currentCapacity) + "/" + std::to_string((int)currentAndMax.maxCapacity);
|
std::string currentAndMaxString = std::to_string((int)currentAndMax.currentCapacity) + "/" + std::to_string((int)currentAndMax.maxCapacity);
|
||||||
}
|
|
||||||
|
|
||||||
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.currentCapacity == currentAndMax.maxCapacity) {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 255, 0, 255));
|
||||||
if (item.id == QUEST_SKULL_TOKEN) {
|
|
||||||
ImGui::Text("%d/", (int)currentAndMax.currentAmmo);
|
|
||||||
} else {
|
} else {
|
||||||
|
ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255));
|
||||||
|
}
|
||||||
ImGui::Text("%d/", (int)currentAndMax.currentCapacity);
|
ImGui::Text("%d/", (int)currentAndMax.currentCapacity);
|
||||||
|
ImGui::PopStyleColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImGui::SameLine(0, 0.0f);
|
ImGui::SameLine(0, 0.0f);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user