fix some warnings (#5135)

* fix some warnings

* fix error caught by mac build, fix 3 more warnings

* merge fix

* feedback

* remove color refactor
This commit is contained in:
Philip Dubé 2025-03-19 16:30:44 +00:00 committed by GitHub
parent 7dd3c1b2ac
commit 28944cc68f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 180 additions and 190 deletions

View file

@ -564,7 +564,7 @@ void InputViewerSettingsWindow::DrawElement() {
ImGui::Unindent(); ImGui::Unindent();
} }
UIWidgets:PaddedSeparator(true, true); UIWidgets::PaddedSeparator(true, true);
} }
if (ImGui::CollapsingHeader("Analog Stick")) { if (ImGui::CollapsingHeader("Analog Stick")) {

View file

@ -2045,8 +2045,8 @@ void CosmeticsEditorWindow::DrawElement() {
UIWidgets::ComboboxOptions() UIWidgets::ComboboxOptions()
.DefaultIndex(COLORSCHEME_N64) .DefaultIndex(COLORSCHEME_N64)
.Color(THEME_COLOR) .Color(THEME_COLOR)
.LabelPosition(UIWidgets::LabelPosition::Near) .LabelPosition(UIWidgets::LabelPositions::Near)
.ComponentAlignment(UIWidgets::ComponentAlignment::Right)); .ComponentAlignment(UIWidgets::ComponentAlignments::Right));
UIWidgets::CVarCheckbox("Sync Rainbow colors", CVAR_COSMETIC("RainbowSync"), UIWidgets::CVarCheckbox("Sync Rainbow colors", CVAR_COSMETIC("RainbowSync"),
UIWidgets::CheckboxOptions() UIWidgets::CheckboxOptions()
.Color(THEME_COLOR)); .Color(THEME_COLOR));

View file

@ -79,6 +79,7 @@ static bool ActorSpawnHandler(std::shared_ptr<Ship::Console> Console, const std:
if (args[8][0] != ',') { if (args[8][0] != ',') {
spawnPoint.rot.z = std::stoi(args[8]); spawnPoint.rot.z = std::stoi(args[8]);
} }
[[fallthrough]];
case 6: case 6:
if (args[3][0] != ',') { if (args[3][0] != ',') {
spawnPoint.pos.x = std::stoi(args[3]); spawnPoint.pos.x = std::stoi(args[3]);

View file

@ -1550,7 +1550,7 @@ void ResetBaseOptions() {
intSliderOptionsBase.Color(THEME_COLOR).Size({320.0f, 0.0f}).Tooltip(""); intSliderOptionsBase.Color(THEME_COLOR).Size({320.0f, 0.0f}).Tooltip("");
buttonOptionsBase.Color(THEME_COLOR).Size(Sizes::Inline).Tooltip(""); buttonOptionsBase.Color(THEME_COLOR).Size(Sizes::Inline).Tooltip("");
checkboxOptionsBase.Color(THEME_COLOR).Tooltip(""); checkboxOptionsBase.Color(THEME_COLOR).Tooltip("");
comboboxOptionsBase.Color(THEME_COLOR).ComponentAlignment(ComponentAlignment::Left).LabelPosition(LabelPosition::Near).Tooltip(""); comboboxOptionsBase.Color(THEME_COLOR).ComponentAlignment(ComponentAlignments::Left).LabelPosition(LabelPositions::Near).Tooltip("");
} }
void SaveEditorWindow::DrawElement() { void SaveEditorWindow::DrawElement() {

View file

@ -564,7 +564,7 @@ void GameInteractor::RawAction::SetRandomWind(bool active) {
void GameInteractor::RawAction::SetPlayerInvincibility(bool active) { void GameInteractor::RawAction::SetPlayerInvincibility(bool active) {
Player* player = GET_PLAYER(gPlayState); Player* player = GET_PLAYER(gPlayState);
if (active) { if (active) {
player->invincibilityTimer = 1000; player->invincibilityTimer = -20;
} else { } else {
player->invincibilityTimer = 0; player->invincibilityTimer = 0;
} }

View file

@ -50,7 +50,7 @@ void DrawPresetSelector(PresetType presetTypeId) {
comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description);
} }
ImGui::Text("Presets", false, true); ImGui::Text("Presets");
UIWidgets::PushStyleCombobox(THEME_COLOR); UIWidgets::PushStyleCombobox(THEME_COLOR);
if (ImGui::BeginCombo("##PresetsComboBox", selectedPresetDef.label)) { if (ImGui::BeginCombo("##PresetsComboBox", selectedPresetDef.label)) {
for ( auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter ) { for ( auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter ) {

View file

@ -838,8 +838,8 @@ void PlandomizerDrawItemSlots(uint32_t index) {
void PlandomizerDrawShopSlider(uint32_t index) { void PlandomizerDrawShopSlider(uint32_t index) {
ImGui::PushID(index); ImGui::PushID(index);
UIWidgets::SliderInt("Price:", &plandoLogData[index].shopPrice, UIWidgets::IntSliderOptions() UIWidgets::SliderInt("Price:", &plandoLogData[index].shopPrice, UIWidgets::IntSliderOptions()
.Color(THEME_COLOR).Format("%d Rupees").Min(0).Max(999).LabelPosition(UIWidgets::LabelPosition::Near) .Color(THEME_COLOR).Format("%d Rupees").Min(0).Max(999).LabelPosition(UIWidgets::LabelPositions::Near)
.ComponentAlignment(UIWidgets::ComponentAlignment::Right).Size(UIWidgets::Sizes::Inline)); .ComponentAlignment(UIWidgets::ComponentAlignments::Right).Size(UIWidgets::Sizes::Inline));
ImGui::PopID(); ImGui::PopID();
} }
@ -878,7 +878,7 @@ void PlandomizerDrawIceTrapSetup(uint32_t index) {
} }
ImGui::SameLine(); ImGui::SameLine();
} }
if (UIWidgets::InputString("##TrapName", &trapTextInput, UIWidgets::InputOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::None))) { if (UIWidgets::InputString("##TrapName", &trapTextInput, UIWidgets::InputOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::None))) {
plandoLogData[index].iceTrapName = trapTextInput.c_str(); plandoLogData[index].iceTrapName = trapTextInput.c_str();
} }
@ -933,7 +933,7 @@ void PlandomizerDrawOptions() {
PlandomizerPopulateSeedList(); PlandomizerPopulateSeedList();
static size_t selectedList = 0; static size_t selectedList = 0;
if (existingSeedList.size() != 0) { if (existingSeedList.size() != 0) {
UIWidgets::Combobox("##JsonFiles", &selectedList, existingSeedList, UIWidgets::ComboboxOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::None)); UIWidgets::Combobox("##JsonFiles", &selectedList, existingSeedList, UIWidgets::ComboboxOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::None));
} }
else { else {
ImGui::Text("No Spoiler Logs found."); ImGui::Text("No Spoiler Logs found.");
@ -1024,7 +1024,7 @@ void PlandomizerDrawOptions() {
} }
if (getTabID == TAB_LOCATIONS) { if (getTabID == TAB_LOCATIONS) {
if (plandoLogData.size() > 0) { if (plandoLogData.size() > 0) {
UIWidgets::Combobox("Filter by Area:##AreaFilter", &selectedArea, rcAreaNameMap, UIWidgets::ComboboxOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::Near).ComponentAlignment(UIWidgets::ComponentAlignment::Right)); UIWidgets::Combobox("Filter by Area:##AreaFilter", &selectedArea, rcAreaNameMap, UIWidgets::ComboboxOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::Near).ComponentAlignment(UIWidgets::ComponentAlignments::Right));
ImGui::SameLine(); ImGui::SameLine();
if (UIWidgets::Button("Empty All Rewards", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline).Padding(ImVec2(10.f, 6.f)))) { if (UIWidgets::Button("Empty All Rewards", UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline).Padding(ImVec2(10.f, 6.f)))) {
PlandomizerRemoveAllItems(); PlandomizerRemoveAllItems();
@ -1061,7 +1061,7 @@ void PlandomizerDrawHintsWindow() {
} }
ImGui::SameLine(); ImGui::SameLine();
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 10); ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x - 10);
if (UIWidgets::InputString("##HintMessage", &hintInputText, UIWidgets::InputOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::None).Tooltip(plandomizerHintsTooltip().c_str()))) { if (UIWidgets::InputString("##HintMessage", &hintInputText, UIWidgets::InputOptions().Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::None).Tooltip(plandomizerHintsTooltip().c_str()))) {
plandoHintData[index].hintText = hintInputText.c_str(); plandoHintData[index].hintText = hintInputText.c_str();
} }
index++; index++;

View file

@ -94,6 +94,7 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const { // NOLINT(*-no-recursio
actual = RG_DEKU_STICK_BAG; actual = RG_DEKU_STICK_BAG;
break; break;
} }
[[fallthrough]];
case 1: case 1:
if (infiniteUpgrades == RO_INF_UPGRADES_CONDENSED_PROGRESSIVE) { if (infiniteUpgrades == RO_INF_UPGRADES_CONDENSED_PROGRESSIVE) {
actual = RG_STICK_UPGRADE_INF; actual = RG_STICK_UPGRADE_INF;
@ -123,6 +124,7 @@ std::shared_ptr<GetItemEntry> Item::GetGIEntry() const { // NOLINT(*-no-recursio
actual = RG_DEKU_NUT_BAG; actual = RG_DEKU_NUT_BAG;
break; break;
} }
[[fallthrough]];
case 1: case 1:
if (infiniteUpgrades == RO_INF_UPGRADES_CONDENSED_PROGRESSIVE) { if (infiniteUpgrades == RO_INF_UPGRADES_CONDENSED_PROGRESSIVE) {
actual = RG_NUT_UPGRADE_INF; actual = RG_NUT_UPGRADE_INF;

View file

@ -232,7 +232,7 @@ bool Option::RenderCombobox() {
} }
UIWidgets::ComboboxOptions widgetOptions = UIWidgets::ComboboxOptions().Color(THEME_COLOR).Tooltip(description.c_str()); UIWidgets::ComboboxOptions widgetOptions = UIWidgets::ComboboxOptions().Color(THEME_COLOR).Tooltip(description.c_str());
if (this->GetKey() == RSK_LOGIC_RULES) { if (this->GetKey() == RSK_LOGIC_RULES) {
widgetOptions = widgetOptions.LabelPosition(UIWidgets::LabelPosition::None).ComponentAlignment(UIWidgets::ComponentAlignment::Right); widgetOptions = widgetOptions.LabelPosition(UIWidgets::LabelPositions::None).ComponentAlignment(UIWidgets::ComponentAlignments::Right);
} }
widgetOptions.disabled = disabled; widgetOptions.disabled = disabled;
if(UIWidgets::Combobox(name.c_str(), &selected, options, widgetOptions)) { if(UIWidgets::Combobox(name.c_str(), &selected, options, widgetOptions)) {

View file

@ -1772,21 +1772,21 @@ void CheckTrackerSettingsWindow::DrawElement() {
ImGui::PopItemWidth(); ImGui::PopItemWidth();
UIWidgets::CVarCombobox("Window Type", CVAR_TRACKER_CHECK("WindowType"), windowType, UIWidgets::CVarCombobox("Window Type", CVAR_TRACKER_CHECK("WindowType"), windowType,
UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPosition::Far).ComponentAlignment(UIWidgets::ComponentAlignment::Right) UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPositions::Far).ComponentAlignment(UIWidgets::ComponentAlignments::Right)
.Color(THEME_COLOR).DefaultIndex(TRACKER_WINDOW_WINDOW)); .Color(THEME_COLOR).DefaultIndex(TRACKER_WINDOW_WINDOW));
if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) {
UIWidgets::CVarCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); UIWidgets::CVarCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable"), UIWidgets::CheckboxOptions().Color(THEME_COLOR));
UIWidgets::CVarCheckbox("Only enable while paused", CVAR_TRACKER_CHECK("ShowOnlyPaused"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); UIWidgets::CVarCheckbox("Only enable while paused", CVAR_TRACKER_CHECK("ShowOnlyPaused"), UIWidgets::CheckboxOptions().Color(THEME_COLOR));
UIWidgets::CVarCombobox("Display Mode", CVAR_TRACKER_CHECK("DisplayType"), displayType, UIWidgets::CVarCombobox("Display Mode", CVAR_TRACKER_CHECK("DisplayType"), displayType,
UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPosition::Far).ComponentAlignment(UIWidgets::ComponentAlignment::Right) UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPositions::Far).ComponentAlignment(UIWidgets::ComponentAlignments::Right)
.Color(THEME_COLOR).DefaultIndex(0)); .Color(THEME_COLOR).DefaultIndex(0));
if (CVarGetInteger(CVAR_TRACKER_CHECK("DisplayType"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { if (CVarGetInteger(CVAR_TRACKER_CHECK("DisplayType"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) {
UIWidgets::CVarCombobox("Combo Button 1", CVAR_TRACKER_CHECK("ComboButton1"), buttonStrings, UIWidgets::CVarCombobox("Combo Button 1", CVAR_TRACKER_CHECK("ComboButton1"), buttonStrings,
UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPosition::Far).ComponentAlignment(UIWidgets::ComponentAlignment::Right) UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPositions::Far).ComponentAlignment(UIWidgets::ComponentAlignments::Right)
.Color(THEME_COLOR).DefaultIndex(TRACKER_COMBO_BUTTON_L)); .Color(THEME_COLOR).DefaultIndex(TRACKER_COMBO_BUTTON_L));
UIWidgets::CVarCombobox("Combo Button 2", CVAR_TRACKER_CHECK("ComboButton2"), buttonStrings, UIWidgets::CVarCombobox("Combo Button 2", CVAR_TRACKER_CHECK("ComboButton2"), buttonStrings,
UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPosition::Far).ComponentAlignment(UIWidgets::ComponentAlignment::Right) UIWidgets::ComboboxOptions().LabelPosition(UIWidgets::LabelPositions::Far).ComponentAlignment(UIWidgets::ComponentAlignments::Right)
.Color(THEME_COLOR).DefaultIndex(TRACKER_COMBO_BUTTON_L)); .Color(THEME_COLOR).DefaultIndex(TRACKER_COMBO_BUTTON_L));
} }
} }

View file

@ -674,8 +674,7 @@ void EntranceTrackerSettingsWindow::DrawElement() {
ImGui::Text("Sort By"); ImGui::Text("Sort By");
UIWidgets::CVarRadioButton("To", CVAR_TRACKER_ENTRANCE("SortBy"), 0, UIWidgets::CVarRadioButton("To", CVAR_TRACKER_ENTRANCE("SortBy"), 0,
UIWidgets::RadioButtonsOptions() UIWidgets::RadioButtonsOptions()
.Color(THEME_COLOR) .Color(THEME_COLOR).Tooltip("Sort entrances by the original source entrance"));
.Tooltip("Sort entrances by the original source entrance"));
UIWidgets::CVarRadioButton("From", CVAR_TRACKER_ENTRANCE("SortBy"), 1, UIWidgets::CVarRadioButton("From", CVAR_TRACKER_ENTRANCE("SortBy"), 1,
UIWidgets::RadioButtonsOptions() UIWidgets::RadioButtonsOptions()
.Color(THEME_COLOR).Tooltip("Sort entrances by the overrided destination")); .Color(THEME_COLOR).Tooltip("Sort entrances by the overrided destination"));

View file

@ -1388,8 +1388,8 @@ void ItemTrackerSettingsWindow::DrawElement() {
ImGui::PopItemWidth(); ImGui::PopItemWidth();
if (CVarCombobox("Window Type", CVAR_TRACKER_ITEM("WindowType"), windowTypes, ComboboxOptions() if (CVarCombobox("Window Type", CVAR_TRACKER_ITEM("WindowType"), windowTypes, ComboboxOptions()
.DefaultIndex(TRACKER_WINDOW_FLOATING).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(TRACKER_WINDOW_FLOATING).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
@ -1401,19 +1401,19 @@ void ItemTrackerSettingsWindow::DrawElement() {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Display Mode", CVAR_TRACKER_ITEM("DisplayType.Main"), displayModes, ComboboxOptions() if (CVarCombobox("Display Mode", CVAR_TRACKER_ITEM("DisplayType.Main"), displayModes, ComboboxOptions()
.DefaultIndex(TRACKER_DISPLAY_ALWAYS).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(TRACKER_DISPLAY_ALWAYS).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) {
if (CVarCombobox("Combo Button 1", CVAR_TRACKER_ITEM("ComboButton1"), buttons, ComboboxOptions() if (CVarCombobox("Combo Button 1", CVAR_TRACKER_ITEM("ComboButton1"), buttons, ComboboxOptions()
.DefaultIndex(TRACKER_COMBO_BUTTON_L).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(TRACKER_COMBO_BUTTON_L).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Combo Button 2", CVAR_TRACKER_ITEM("ComboButton2"), buttons, ComboboxOptions() if (CVarCombobox("Combo Button 2", CVAR_TRACKER_ITEM("ComboButton2"), buttons, ComboboxOptions()
.DefaultIndex(TRACKER_COMBO_BUTTON_R).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(TRACKER_COMBO_BUTTON_R).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
} }
@ -1425,8 +1425,8 @@ void ItemTrackerSettingsWindow::DrawElement() {
ImGui::NewLine(); ImGui::NewLine();
CVarCombobox("Ammo/Capacity Tracking", CVAR_TRACKER_ITEM("ItemCountType"), itemTrackerCapacityTrackOptions, ComboboxOptions() CVarCombobox("Ammo/Capacity Tracking", CVAR_TRACKER_ITEM("ItemCountType"), itemTrackerCapacityTrackOptions, ComboboxOptions()
.DefaultIndex(ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY).ComponentAlignment(ComponentAlignment::Left) .DefaultIndex(ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY).ComponentAlignment(ComponentAlignments::Left)
.LabelPosition(LabelPosition::Above).Color(THEME_COLOR) .LabelPosition(LabelPositions::Above).Color(THEME_COLOR)
.Tooltip("Customize what the numbers under each item are tracking." .Tooltip("Customize what the numbers under each item are tracking."
"\n\nNote: items without capacity upgrades will track ammo even in capacity mode")); "\n\nNote: items without capacity upgrades will track ammo even in capacity mode"));
if (CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) { if (CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) {
@ -1436,35 +1436,35 @@ void ItemTrackerSettingsWindow::DrawElement() {
} }
CVarCombobox("Key Count Tracking", CVAR_TRACKER_ITEM("KeyCounts"), itemTrackerKeyTrackOptions, ComboboxOptions() CVarCombobox("Key Count Tracking", CVAR_TRACKER_ITEM("KeyCounts"), itemTrackerKeyTrackOptions, ComboboxOptions()
.DefaultIndex(KEYS_COLLECTED_MAX).ComponentAlignment(ComponentAlignment::Left) .DefaultIndex(KEYS_COLLECTED_MAX).ComponentAlignment(ComponentAlignments::Left)
.LabelPosition(LabelPosition::Above).Color(THEME_COLOR) .LabelPosition(LabelPositions::Above).Color(THEME_COLOR)
.Tooltip("Customize what numbers are shown for key tracking.")); .Tooltip("Customize what numbers are shown for key tracking."));
CVarCombobox("Triforce Piece Count Tracking", CVAR_TRACKER_ITEM("TriforcePieceCounts"), itemTrackerTriforcePieceTrackOptions, ComboboxOptions() CVarCombobox("Triforce Piece Count Tracking", CVAR_TRACKER_ITEM("TriforcePieceCounts"), itemTrackerTriforcePieceTrackOptions, ComboboxOptions()
.DefaultIndex(TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX).ComponentAlignment(ComponentAlignment::Left) .DefaultIndex(TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX).ComponentAlignment(ComponentAlignments::Left)
.LabelPosition(LabelPosition::Above).Color(THEME_COLOR) .LabelPosition(LabelPositions::Above).Color(THEME_COLOR)
.Tooltip("Customize what numbers are shown for triforce piece tracking.")); .Tooltip("Customize what numbers are shown for triforce piece tracking."));
ImGui::TableNextColumn(); ImGui::TableNextColumn();
if (CVarCombobox("Inventory", CVAR_TRACKER_ITEM("DisplayType.Inventory"), displayTypes, ComboboxOptions() if (CVarCombobox("Inventory", CVAR_TRACKER_ITEM("DisplayType.Inventory"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Equipment", CVAR_TRACKER_ITEM("DisplayType.Equipment"), displayTypes, ComboboxOptions() if (CVarCombobox("Equipment", CVAR_TRACKER_ITEM("DisplayType.Equipment"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Misc", CVAR_TRACKER_ITEM("DisplayType.Misc"), displayTypes, ComboboxOptions() if (CVarCombobox("Misc", CVAR_TRACKER_ITEM("DisplayType.Misc"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Dungeon Rewards", CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), displayTypes, ComboboxOptions() if (CVarCombobox("Dungeon Rewards", CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) {
@ -1473,13 +1473,13 @@ void ItemTrackerSettingsWindow::DrawElement() {
} }
} }
if (CVarCombobox("Songs", CVAR_TRACKER_ITEM("DisplayType.Songs"), displayTypes, ComboboxOptions() if (CVarCombobox("Songs", CVAR_TRACKER_ITEM("DisplayType.Songs"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_MAIN_WINDOW).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Dungeon Items", CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), displayTypes, ComboboxOptions() if (CVarCombobox("Dungeon Items", CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) != SECTION_DISPLAY_HIDDEN) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) != SECTION_DISPLAY_HIDDEN) {
@ -1493,45 +1493,45 @@ void ItemTrackerSettingsWindow::DrawElement() {
} }
} }
if (CVarCombobox("Greg", CVAR_TRACKER_ITEM("DisplayType.Greg"), extendedDisplayTypes, ComboboxOptions() if (CVarCombobox("Greg", CVAR_TRACKER_ITEM("DisplayType.Greg"), extendedDisplayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_EXTENDED_HIDDEN).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_EXTENDED_HIDDEN).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Triforce Pieces", CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), displayTypes, ComboboxOptions() if (CVarCombobox("Triforce Pieces", CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Boss Souls", CVAR_TRACKER_ITEM("DisplayType.BossSouls"), displayTypes, ComboboxOptions() if (CVarCombobox("Boss Souls", CVAR_TRACKER_ITEM("DisplayType.BossSouls"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Ocarina Buttons", CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"), displayTypes, ComboboxOptions() if (CVarCombobox("Ocarina Buttons", CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Fishing Pole", CVAR_TRACKER_ITEM("DisplayType.FishingPole"), extendedDisplayTypes, ComboboxOptions() if (CVarCombobox("Fishing Pole", CVAR_TRACKER_ITEM("DisplayType.FishingPole"), extendedDisplayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_EXTENDED_HIDDEN).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_EXTENDED_HIDDEN).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarCombobox("Total Checks", "gTrackers.ItemTracker.TotalChecks.DisplayType", minimalDisplayTypes, ComboboxOptions() if (CVarCombobox("Total Checks", "gTrackers.ItemTracker.TotalChecks.DisplayType", minimalDisplayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_MINIMAL_HIDDEN).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_MINIMAL_HIDDEN).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) {
if (CVarCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, ComboboxOptions() if (CVarCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, ComboboxOptions()
.DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignment::Right) .DefaultIndex(SECTION_DISPLAY_HIDDEN).ComponentAlignment(ComponentAlignments::Right)
.LabelPosition(LabelPosition::Far).Color(THEME_COLOR))) { .LabelPosition(LabelPositions::Far).Color(THEME_COLOR))) {
shouldUpdateVectors = true; shouldUpdateVectors = true;
} }
} }

View file

@ -809,7 +809,7 @@ void TimeSplitsDrawOptionsMenu() {
static uint32_t selectedItem = 0; static uint32_t selectedItem = 0;
ImGui::Text("Select List to Load: "); ImGui::Text("Select List to Load: ");
ImGui::PushItemWidth(150.0f); ImGui::PushItemWidth(150.0f);
Combobox("", &selectedItem, keys, ComboboxOptions().Color(THEME_COLOR).LabelPosition(LabelPosition::Near)); Combobox("", &selectedItem, keys, ComboboxOptions().Color(THEME_COLOR).LabelPosition(LabelPositions::Near));
ImGui::PopItemWidth(); ImGui::PopItemWidth();
ImGui::SameLine(); ImGui::SameLine();
if (Button("Load List", ButtonOptions().Color(THEME_COLOR).Size(Sizes::Inline))) { if (Button("Load List", ButtonOptions().Color(THEME_COLOR).Size(Sizes::Inline))) {

View file

@ -422,10 +422,10 @@ void RegisterResolutionWidgets() {
// Declare input interaction bools outside of IF statement to prevent Y field from disappearing. // Declare input interaction bools outside of IF statement to prevent Y field from disappearing.
const bool input_X = UIWidgets::SliderFloat("X", &aspectRatioX, const bool input_X = UIWidgets::SliderFloat("X", &aspectRatioX,
UIWidgets::FloatSliderOptions({{ .disabled = disabled_everything }}).Min(0.1f).Max(32.0f).Step(0.001f).Format("%3f") UIWidgets::FloatSliderOptions({{ .disabled = disabled_everything }}).Min(0.1f).Max(32.0f).Step(0.001f).Format("%3f")
.Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::Near).ComponentAlignment(UIWidgets::ComponentAlignment::Right)); .Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::Near).ComponentAlignment(UIWidgets::ComponentAlignments::Right));
const bool input_Y = UIWidgets::SliderFloat("Y", &aspectRatioY, const bool input_Y = UIWidgets::SliderFloat("Y", &aspectRatioY,
UIWidgets::FloatSliderOptions({{ .disabled = disabled_everything }}).Min(0.1f).Max(24.0f).Step(0.001f).Format("%3f") UIWidgets::FloatSliderOptions({{ .disabled = disabled_everything }}).Min(0.1f).Max(24.0f).Step(0.001f).Format("%3f")
.Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPosition::Near).ComponentAlignment(UIWidgets::ComponentAlignment::Right)); .Color(THEME_COLOR).LabelPosition(UIWidgets::LabelPositions::Near).ComponentAlignment(UIWidgets::ComponentAlignments::Right));
if (input_X || input_Y) { if (input_X || input_Y) {
item_aspectRatio = default_aspectRatio; item_aspectRatio = default_aspectRatio;
update[UPDATE_aspectRatioX] = true; update[UPDATE_aspectRatioX] = true;

View file

@ -42,11 +42,11 @@ void SohMenu::AddMenuNetwork() {
.CustomFunction([](WidgetInfo& info) { .CustomFunction([](WidgetInfo& info) {
ImGui::BeginDisabled(Sail::Instance->isEnabled); ImGui::BeginDisabled(Sail::Instance->isEnabled);
ImGui::Text("%s", info.name.c_str()); ImGui::Text("%s", info.name.c_str());
CVarInputString("##HostSail", CVAR_REMOTE_SAIL("Host"), InputOptions().Color(THEME_COLOR).PlaceholderText("127.0.0.1").DefaultValue("127.0.0.1").Size(ImVec2(ImGui::GetFontSize() * 15, 0)).LabelPosition(LabelPosition::None)); CVarInputString("##HostSail", CVAR_REMOTE_SAIL("Host"), InputOptions().Color(THEME_COLOR).PlaceholderText("127.0.0.1").DefaultValue("127.0.0.1").Size(ImVec2(ImGui::GetFontSize() * 15, 0)).LabelPosition(LabelPositions::None));
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text(":"); ImGui::Text(":");
ImGui::SameLine(); ImGui::SameLine();
CVarInputInt("##PortSail", CVAR_REMOTE_SAIL("Port"), InputOptions().Color(THEME_COLOR).PlaceholderText("43384").DefaultValue("43384").Size(ImVec2(ImGui::GetFontSize() * 5, 0)).LabelPosition(LabelPosition::None)); CVarInputInt("##PortSail", CVAR_REMOTE_SAIL("Port"), InputOptions().Color(THEME_COLOR).PlaceholderText("43384").DefaultValue("43384").Size(ImVec2(ImGui::GetFontSize() * 5, 0)).LabelPosition(LabelPositions::None));
ImGui::EndDisabled(); ImGui::EndDisabled();
}); });
AddWidget(path, "Enable##Sail", WIDGET_BUTTON) AddWidget(path, "Enable##Sail", WIDGET_BUTTON)
@ -104,11 +104,11 @@ void SohMenu::AddMenuNetwork() {
.CustomFunction([](WidgetInfo& info) { .CustomFunction([](WidgetInfo& info) {
ImGui::BeginDisabled(CrowdControl::Instance->isEnabled); ImGui::BeginDisabled(CrowdControl::Instance->isEnabled);
ImGui::Text("%s", info.name.c_str()); ImGui::Text("%s", info.name.c_str());
CVarInputString("##HostCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Host"), InputOptions().Color(THEME_COLOR).PlaceholderText("127.0.0.1").DefaultValue("127.0.0.1").Size(ImVec2(ImGui::GetFontSize() * 15, 0)).LabelPosition(LabelPosition::None)); CVarInputString("##HostCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Host"), InputOptions().Color(THEME_COLOR).PlaceholderText("127.0.0.1").DefaultValue("127.0.0.1").Size(ImVec2(ImGui::GetFontSize() * 15, 0)).LabelPosition(LabelPositions::None));
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text(":"); ImGui::Text(":");
ImGui::SameLine(); ImGui::SameLine();
CVarInputInt("##PortCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Port"), InputOptions().Color(THEME_COLOR).PlaceholderText("43384").DefaultValue("43384").Size(ImVec2(ImGui::GetFontSize() * 5, 0)).LabelPosition(LabelPosition::None)); CVarInputInt("##PortCrowdControl", CVAR_REMOTE_CROWD_CONTROL("Port"), InputOptions().Color(THEME_COLOR).PlaceholderText("43384").DefaultValue("43384").Size(ImVec2(ImGui::GetFontSize() * 5, 0)).LabelPosition(LabelPositions::None));
ImGui::EndDisabled(); ImGui::EndDisabled();
}); });
AddWidget(path, "Enable##CrowdControl", WIDGET_BUTTON) AddWidget(path, "Enable##CrowdControl", WIDGET_BUTTON)

View file

@ -108,8 +108,8 @@ void SohMenu::AddMenuSettings() {
.CVar(CVAR_ENHANCEMENT("BootSequence")) .CVar(CVAR_ENHANCEMENT("BootSequence"))
.Options(ComboboxOptions() .Options(ComboboxOptions()
.DefaultIndex(BOOTSEQUENCE_DEFAULT) .DefaultIndex(BOOTSEQUENCE_DEFAULT)
.LabelPosition(LabelPosition::Far) .LabelPosition(LabelPositions::Far)
.ComponentAlignment(ComponentAlignment::Right) .ComponentAlignment(ComponentAlignments::Right)
.ComboMap(bootSequenceLabels) .ComboMap(bootSequenceLabels)
.Tooltip("Configure what happens when starting or resetting the game.\n\n" .Tooltip("Configure what happens when starting or resetting the game.\n\n"
"Default: LUS logo -> N64 logo\n" "Default: LUS logo -> N64 logo\n"
@ -121,7 +121,7 @@ void SohMenu::AddMenuSettings() {
.CVar(CVAR_SETTING("TitleScreenTranslation")); .CVar(CVAR_SETTING("TitleScreenTranslation"));
AddWidget(path, "Menu Language", WIDGET_CVAR_COMBOBOX) AddWidget(path, "Menu Language", WIDGET_CVAR_COMBOBOX)
.CVar(CVAR_SETTING("Languages")) .CVar(CVAR_SETTING("Languages"))
.Options(ComboboxOptions().LabelPosition(LabelPosition::Far).ComponentAlignment(ComponentAlignment::Right).ComboMap(languages).DefaultIndex(LANGUAGE_ENG)); .Options(ComboboxOptions().LabelPosition(LabelPositions::Far).ComponentAlignment(ComponentAlignments::Right).ComboMap(languages).DefaultIndex(LANGUAGE_ENG));
AddWidget(path, "Accessibility", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Accessibility", WIDGET_SEPARATOR_TEXT);
#if defined(_WIN32) || defined(__APPLE__) #if defined(_WIN32) || defined(__APPLE__)
AddWidget(path, "Text to Speech", WIDGET_CVAR_CHECKBOX) AddWidget(path, "Text to Speech", WIDGET_CVAR_CHECKBOX)
@ -136,7 +136,7 @@ void SohMenu::AddMenuSettings() {
AddWidget(path, "ImGui Menu Scaling", WIDGET_CVAR_COMBOBOX) AddWidget(path, "ImGui Menu Scaling", WIDGET_CVAR_COMBOBOX)
.CVar(CVAR_SETTING("ImGuiScale")) .CVar(CVAR_SETTING("ImGuiScale"))
.Options(ComboboxOptions().ComboMap(imguiScaleOptions).Tooltip("Changes the scaling of the ImGui menu elements.").DefaultIndex(1) .Options(ComboboxOptions().ComboMap(imguiScaleOptions).Tooltip("Changes the scaling of the ImGui menu elements.").DefaultIndex(1)
.ComponentAlignment(ComponentAlignment::Right).LabelPosition(LabelPosition::Far)) .ComponentAlignment(ComponentAlignments::Right).LabelPosition(LabelPositions::Far))
.Callback([](WidgetInfo& info) { .Callback([](WidgetInfo& info) {
OTRGlobals::Instance->ScaleImGui(); OTRGlobals::Instance->ScaleImGui();
}); });

View file

@ -285,10 +285,10 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) {
ImGui::BeginDisabled(options.disabled); ImGui::BeginDisabled(options.disabled);
bool above = options.labelPosition == LabelPosition::Above; bool above = options.labelPosition == LabelPositions::Above;
bool lpFar = options.labelPosition == LabelPosition::Far; bool lpFar = options.labelPosition == LabelPositions::Far;
bool right = options.alignment == ComponentAlignment::Right; bool right = options.alignment == ComponentAlignments::Right;
bool none = options.labelPosition == LabelPosition::None; bool none = options.labelPosition == LabelPositions::None;
std::string labelStr = (none ? "##" : ""); std::string labelStr = (none ? "##" : "");
labelStr.append(_label); labelStr.append(_label);
@ -327,12 +327,12 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) {
PushStyleCheckbox(options.color); PushStyleCheckbox(options.color);
ImVec2 checkPos = pos; ImVec2 checkPos = pos;
ImVec2 labelPos = pos; ImVec2 labelPos = pos;
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
checkPos.y += label_size.y + (style.ItemInnerSpacing.y * 2.0f); checkPos.y += label_size.y + (style.ItemInnerSpacing.y * 2.0f);
} else { } else {
labelPos.y += (square_sz / 2) - (label_size.y / 2); labelPos.y += (square_sz / 2) - (label_size.y / 2);
} }
if (options.alignment == ComponentAlignment::Right) { if (options.alignment == ComponentAlignments::Right) {
checkPos.x = total_bb.Max.x - square_sz; checkPos.x = total_bb.Max.x - square_sz;
} else { } else {
float labelFarOffset = ImGui::GetContentRegionAvail().x - label_size.x; float labelFarOffset = ImGui::GetContentRegionAvail().x - label_size.x;
@ -518,22 +518,22 @@ bool SliderInt(const char* label, int32_t* value, const IntSliderOptions& option
ImGui::BeginDisabled(options.disabled); ImGui::BeginDisabled(options.disabled);
PushStyleSlider(options.color); PushStyleSlider(options.color);
float width = (options.size == ImVec2(0,0)) ? ImGui::GetContentRegionAvail().x : options.size.x; float width = (options.size == ImVec2(0,0)) ? ImGui::GetContentRegionAvail().x : options.size.x;
if (options.labelPosition == LabelPosition::Near || options.labelPosition == LabelPosition::Far) { if (options.labelPosition == LabelPositions::Near || options.labelPosition == LabelPositions::Far) {
width = width - (ImGui::CalcTextSize(label).x + ImGui::GetStyle().FramePadding.x); width = width - (ImGui::CalcTextSize(label).x + ImGui::GetStyle().FramePadding.x);
} }
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
if (options.alignment == ComponentAlignment::Right) { if (options.alignment == ComponentAlignments::Right) {
ImGui::Text(label, *value); ImGui::Text(label, *value);
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
} else if (options.labelPosition == LabelPosition::Near) { } else if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
} else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) { } else if (options.labelPosition == LabelPositions::Far || options.labelPosition == LabelPositions::None) {
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
} }
} else if (options.alignment == ComponentAlignment::Left) { } else if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::Text(label, *value); ImGui::Text(label, *value);
} }
} }
@ -576,11 +576,11 @@ bool SliderInt(const char* label, int32_t* value, const IntSliderOptions& option
} }
} }
if (options.alignment == ComponentAlignment::Left) { if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Near) { if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text(label, *value); ImGui::Text(label, *value);
} else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) { } else if (options.labelPosition == LabelPositions::Far || options.labelPosition == LabelPositions::None) {
ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize(label).x + ImGui::GetStyle().ItemSpacing.x); ImGui::SameLine(ImGui::GetContentRegionAvail().x - ImGui::CalcTextSize(label).x + ImGui::GetStyle().ItemSpacing.x);
ImGui::Text(label, *value); ImGui::Text(label, *value);
} }
@ -611,33 +611,25 @@ bool CVarSliderInt(const char* label, const char* cvarName, const IntSliderOptio
} }
void ClampFloat(float* value, float min, float max, float step) { void ClampFloat(float* value, float min, float max, float step) {
int ticks = 0; int factor = 1;
float increment = 1.0f;
if (step < 1.0f) { if (step < 1.0f) {
ticks++; factor *= 10;
increment = 0.1f;
} }
if (step < 0.1f) { if (step < 0.1f) {
ticks++; factor *= 10;
increment = 0.01f;
} }
if (step < 0.01f) { if (step < 0.01f) {
ticks++; factor *= 10;
increment = 0.001f;
} }
if (step < 0.001f) { if (step < 0.001f) {
ticks++; factor *= 10;
increment = 0.0001f;
} }
if (step < 0.0001f) { if (step < 0.0001f) {
ticks++; factor *= 10;
increment = 0.00001f;
} }
if (step < 0.00001f) { if (step < 0.00001f) {
ticks++; factor *= 10;
increment = 0.000001f;
} }
int factor = 1 * std::pow(10, ticks);
if (*value < min) { if (*value < min) {
*value = min; *value = min;
} else if (*value > max) { } else if (*value > max) {
@ -661,24 +653,24 @@ bool SliderFloat(const char* label, float* value, const FloatSliderOptions& opti
PushStyleSlider(options.color); PushStyleSlider(options.color);
float labelSpacing = ImGui::CalcTextSize(label).x + ImGui::GetStyle().ItemSpacing.x; float labelSpacing = ImGui::CalcTextSize(label).x + ImGui::GetStyle().ItemSpacing.x;
float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x; float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x;
if (options.labelPosition == LabelPosition::Near || options.labelPosition == LabelPosition::Far) { if (options.labelPosition == LabelPositions::Near || options.labelPosition == LabelPositions::Far) {
width = width - (ImGui::CalcTextSize(label).x + ImGui::GetStyle().FramePadding.x); width = width - (ImGui::CalcTextSize(label).x + ImGui::GetStyle().FramePadding.x);
} }
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
if (options.alignment == ComponentAlignment::Right) { if (options.alignment == ComponentAlignments::Right) {
ImGui::Text(label, *value); ImGui::Text(label, *value);
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
} else if (options.labelPosition == LabelPosition::Near) { } else if (options.labelPosition == LabelPositions::Near) {
width -= labelSpacing; width -= labelSpacing;
ImGui::SameLine(); ImGui::SameLine();
} else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) { } else if (options.labelPosition == LabelPositions::Far || options.labelPosition == LabelPositions::None) {
width -= labelSpacing; width -= labelSpacing;
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
} }
} else if (options.alignment == ComponentAlignment::Left) { } else if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::Text(label, *value); ImGui::Text(label, *value);
} }
} }
@ -715,11 +707,11 @@ bool SliderFloat(const char* label, float* value, const FloatSliderOptions& opti
} }
} }
if (options.alignment == ComponentAlignment::Left) { if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Near) { if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text(label, *value); ImGui::Text(label, *value);
} else if (options.labelPosition == LabelPosition::Far || options.labelPosition == LabelPosition::None) { } else if (options.labelPosition == LabelPositions::Far || options.labelPosition == LabelPositions::None) {
ImGui::SameLine(ImGui::GetContentRegionAvail().x - labelSpacing); ImGui::SameLine(ImGui::GetContentRegionAvail().x - labelSpacing);
ImGui::Text(label, *value); ImGui::Text(label, *value);
} }
@ -765,12 +757,12 @@ bool InputString(const char* label, std::string* value, const InputOptions& opti
ImGui::BeginDisabled(options.disabled); ImGui::BeginDisabled(options.disabled);
PushStyleInput(options.color); PushStyleInput(options.color);
float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x; float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x;
if (options.alignment == ComponentAlignment::Left) { if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::Text(label, *value->c_str()); ImGui::Text(label, *value->c_str());
} }
} else if (options.alignment == ComponentAlignment::Right) { } else if (options.alignment == ComponentAlignments::Right) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::SameLine(width - ImGui::CalcTextSize(label).x); ImGui::SameLine(width - ImGui::CalcTextSize(label).x);
ImGui::Text(label, *value->c_str()); ImGui::Text(label, *value->c_str());
@ -821,12 +813,12 @@ bool InputInt(const char* label, int32_t* value, const InputOptions& options) {
ImGui::BeginDisabled(options.disabled); ImGui::BeginDisabled(options.disabled);
PushStyleInput(options.color); PushStyleInput(options.color);
float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x; float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x;
if (options.alignment == ComponentAlignment::Left) { if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::Text(label, *value); ImGui::Text(label, *value);
} }
} else if (options.alignment == ComponentAlignment::Right) { } else if (options.alignment == ComponentAlignments::Right) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::SameLine(width - ImGui::CalcTextSize(label).x); ImGui::SameLine(width - ImGui::CalcTextSize(label).x);
ImGui::Text(label, *value); ImGui::Text(label, *value);

View file

@ -105,7 +105,7 @@ namespace UIWidgets {
const ImVec2 Fill = ImVec2(-1.0f, 0.0f); const ImVec2 Fill = ImVec2(-1.0f, 0.0f);
} }
enum LabelPosition { enum LabelPositions {
Near, Near,
Far, Far,
Above, Above,
@ -113,7 +113,7 @@ namespace UIWidgets {
Within, Within,
}; };
enum ComponentAlignment { enum ComponentAlignments {
Left, Left,
Right, Right,
}; };
@ -204,19 +204,19 @@ namespace UIWidgets {
struct CheckboxOptions : WidgetOptions { struct CheckboxOptions : WidgetOptions {
bool defaultValue = false; // Only applicable to CVarCheckbox bool defaultValue = false; // Only applicable to CVarCheckbox
ComponentAlignment alignment = ComponentAlignment::Left; ComponentAlignments alignment = ComponentAlignments::Left;
LabelPosition labelPosition = LabelPosition::Near; LabelPositions labelPosition = LabelPositions::Near;
Colors color = Colors::LightBlue; Colors color = Colors::LightBlue;
CheckboxOptions& DefaultValue(bool defaultValue_) { CheckboxOptions& DefaultValue(bool defaultValue_) {
defaultValue = defaultValue_; defaultValue = defaultValue_;
return *this; return *this;
} }
CheckboxOptions& ComponentAlignment(ComponentAlignment alignment_) { CheckboxOptions& ComponentAlignment(ComponentAlignments alignment_) {
alignment = alignment_; alignment = alignment_;
return *this; return *this;
} }
CheckboxOptions& LabelPosition(LabelPosition labelPosition_) { CheckboxOptions& LabelPosition(LabelPositions labelPosition_) {
labelPosition = labelPosition_; labelPosition = labelPosition_;
return *this; return *this;
} }
@ -237,8 +237,8 @@ namespace UIWidgets {
struct ComboboxOptions : WidgetOptions { struct ComboboxOptions : WidgetOptions {
std::unordered_map<int32_t, const char*> comboMap = {}; std::unordered_map<int32_t, const char*> comboMap = {};
uint32_t defaultIndex = 0; // Only applicable to CVarCombobox uint32_t defaultIndex = 0; // Only applicable to CVarCombobox
ComponentAlignment alignment = ComponentAlignment::Left; ComponentAlignments alignment = ComponentAlignments::Left;
LabelPosition labelPosition = LabelPosition::Above; LabelPositions labelPosition = LabelPositions::Above;
ImGuiComboFlags flags = 0; ImGuiComboFlags flags = 0;
Colors color = Colors::LightBlue; Colors color = Colors::LightBlue;
@ -250,11 +250,11 @@ namespace UIWidgets {
defaultIndex = defaultIndex_; defaultIndex = defaultIndex_;
return *this; return *this;
} }
ComboboxOptions& ComponentAlignment(ComponentAlignment alignment_) { ComboboxOptions& ComponentAlignment(ComponentAlignments alignment_) {
alignment = alignment_; alignment = alignment_;
return *this; return *this;
} }
ComboboxOptions& LabelPosition(LabelPosition labelPosition_) { ComboboxOptions& LabelPosition(LabelPositions labelPosition_) {
labelPosition = labelPosition_; labelPosition = labelPosition_;
return *this; return *this;
} }
@ -276,8 +276,8 @@ namespace UIWidgets {
int32_t max = 10; int32_t max = 10;
int32_t defaultValue = 1; int32_t defaultValue = 1;
bool clamp = true; bool clamp = true;
ComponentAlignment alignment = ComponentAlignment::Left; ComponentAlignments alignment = ComponentAlignments::Left;
LabelPosition labelPosition = LabelPosition::Above; LabelPositions labelPosition = LabelPositions::Above;
Colors color = Colors::Gray; Colors color = Colors::Gray;
ImGuiSliderFlags flags = 0; ImGuiSliderFlags flags = 0;
ImVec2 size = {0,0}; ImVec2 size = {0,0};
@ -306,11 +306,11 @@ namespace UIWidgets {
defaultValue = defaultValue_; defaultValue = defaultValue_;
return *this; return *this;
} }
IntSliderOptions& ComponentAlignment(ComponentAlignment alignment_) { IntSliderOptions& ComponentAlignment(ComponentAlignments alignment_) {
alignment = alignment_; alignment = alignment_;
return *this; return *this;
} }
IntSliderOptions& LabelPosition(LabelPosition labelPosition_) { IntSliderOptions& LabelPosition(LabelPositions labelPosition_) {
labelPosition = labelPosition_; labelPosition = labelPosition_;
return *this; return *this;
} }
@ -341,8 +341,8 @@ namespace UIWidgets {
float defaultValue = 1.0f; float defaultValue = 1.0f;
bool clamp = true; bool clamp = true;
bool isPercentage = false; // Multiplies visual value by 100 bool isPercentage = false; // Multiplies visual value by 100
ComponentAlignment alignment = ComponentAlignment::Left; ComponentAlignments alignment = ComponentAlignments::Left;
LabelPosition labelPosition = LabelPosition::Above; LabelPositions labelPosition = LabelPositions::Above;
Colors color = Colors::Gray; Colors color = Colors::Gray;
ImGuiSliderFlags flags = 0; ImGuiSliderFlags flags = 0;
ImVec2 size = {0,0}; ImVec2 size = {0,0};
@ -371,11 +371,11 @@ namespace UIWidgets {
defaultValue = defaultValue_; defaultValue = defaultValue_;
return *this; return *this;
} }
FloatSliderOptions& ComponentAlignment(ComponentAlignment alignment_) { FloatSliderOptions& ComponentAlignment(ComponentAlignments alignment_) {
alignment = alignment_; alignment = alignment_;
return *this; return *this;
} }
FloatSliderOptions& LabelPosition(LabelPosition labelPosition_) { FloatSliderOptions& LabelPosition(LabelPositions labelPosition_) {
labelPosition = labelPosition_; labelPosition = labelPosition_;
return *this; return *this;
} }
@ -423,8 +423,8 @@ namespace UIWidgets {
}; };
struct InputOptions : WidgetOptions { struct InputOptions : WidgetOptions {
ComponentAlignment alignment = ComponentAlignment::Left; ComponentAlignments alignment = ComponentAlignments::Left;
LabelPosition labelPosition = LabelPosition::Above; LabelPositions labelPosition = LabelPositions::Above;
Colors color = Colors::Gray; Colors color = Colors::Gray;
ImVec2 size = {0,0}; ImVec2 size = {0,0};
std::string placeholder = ""; std::string placeholder = "";
@ -446,7 +446,7 @@ namespace UIWidgets {
return *this; return *this;
} }
InputOptions& LabelPosition(LabelPosition labelPosition_) { InputOptions& LabelPosition(LabelPositions labelPosition_) {
labelPosition = labelPosition_; labelPosition = labelPosition_;
return *this; return *this;
} }
@ -545,20 +545,20 @@ namespace UIWidgets {
float comboWidth = CalcComboWidth(longest, options.flags); float comboWidth = CalcComboWidth(longest, options.flags);
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
if (options.labelPosition != LabelPosition::None) { if (options.labelPosition != LabelPositions::None) {
if (options.alignment == ComponentAlignment::Right) { if (options.alignment == ComponentAlignments::Right) {
ImGui::Text(label); ImGui::Text("%s", label);
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth);
} else if (options.labelPosition == LabelPosition::Near) { } else if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
} else if (options.labelPosition == LabelPosition::Far) { } else if (options.labelPosition == LabelPositions::Far) {
ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth);
} }
} else if (options.alignment == ComponentAlignment::Left) { } else if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::Text(label); ImGui::Text("%s", label);
} }
} }
} }
@ -578,12 +578,12 @@ namespace UIWidgets {
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (options.labelPosition != LabelPosition::None) { if (options.labelPosition != LabelPositions::None) {
if (options.alignment == ComponentAlignment::Left) { if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Near) { if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("%s", label); ImGui::Text("%s", label);
} else if (options.labelPosition == LabelPosition::Far) { } else if (options.labelPosition == LabelPositions::Far) {
float width = ImGui::CalcTextSize(comboMap.at(*value)).x + ImGui::GetStyle().FramePadding.x * 2; float width = ImGui::CalcTextSize(comboMap.at(*value)).x + ImGui::GetStyle().FramePadding.x * 2;
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
ImGui::Text("%s", label); ImGui::Text("%s", label);
@ -625,19 +625,19 @@ namespace UIWidgets {
float comboWidth = CalcComboWidth(longest, options.flags); float comboWidth = CalcComboWidth(longest, options.flags);
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
if (options.labelPosition != LabelPosition::None) { if (options.labelPosition != LabelPositions::None) {
if (options.alignment == ComponentAlignment::Right) { if (options.alignment == ComponentAlignments::Right) {
ImGui::Text("%s", label); ImGui::Text("%s", label);
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth);
} else if (options.labelPosition == LabelPosition::Near) { } else if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
} else if (options.labelPosition == LabelPosition::Far) { } else if (options.labelPosition == LabelPositions::Far) {
ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth);
} }
} else if (options.alignment == ComponentAlignment::Left) { } else if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::Text("%s", label); ImGui::Text("%s", label);
} }
} }
@ -659,12 +659,12 @@ namespace UIWidgets {
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (options.labelPosition != LabelPosition::None) { if (options.labelPosition != LabelPositions::None) {
if (options.alignment == ComponentAlignment::Left) { if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Near) { if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("%s", label); ImGui::Text("%s", label);
} else if (options.labelPosition == LabelPosition::Far) { } else if (options.labelPosition == LabelPositions::Far) {
float width = ImGui::CalcTextSize(comboVector.at(*value)).x + ImGui::GetStyle().FramePadding.x * 2; float width = ImGui::CalcTextSize(comboVector.at(*value)).x + ImGui::GetStyle().FramePadding.x * 2;
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
ImGui::Text("%s", label); ImGui::Text("%s", label);
@ -707,19 +707,19 @@ namespace UIWidgets {
float comboWidth = CalcComboWidth(longest, options.flags); float comboWidth = CalcComboWidth(longest, options.flags);
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
if (options.labelPosition != LabelPosition::None) { if (options.labelPosition != LabelPositions::None) {
if (options.alignment == ComponentAlignment::Right) { if (options.alignment == ComponentAlignments::Right) {
ImGui::Text("%s", label); ImGui::Text("%s", label);
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth);
} else if (options.labelPosition == LabelPosition::Near) { } else if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
} else if (options.labelPosition == LabelPosition::Far) { } else if (options.labelPosition == LabelPositions::Far) {
ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth);
} }
} else if (options.alignment == ComponentAlignment::Left) { } else if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::Text("%s", label); ImGui::Text("%s", label);
} }
} }
@ -741,12 +741,12 @@ namespace UIWidgets {
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (options.labelPosition != LabelPosition::None) { if (options.labelPosition != LabelPositions::None) {
if (options.alignment == ComponentAlignment::Left) { if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Near) { if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("%s", label); ImGui::Text("%s", label);
} else if (options.labelPosition == LabelPosition::Far) { } else if (options.labelPosition == LabelPositions::Far) {
float width = ImGui::CalcTextSize(comboVector.at(*value).c_str()).x + ImGui::GetStyle().FramePadding.x * 2; float width = ImGui::CalcTextSize(comboVector.at(*value).c_str()).x + ImGui::GetStyle().FramePadding.x * 2;
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
ImGui::Text("%s", label); ImGui::Text("%s", label);
@ -792,19 +792,19 @@ namespace UIWidgets {
float comboWidth = CalcComboWidth(longest, options.flags); float comboWidth = CalcComboWidth(longest, options.flags);
ImGui::AlignTextToFramePadding(); ImGui::AlignTextToFramePadding();
if (options.labelPosition != LabelPosition::None) { if (options.labelPosition != LabelPositions::None) {
if (options.alignment == ComponentAlignment::Right) { if (options.alignment == ComponentAlignments::Right) {
ImGui::Text("%s", label); ImGui::Text("%s", label);
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::NewLine(); ImGui::NewLine();
ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth);
} else if (options.labelPosition == LabelPosition::Near) { } else if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
} else if (options.labelPosition == LabelPosition::Far) { } else if (options.labelPosition == LabelPositions::Far) {
ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth); ImGui::SameLine(ImGui::GetContentRegionAvail().x - comboWidth);
} }
} else if (options.alignment == ComponentAlignment::Left) { } else if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Above) { if (options.labelPosition == LabelPositions::Above) {
ImGui::Text("%s", label); ImGui::Text("%s", label);
} }
} }
@ -826,12 +826,12 @@ namespace UIWidgets {
ImGui::EndCombo(); ImGui::EndCombo();
} }
if (options.labelPosition != LabelPosition::None) { if (options.labelPosition != LabelPositions::None) {
if (options.alignment == ComponentAlignment::Left) { if (options.alignment == ComponentAlignments::Left) {
if (options.labelPosition == LabelPosition::Near) { if (options.labelPosition == LabelPositions::Near) {
ImGui::SameLine(); ImGui::SameLine();
ImGui::Text("%s", label); ImGui::Text("%s", label);
} else if (options.labelPosition == LabelPosition::Far) { } else if (options.labelPosition == LabelPositions::Far) {
float width = ImGui::CalcTextSize(comboArray[*value]).x + ImGui::GetStyle().FramePadding.x * 2; float width = ImGui::CalcTextSize(comboArray[*value]).x + ImGui::GetStyle().FramePadding.x * 2;
ImGui::SameLine(ImGui::GetContentRegionAvail().x - width); ImGui::SameLine(ImGui::GetContentRegionAvail().x - width);
ImGui::Text("%s", label); ImGui::Text("%s", label);

View file

@ -150,17 +150,13 @@ bool Scene_CommandObjectList(PlayState* play, SOH::ISceneCommand* cmd) {
s32 i; s32 i;
s32 j; s32 j;
s32 k; s32 k;
ObjectStatus* status;
ObjectStatus* status2; ObjectStatus* status2;
ObjectStatus* firstStatus;
// s16* objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.segment); // s16* objectEntry = SEGMENTED_TO_VIRTUAL(cmd->objectList.segment);
s16* objectEntry = (s16*)cmdObj->GetRawPointer(); s16* objectEntry = (s16*)cmdObj->GetRawPointer();
void* nextPtr; void* nextPtr;
k = 0; k = 0;
i = play->objectCtx.unk_09; i = play->objectCtx.unk_09;
firstStatus = &play->objectCtx.status[0];
status = &play->objectCtx.status[i];
// Loop until a mismatch in the object lists // Loop until a mismatch in the object lists
// Then clear all object ids past that in the context object list and kill actors for those objects // Then clear all object ids past that in the context object list and kill actors for those objects