4 config_file
: STRING is "config"
7 preset_list
: LINKED_LIST
[PRESET
]
15 default_preset
: STRING
17 has_preset(s
: STRING) : BOOLEAN is
21 it
:= preset_list
.get_new_iterator
25 if it
.item
.name
.is_equal(s
) then
32 get_preset(s
: STRING) : PRESET
is
36 it
:= preset_list
.get_new_iterator
40 if it
.item
.name
.is_equal(s
) then
57 !!in
.connect_to(config_file
)
58 if not in
.is_connected
then
59 io
.put_string("couldn't read config file%N")
67 state_none
: INTEGER is 0
68 state_unknown
: INTEGER is 1
69 state_preset
: INTEGER is 2
71 read_config(in
: TEXT_FILE_READ
) is
79 s1
:= clone(in
.last_string
)
81 if not in
.end_of_input
then
82 s2
:= clone(in
.last_string
)
88 if s1
.first
= '#' then
89 elseif s1
.is_equal("begin") then
90 state
:= state_unknown
91 if s2
.is_equal("preset") then
94 elseif s1
.is_equal("end") then
99 if s1
.is_equal("main_font") then
101 elseif s1
.is_equal("big_font") then
103 elseif s1
.is_equal("default_preset") then
105 elseif s1
.is_equal("hiscores") then
108 when state_preset
then
115 !!mainfont
.load(mainttf
, 12)
116 !!bigfont
.load(bigttf
, 24)
119 parse_preset(s1
, s2
: STRING) is
123 width
, height
: INTEGER
127 width
:= args
.item(1).to_integer
128 height
:= args
.item(2).to_integer
129 wrap
:= args
.item(3).to_integer
/= 0
130 !!p
.make(s1
, width
, height
, wrap
)
131 preset_list
.add_last(p
)