… | |
… | |
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"; |
… | |
… | |
589 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
586 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
590 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
587 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
591 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
588 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
592 | ); |
589 | ); |
593 | |
590 | |
594 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Smoothing"); |
591 | $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Smoothing"); |
595 | $table->add (1, $row++, new CFPlus::UI::CheckBox |
592 | $table->add (1, $row++, new CFPlus::UI::CheckBox |
596 | state => $CFG->{map_smoothing}, |
593 | state => $CFG->{map_smoothing}, |
597 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
594 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
598 | . "This increases load on the graphics subsystem and works only with 2.x servers. " |
595 | . "This increases load on the graphics subsystem and works only with 2.x servers. " |
599 | . "Changes take effect at next connection only.", |
596 | . "Changes take effect at next connection only.", |
… | |
… | |
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 Smooth"); |
|
|
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 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFPlus::OpenGL::GL_VERSION < 1.2; |
|
|
625 | 0 |
|
|
626 | } |
|
|
627 | ); |
612 | ); |
628 | |
613 | |
629 | $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"); |
630 | $table->add (1, $row++, new CFPlus::UI::Slider |
615 | $table->add (1, $row++, new CFPlus::UI::Slider |
631 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
616 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
… | |
… | |
764 | $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS"); |
749 | $table->add (0, 2, new CFPlus::UI::Label text => "Show FPS"); |
765 | $table->add (1, 2, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
750 | $table->add (1, 2, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
766 | $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips"); |
751 | $table->add (0, 3, new CFPlus::UI::Label text => "Suppress Tooltips"); |
767 | $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
752 | $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
768 | $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } ); |
753 | $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } ); |
769 | |
|
|
770 | my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); |
|
|
771 | |
|
|
772 | for my $x (0..2) { |
|
|
773 | for my $y (0 .. 2) { |
|
|
774 | $table->add ($x + 3, $y, |
|
|
775 | new CFPlus::UI::Entry |
|
|
776 | text => $default_smooth[$x * 3 + $y], |
|
|
777 | on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 }, |
|
|
778 | ); |
|
|
779 | } |
|
|
780 | } |
|
|
781 | |
754 | |
782 | $table->add (0, 5, new CFPlus::UI::TextEdit text => "line1\0152\0153");#d# |
755 | $table->add (0, 5, new CFPlus::UI::TextEdit text => "line1\0152\0153");#d# |
783 | |
756 | |
784 | $table |
757 | $table |
785 | } |
758 | } |
… | |
… | |
2165 | debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; |
2138 | debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; |
2166 | |
2139 | |
2167 | $CFPlus::UI::ROOT->draw; |
2140 | $CFPlus::UI::ROOT->draw; |
2168 | |
2141 | |
2169 | $WANT_REFRESH = 0; |
2142 | $WANT_REFRESH = 0; |
2170 | $CAN_REFRESH = 0; |
2143 | $CAN_REFRESH = 0; |
2171 | $LAST_REFRESH = $NOW; |
2144 | $LAST_REFRESH = $NOW; |
2172 | |
2145 | |
2173 | CFPlus::SDL_GL_SwapBuffers; |
2146 | CFPlus::SDL_GL_SwapBuffers; |
2174 | } |
2147 | } |
2175 | |
2148 | |
… | |
… | |
2179 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2152 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2180 | for CFPlus::poll_events; |
2153 | for CFPlus::poll_events; |
2181 | |
2154 | |
2182 | if (%animate_object) { |
2155 | if (%animate_object) { |
2183 | $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; |
2156 | $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; |
2184 | $WANT_REFRESH++; |
2157 | ++$WANT_REFRESH; |
2185 | } |
2158 | } |
2186 | |
2159 | |
2187 | if ($WANT_REFRESH) { |
2160 | if ($WANT_REFRESH) { |
2188 | force_refresh; |
2161 | force_refresh; |
2189 | } else { |
2162 | } else { |
… | |
… | |
2266 | height => 480, |
2239 | height => 480, |
2267 | fullscreen => 0, |
2240 | fullscreen => 0, |
2268 | fast => 0, |
2241 | fast => 0, |
2269 | map_scale => 1, |
2242 | map_scale => 1, |
2270 | fow_enable => 1, |
2243 | fow_enable => 1, |
2271 | fow_intensity => 0.45, |
2244 | fow_intensity => 0, |
2272 | fow_smooth => 0, |
|
|
2273 | map_smoothing => 1, |
2245 | map_smoothing => 1, |
2274 | gui_fontsize => 1, |
2246 | gui_fontsize => 1, |
2275 | log_fontsize => 0.7, |
2247 | log_fontsize => 0.7, |
2276 | gauge_fontsize => 1, |
2248 | gauge_fontsize => 1, |
2277 | gauge_size => 0.35, |
2249 | gauge_size => 0.35, |
… | |
… | |
2315 | |
2287 | |
2316 | @SDL_MODES = CFPlus::SDL_ListModes 8, 8; |
2288 | @SDL_MODES = CFPlus::SDL_ListModes 8, 8; |
2317 | @SDL_MODES = CFPlus::SDL_ListModes 5, 0 unless @SDL_MODES; |
2289 | @SDL_MODES = CFPlus::SDL_ListModes 5, 0 unless @SDL_MODES; |
2318 | @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)"; |
2319 | |
2291 | |
|
|
2292 | @SDL_MODES = sort { $a->[0] * $a->[1] <=> $b->[0] * $b->[1] } @SDL_MODES; |
|
|
2293 | |
2320 | $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES; |
2294 | $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES; |
2321 | |
2295 | |
2322 | { |
2296 | { |
2323 | my @fonts = map CFPlus::find_rcfile "fonts/$_", qw( |
2297 | my @fonts = map CFPlus::find_rcfile "fonts/$_", qw( |
2324 | DejaVuSans.ttf |
2298 | DejaVuSans.ttf |