config system
This commit is contained in:
parent
fc289e010b
commit
1b924174f2
2 changed files with 59 additions and 0 deletions
34
config.gd
Normal file
34
config.gd
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
extends Node
|
||||
|
||||
# load data from the file
|
||||
var config = ConfigFile.new()
|
||||
var err = config.load("config.txt")
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
# if there is no config file, create it with default values
|
||||
if err != OK:
|
||||
config.set_value("spin", "spin_channel_1", 2)
|
||||
config.set_value("spin", "spin_note_1", 10)
|
||||
config.set_value("spin", "spin_channel_2", 2)
|
||||
config.set_value("spin", "spin_note_2", 9)
|
||||
config.set_value("jog", "jog_channel", 2)
|
||||
config.set_value("jog", "jog_note", 8)
|
||||
config.set_value("beat", "beat_channel", 3)
|
||||
config.set_value("beat", "beat_note", 8)
|
||||
config.set_value("inverted", "is_inverted", true)
|
||||
config.save("config.txt")
|
||||
|
||||
# fetch the config data
|
||||
var spin_channel_1: int = config.get_value("spin", "spin_channel_1", 2)
|
||||
var spin_note_1: int = config.get_value("spin", "spin_note_1", 10)
|
||||
var spin_channel_2: int = config.get_value("spin", "spin_channel_2", 2)
|
||||
var spin_note_2: int = config.get_value("spin", "spin_note_2", 9)
|
||||
var jog_channel: int = config.get_value("jog", "jog_channel", 2)
|
||||
var jog_note: int = config.get_value("jog", "jog_note", 8)
|
||||
var beat_channel: int = config.get_value("beat", "beat_channel", 3)
|
||||
var beat_note: int = config.get_value("beat", "beat_note", 8)
|
||||
var is_inverted: bool = config.get_value("inverted", "is_inverted", true)
|
||||
|
||||
func _process(_delta):
|
||||
pass
|
||||
25
config.txt
Normal file
25
config.txt
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
; here, put the same values as in game config
|
||||
; the default config is for the inverted hercules djcontrol inpulse 200
|
||||
|
||||
[spin]
|
||||
; ex. Ch 2 Note 10, so 2 and 10
|
||||
spin_channel_1=2
|
||||
spin_note_1=10
|
||||
; spin 2: Ch 2 Note 9, so 2 and 9
|
||||
; if you have no seconday spin, put the same values as the one above
|
||||
spin_channel_2=2
|
||||
spin_note_2=9
|
||||
|
||||
[jog]
|
||||
; ex. Ch 2 Note 8, so 2 and 8
|
||||
jog_channel=2
|
||||
jog_note=8
|
||||
|
||||
[beat]
|
||||
; ex. Ch 3 Note 8, so 3 and 8
|
||||
beat_channel=3
|
||||
beat_note=8
|
||||
|
||||
[inverted]
|
||||
; ex. true by default, false if your turntable is NOT inverted
|
||||
is_inverted=true
|
||||
Loading…
Add table
Add a link
Reference in a new issue