… | |
… | |
126 | my ($self, $value) = @_; |
126 | my ($self, $value) = @_; |
127 | $CFG->{fullscreen} = $value; |
127 | $CFG->{fullscreen} = $value; |
128 | }); |
128 | }); |
129 | |
129 | |
130 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
130 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
131 | $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fast}, connect_changed => sub { |
131 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
132 | state => $CFG->{fast}, |
|
|
133 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
|
|
134 | connect_changed => sub { |
132 | my ($self, $value) = @_; |
135 | my ($self, $value) = @_; |
133 | $CFG->{fast} = $value; |
136 | $CFG->{fast} = $value; |
|
|
137 | } |
134 | }); |
138 | ); |
135 | |
139 | |
136 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
140 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); |
137 | $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fow_enable}, connect_changed => sub { |
141 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
142 | state => $CFG->{fow_enable}, |
|
|
143 | tooltip => "Fog-of-War marks areas that cannot be seen by the player", |
|
|
144 | connect_changed => sub { |
138 | my ($self, $value) = @_; |
145 | my ($self, $value) = @_; |
139 | $CFG->{fow_enable} = $value; |
146 | $CFG->{fow_enable} = $value; |
|
|
147 | } |
140 | }); |
148 | ); |
141 | |
149 | |
142 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
150 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
143 | $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], connect_changed => sub { |
151 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
152 | range => [$CFG->{fow_intensity}, 0, 1 + 0.001, 0.001], |
|
|
153 | tooltip => "The higher the intensity, the lighter the Fog-of-War color", |
|
|
154 | connect_changed => sub { |
144 | my ($self, $value) = @_; |
155 | my ($self, $value) = @_; |
145 | $CFG->{fow_intensity} = $value; |
156 | $CFG->{fow_intensity} = $value; |
|
|
157 | } |
146 | }); |
158 | ); |
147 | |
159 | |
148 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
160 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "FoW Smooth"); |
149 | $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{fow_smooth}, connect_changed => sub { |
161 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
162 | state => $CFG->{fow_smooth}, |
|
|
163 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic", |
|
|
164 | connect_changed => sub { |
150 | my ($self, $value) = @_; |
165 | my ($self, $value) = @_; |
151 | $CFG->{fow_smooth} = $value; |
166 | $CFG->{fow_smooth} = $value; |
152 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
167 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
|
|
168 | } |
153 | }); |
169 | ); |
154 | |
170 | |
155 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
171 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
156 | $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gui_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
172 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
173 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1], |
|
|
174 | tooltip => "The font size used by most GUI elements", |
|
|
175 | connect_changed => sub { |
157 | $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; |
176 | $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10; |
158 | # $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
177 | # $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
|
|
178 | } |
159 | }); |
179 | ); |
160 | |
180 | |
161 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); |
181 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); |
162 | $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
182 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
183 | range => [$CFG->{log_fontsize}, 0.5, 2, 0.1], |
|
|
184 | tooltip => "The font size used by the server log window only", |
|
|
185 | connect_changed => sub { |
163 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); |
186 | $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10); |
|
|
187 | } |
164 | }); |
188 | ); |
165 | |
189 | |
166 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
190 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); |
167 | $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{stat_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
191 | |
|
|
192 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
193 | range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1], |
|
|
194 | tooltip => "The font size used by the statistics window only", |
|
|
195 | connect_changed => sub { |
168 | $CFG->{stat_fontsize} = 0.1 * int $_[1] * 10; |
196 | $CFG->{stat_fontsize} = 0.1 * int $_[1] * 10; |
169 | &set_stats_window_fontsize; |
197 | &set_stats_window_fontsize; |
|
|
198 | } |
170 | }); |
199 | ); |
171 | |
200 | |
172 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gaugesize"); |
201 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gaugesize"); |
173 | $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], connect_changed => sub { |
202 | $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], connect_changed => sub { |
174 | $CFG->{gauge_size} = $_[1]; |
203 | $CFG->{gauge_size} = $_[1]; |
175 | my $h = int ($HEIGHT * $CFG->{gauge_size}); |
204 | my $h = int ($HEIGHT * $CFG->{gauge_size}); |
… | |
… | |
177 | $GAUGES->{win}->{y} = $HEIGHT - $h; |
206 | $GAUGES->{win}->{y} = $HEIGHT - $h; |
178 | $GAUGES->{win}->{x} = 0; |
207 | $GAUGES->{win}->{x} = 0; |
179 | $GAUGES->{win}->update; |
208 | $GAUGES->{win}->update; |
180 | }); |
209 | }); |
181 | |
210 | |
|
|
211 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); |
|
|
212 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
213 | range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], |
|
|
214 | tooltip => "Adjust the size of the stats gauges at the bottom right", |
|
|
215 | connect_changed => sub { |
|
|
216 | $CFG->{gauge_size} = $_[1]; |
|
|
217 | my $h = int ($HEIGHT * $CFG->{gauge_size}); |
|
|
218 | $GAUGES->{win}->set_size ($WIDTH, $h); |
|
|
219 | $GAUGES->{win}->{y} = $HEIGHT - $h; |
|
|
220 | $GAUGES->{win}->{x} = 0; |
|
|
221 | $GAUGES->{win}->update; |
|
|
222 | } |
|
|
223 | ); |
182 | |
224 | |
183 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
225 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
184 | $table->add (1, $row++, new CFClient::UI::Slider range => [$CFG->{gauge_fontsize}, 0.7, 1.7, 0.1], connect_changed => sub { |
226 | $table->add (1, $row++, new CFClient::UI::Slider |
|
|
227 | range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1], |
|
|
228 | connect_changed => sub { |
185 | $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10; |
229 | $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10; |
186 | &set_gauge_window_fontsize; |
230 | &set_gauge_window_fontsize; |
187 | $GAUGES->{win}->check_size; |
231 | $GAUGES->{win}->check_size; |
188 | $GAUGES->{win}->update; |
232 | $GAUGES->{win}->update; |
|
|
233 | } |
189 | }); |
234 | ); |
190 | |
235 | |
191 | |
236 | $table->add (1, $row++, new CFClient::UI::Button |
192 | |
237 | expand => 1, align => 0, text => "Apply", |
193 | $table->add (1, $row++, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
238 | tooltip => "Apply the video settings (unless they are auto-apply)", |
|
|
239 | connect_activate => sub { |
194 | video_shutdown (); |
240 | video_shutdown (); |
195 | video_init (); |
241 | video_init (); |
|
|
242 | } |
196 | }); |
243 | ); |
197 | |
244 | |
198 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
245 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
199 | $table->add (1, $row++, new CFClient::UI::CheckBox state => $CFG->{audio_enable}, connect_changed => sub { |
246 | $table->add (1, $row++, new CFClient::UI::CheckBox |
|
|
247 | state => $CFG->{audio_enable}, |
|
|
248 | tooltip => "If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
|
|
249 | connect_changed => sub { |
200 | $CFG->{audio_enable} = $_[1]; |
250 | $CFG->{audio_enable} = $_[1]; |
|
|
251 | } |
201 | }); |
252 | ); |
202 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
253 | # $table->add (0, 9, new CFClient::UI::Label valign => 0, align => 1, text => "Effects Volume"); |
203 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { |
254 | # $table->add (1, 8, new CFClient::UI::Slider range => [$CFG->{effects_volume}, 0, 128, 1], connect_changed => sub { |
204 | # $CFG->{effects_volume} = $_[1]; |
255 | # $CFG->{effects_volume} = $_[1]; |
205 | # }); |
256 | # }); |
206 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
257 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Background Music"); |
207 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
258 | $table->add (1, $row++, my $hbox = new CFClient::UI::HBox); |
208 | $hbox->add (new CFClient::UI::CheckBox expand => 1, state => $CFG->{bgm_enable}, connect_changed => sub { |
259 | $hbox->add (new CFClient::UI::CheckBox |
|
|
260 | expand => 1, state => $CFG->{bgm_enable}, |
|
|
261 | tooltip => "Enable background music playing", |
|
|
262 | connect_changed => sub { |
209 | $CFG->{bgm_enable} = $_[1]; |
263 | $CFG->{bgm_enable} = $_[1]; |
|
|
264 | } |
210 | }); |
265 | ); |
211 | $hbox->add (new CFClient::UI::Slider expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], connect_changed => sub { |
266 | $hbox->add (new CFClient::UI::Slider |
|
|
267 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0.1], |
|
|
268 | tooltip => "The volume of the background music", |
|
|
269 | connect_changed => sub { |
212 | $CFG->{bgm_volume} = $_[1]; |
270 | $CFG->{bgm_volume} = $_[1]; |
213 | CFClient::MixMusic::volume $_[1] * 128; |
271 | CFClient::MixMusic::volume $_[1] * 128; |
|
|
272 | } |
214 | }); |
273 | ); |
215 | |
274 | |
216 | $table->add (1, $row++, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { |
275 | $table->add (1, $row++, new CFClient::UI::Button |
|
|
276 | expand => 1, align => 0, text => "Apply", |
|
|
277 | tooltip => "Apply the audio settings that are not auto-apply", |
|
|
278 | connect_activate => sub { |
217 | audio_shutdown (); |
279 | audio_shutdown (); |
218 | audio_init (); |
280 | audio_init (); |
|
|
281 | } |
219 | }); |
282 | ); |
220 | |
283 | |
221 | $dialog |
284 | $dialog |
222 | } |
285 | } |
223 | |
286 | |
224 | sub set_stats_window_fontsize { |
287 | sub set_stats_window_fontsize { |