… | |
… | |
324 | if (my $stat = delete $conn->{stat_change_with}) { |
324 | if (my $stat = delete $conn->{stat_change_with}) { |
325 | $conn->send ("reply $stat"); |
325 | $conn->send ("reply $stat"); |
326 | destroy_query_dialog $conn; |
326 | destroy_query_dialog $conn; |
327 | return; |
327 | return; |
328 | } |
328 | } |
329 | |
|
|
330 | $STATS_PAGE->show; |
|
|
331 | $MESSAGE_WINDOW->hide; |
|
|
332 | |
329 | |
333 | unshift @dialog, new CFPlus::UI::Label |
330 | unshift @dialog, new CFPlus::UI::Label |
334 | max_w => $::WIDTH * 0.4, |
331 | max_w => $::WIDTH * 0.4, |
335 | ellipsise => 0, |
332 | ellipsise => 0, |
336 | markup => "\nOr use your keyboard and the text entry below:\n"; |
333 | markup => "\nOr use your keyboard and the text entry below:\n"; |
… | |
… | |
610 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
607 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
611 | $table->add (1, $row++, new CFPlus::UI::Slider |
608 | $table->add (1, $row++, new CFPlus::UI::Slider |
612 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
609 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
613 | tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", |
610 | tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", |
614 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } |
611 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } |
615 | ); |
|
|
616 | |
|
|
617 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "FoW Smoothing"); |
|
|
618 | $table->add (1, $row++, new CFPlus::UI::CheckBox |
|
|
619 | state => $CFG->{fow_smooth}, |
|
|
620 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.", |
|
|
621 | on_changed => sub { |
|
|
622 | my ($self, $value) = @_; |
|
|
623 | $CFG->{fow_smooth} = $value; |
|
|
624 | 0 |
|
|
625 | } |
|
|
626 | ); |
612 | ); |
627 | |
613 | |
628 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
614 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
629 | $table->add (1, $row++, new CFPlus::UI::Slider |
615 | $table->add (1, $row++, new CFPlus::UI::Slider |
630 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
616 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
… | |
… | |
2152 | debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; |
2138 | debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; |
2153 | |
2139 | |
2154 | $CFPlus::UI::ROOT->draw; |
2140 | $CFPlus::UI::ROOT->draw; |
2155 | |
2141 | |
2156 | $WANT_REFRESH = 0; |
2142 | $WANT_REFRESH = 0; |
2157 | $CAN_REFRESH = 0; |
2143 | $CAN_REFRESH = 0; |
2158 | $LAST_REFRESH = $NOW; |
2144 | $LAST_REFRESH = $NOW; |
2159 | |
2145 | |
2160 | CFPlus::SDL_GL_SwapBuffers; |
2146 | CFPlus::SDL_GL_SwapBuffers; |
2161 | } |
2147 | } |
2162 | |
2148 | |
… | |
… | |
2166 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2152 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2167 | for CFPlus::poll_events; |
2153 | for CFPlus::poll_events; |
2168 | |
2154 | |
2169 | if (%animate_object) { |
2155 | if (%animate_object) { |
2170 | $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; |
2156 | $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; |
2171 | $WANT_REFRESH++; |
2157 | ++$WANT_REFRESH; |
2172 | } |
2158 | } |
2173 | |
2159 | |
2174 | if ($WANT_REFRESH) { |
2160 | if ($WANT_REFRESH) { |
2175 | force_refresh; |
2161 | force_refresh; |
2176 | } else { |
2162 | } else { |
… | |
… | |
2254 | fullscreen => 0, |
2240 | fullscreen => 0, |
2255 | fast => 0, |
2241 | fast => 0, |
2256 | map_scale => 1, |
2242 | map_scale => 1, |
2257 | fow_enable => 1, |
2243 | fow_enable => 1, |
2258 | fow_intensity => 0, |
2244 | fow_intensity => 0, |
2259 | fow_smooth => 1, |
|
|
2260 | map_smoothing => 1, |
2245 | map_smoothing => 1, |
2261 | gui_fontsize => 1, |
2246 | gui_fontsize => 1, |
2262 | log_fontsize => 0.7, |
2247 | log_fontsize => 0.7, |
2263 | gauge_fontsize => 1, |
2248 | gauge_fontsize => 1, |
2264 | gauge_size => 0.35, |
2249 | gauge_size => 0.35, |
… | |
… | |
2302 | |
2287 | |
2303 | @SDL_MODES = CFPlus::SDL_ListModes 8, 8; |
2288 | @SDL_MODES = CFPlus::SDL_ListModes 8, 8; |
2304 | @SDL_MODES = CFPlus::SDL_ListModes 5, 0 unless @SDL_MODES; |
2289 | @SDL_MODES = CFPlus::SDL_ListModes 5, 0 unless @SDL_MODES; |
2305 | @SDL_MODES or CFPlus::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; |
2290 | @SDL_MODES or CFPlus::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; |
2306 | |
2291 | |
|
|
2292 | @SDL_MODES = sort { $a->[0] * $a->[1] <=> $b->[0] * $b->[1] } @SDL_MODES; |
|
|
2293 | |
2307 | $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES; |
2294 | $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES; |
2308 | |
2295 | |
2309 | { |
2296 | { |
2310 | my @fonts = map CFPlus::find_rcfile "fonts/$_", qw( |
2297 | my @fonts = map CFPlus::find_rcfile "fonts/$_", qw( |
2311 | DejaVuSans.ttf |
2298 | DejaVuSans.ttf |