Added Settings

This commit is contained in:
2019-10-24 18:03:56 -05:00
parent f4c6ad1d35
commit bcbe70d8d8
8 changed files with 64 additions and 20 deletions

View File

@@ -7,12 +7,42 @@ class IMICRTS
background [0xff555555, Gosu::Color::GRAY]
label "Settings", text_size: 78, margin: 20
label "Nothing to see here, move along."
stack(width: 1.0) do
background 0xff030303
label "Debug Settings"
@debug_mode = check_box "Debug Mode", checked: Setting.enabled?(:debug_mode)
@debug_info_bar = check_box "Show Debug Info Bar", checked: Setting.enabled?(:debug_info_bar)
@debug_pathfinding = check_box "Debug Pathfinding", checked: Setting.enabled?(:debug_pathfinding)
@debug_pathfinding_allow_diagonal = check_box "Allow Diagonal Paths", checked: Setting.enabled?(:debug_pathfinding_allow_diagonal)
end
button("Save and Close", width: 1.0, margin_top: 20) do
if valid_options?
save_settings
push_state(MainMenu)
end
end
button("Back", width: 1.0, margin_top: 20) do
push_state(MainMenu)
end
end
end
def valid_options?
true
end
def save_settings
Setting.set(:debug_mode, @debug_mode.value)
Setting.set(:debug_info_bar, @debug_info_bar.value)
Setting.set(:debug_pathfinding, @debug_pathfinding.value)
Setting.set(:debug_pathfinding_allow_diagonal, @debug_pathfinding_allow_diagonal.value)
Setting.save!
end
end
end

View File

@@ -18,7 +18,7 @@ class IMICRTS
stack do
case elements[index]
when :edit_line
edit_line "Novice"
edit_line Setting.get(:player_name)
when :button
button item
when :toggle_button