Skip to content

Commit

Permalink
minor function move
Browse files Browse the repository at this point in the history
  • Loading branch information
ajusa committed Jan 11, 2021
1 parent ae4d392 commit 5eac9c7
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/config.moon
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,23 @@ config = {
audio: {music: 100, sound: 100}
font: {override_font: false}
}
on "config_menu", ->
copy = deepcopy(config)
create_listbox({
choices: {
range(copy, "audio", "music", => "Music Volume #{@audio.music}%")
range(copy, "audio", "sound", => "Sound Volume #{@audio.sound}%")
toggle(copy, "font", "override_font", "Using System Font", "Using Novel Font")
{
text: "Save Settings",
action: (choice, close) ->
close!
dispatch "save_config", copy
}
},
closable: true
onclose: -> dispatch "config", config
})
on "load", ->
new_config = LIP.load("config.ini")
for key, value in pairs new_config --override defaults with config
Expand Down Expand Up @@ -35,20 +52,3 @@ toggle = (copy, section, key, true_text, false_text) ->
@text = text!
dispatch "config", copy
}
on "config_menu", ->
copy = deepcopy(config)
create_listbox({
choices: {
range(copy, "audio", "music", => "Music Volume #{@audio.music}%")
range(copy, "audio", "sound", => "Sound Volume #{@audio.sound}%")
toggle(copy, "font", "override_font", "Using System Font", "Using Novel Font")
{
text: "Save Settings",
action: (choice, close) ->
close!
dispatch "save_config", copy
}
},
closable: true
onclose: -> dispatch "config", config
})

0 comments on commit 5eac9c7

Please sign in to comment.