Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions ModConfigMenu.lua
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ local function UpdateCheckBox( button, value )
end

local function ShowCurrentMenu( screen )
local rowStartX = 350
local rowStartX = 300
local columnSpacingX = 600
local itemLocationX = rowStartX
local itemLocationY = 250
Expand Down Expand Up @@ -89,7 +89,8 @@ local function ShowCurrentMenu( screen )
})

local itemsInRow = 0
for name, value in orderedPairs( currentMenu ) do
for _, name in ipairs( currentMenu ) do
value = currentMenu[name]
local previousItemLocationX = itemLocationX
if value == true or value == false or type(value) == "number" then
itemsInRow = itemsInRow + 1
Expand All @@ -102,7 +103,7 @@ local function ShowCurrentMenu( screen )
components[name .. "TextBox"] = CreateScreenComponent({
Name = "BlankObstacle",
Scale = 1,
X = itemLocationX,
X = itemLocationX + itemSpacingX - 70,
Y = itemLocationY,
Group = "Combat_Menu" })
CreateTextBox({
Expand All @@ -113,7 +114,7 @@ local function ShowCurrentMenu( screen )
OffsetX = 0, OffsetY = 0,
Font = "AlegrayaSansSCRegular",
ShadowBlur = 0, ShadowColor = { 0, 0, 0, 1 }, ShadowOffset = { 0, 2 },
Justification = "Center"
Justification = "Right"
})
itemLocationX = itemLocationX + itemSpacingX
end
Expand All @@ -130,28 +131,29 @@ local function ShowCurrentMenu( screen )
components[name .. "CheckBox"].OnPressedFunctionName = "ModConfigMenu__ToggleBoolean"
itemLocationX = previousItemLocationX + columnSpacingX
elseif type(value) == "number" then
components[name .. "ButtonPlus"] = CreateScreenComponent({
Name = "LevelUpArrowRight",
components[name .. "ButtonMinus"] = CreateScreenComponent({
Name = "LevelUpArrowLeft",
Scale = 1,
X = itemLocationX - 40,
Y = itemLocationY,
Group = "CombatMenu"
})
components[name .. "ButtonPlus"].MenuItemName = name
components[name .. "ButtonPlus"].OnPressedFunctionName = "ModConfigMenu__ButtonPlus"
components[name .. "ButtonMinus"] = CreateScreenComponent({
Name = "LevelUpArrowLeft",
components[name .. "ButtonMinus"].MenuItemName = name
components[name .. "ButtonMinus"].OnPressedFunctionName = "ModConfigMenu__ButtonMinus"

components[name .. "ButtonPlus"] = CreateScreenComponent({
Name = "LevelUpArrowRight",
Scale = 1,
X = itemLocationX,
X = itemLocationX + 40,
Y = itemLocationY,
Group = "CombatMenu"
})
components[name .. "ButtonMinus"].MenuItemName = name
components[name .. "ButtonMinus"].OnPressedFunctionName = "ModConfigMenu__ButtonMinus"
components[name .. "ButtonPlus"].MenuItemName = name
components[name .. "ButtonPlus"].OnPressedFunctionName = "ModConfigMenu__ButtonPlus"
components[name .. "NumberText"] = CreateScreenComponent({
Name = "BlankObstacle",
Scale = 1,
X = itemLocationX + 40,
X = itemLocationX,
Y = itemLocationY,
Group = "Combat_Menu" })
CreateTextBox({
Expand Down Expand Up @@ -333,4 +335,3 @@ ModUtil.WrapBaseFunction("CreatePrimaryBacking", function ( baseFunc )
Attach({ Id = components.ModConfigButton.Id, DestinationId = components.ModConfigButton, OffsetX = 500, OffsetY = 500 })
baseFunc()
end, ModConfigMenu)

8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ other Hades mods via an in-game UI, so you can change
them on the fly.

Features:
- UI for toggling boolean values
- UI for boolean values toggle
- UI for adjustment of numerical values
- Minimal setup

Settings are saved in your save file, so they're only
Expand All @@ -17,8 +18,11 @@ To use, add config like the following to your mod:

local config = {
ModName = "Your Mod's name",
"YourFirstSetting","YourThirdSetting", -- only these settings will be exposed in the mod menu, in this order

YourFirstSetting = true,
YourSecondSetting = false
YourSecondSetting = false,
YourThirdSetting = 5,
}
ModConfigMenu.Register(config)

Expand Down