… | |
… | |
143 | our $NOW; |
143 | our $NOW; |
144 | |
144 | |
145 | our $CFG; |
145 | our $CFG; |
146 | our $PROFILE; # current profile |
146 | our $PROFILE; # current profile |
147 | our $FAST; # fast, low-quality mode, possibly useful for software-rendering |
147 | our $FAST; # fast, low-quality mode, possibly useful for software-rendering |
|
|
148 | our $DELIANTRA_DEBUG = $ENV{DELIANTRA_DEBUG} * 1; |
148 | |
149 | |
149 | our $WANT_REFRESH; |
150 | our $WANT_REFRESH; |
150 | |
151 | |
151 | our $MODE_SLIDER; |
152 | our $MODE_SLIDER; |
152 | our $CAVEAT_LABEL; |
153 | our $CAVEAT_LABEL; |
… | |
… | |
1186 | ); |
1187 | ); |
1187 | |
1188 | |
1188 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); |
1189 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); |
1189 | $table->add_at (1, $row, new DC::UI::CheckBox |
1190 | $table->add_at (1, $row, new DC::UI::CheckBox |
1190 | expand => 1, state => $CFG->{bgm_enable}, |
1191 | expand => 1, state => $CFG->{bgm_enable}, |
1191 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
1192 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played. Needs server reconnect to take effect.", |
1192 | on_changed => sub { |
1193 | on_changed => sub { |
1193 | $CFG->{bgm_enable} = $_[1]; |
1194 | $CFG->{bgm_enable} = $_[1]; |
1194 | $CONN->update_fx_want if $CONN; |
1195 | $CONN->update_fx_want if $CONN; |
1195 | audio_music_push; |
1196 | audio_music_push; |
1196 | 1 |
1197 | 1 |
… | |
… | |
1333 | &set_gauge_window_fontsize; |
1334 | &set_gauge_window_fontsize; |
1334 | |
1335 | |
1335 | $win |
1336 | $win |
1336 | } |
1337 | } |
1337 | |
1338 | |
|
|
1339 | our $BW_WATCHER; |
|
|
1340 | |
|
|
1341 | sub debug_toggle($) { |
|
|
1342 | $DELIANTRA_DEBUG ^= $_[0]; |
|
|
1343 | |
|
|
1344 | if ($DELIANTRA_DEBUG & 16) { |
|
|
1345 | $BW_WATCHER = EV::periodic 0, 1, 0, sub { |
|
|
1346 | return unless $CONN; |
|
|
1347 | debug sprintf "%.2gKB/s", $CONN->{octets_in} / 1e3; |
|
|
1348 | $CONN->{octets_in} = 0; |
|
|
1349 | }; |
|
|
1350 | } else { |
|
|
1351 | undef $BW_WATCHER; |
|
|
1352 | } |
|
|
1353 | |
|
|
1354 | } |
|
|
1355 | |
1338 | sub debug_setup { |
1356 | sub debug_setup { |
1339 | my $table = new DC::UI::Table; |
1357 | my $table = new DC::UI::Table; |
1340 | |
1358 | |
1341 | $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders"); |
1359 | $table->add_at (0, 0, new DC::UI::Label text => "Widget Borders"); |
1342 | $table->add_at (1, 0, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 1; 0 }); |
1360 | $table->add_at (1, 0, new DC::UI::CheckBox on_changed => sub { debug_toggle 1; 0 }); |
1343 | $table->add_at (0, 1, new DC::UI::Label text => "Tooltip Widget Info"); |
1361 | $table->add_at (0, 1, new DC::UI::Label text => "Tooltip Widget Info"); |
1344 | $table->add_at (1, 1, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 2; 0 }); |
1362 | $table->add_at (1, 1, new DC::UI::CheckBox on_changed => sub { debug_toggle 2; 0 }); |
1345 | $table->add_at (0, 2, new DC::UI::Label text => "Show FPS"); |
1363 | $table->add_at (0, 2, new DC::UI::Label text => "Show FPS"); |
1346 | $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
1364 | $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { debug_toggle 4; 0 }); |
1347 | $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); |
1365 | $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); |
1348 | $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
1366 | $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { debug_toggle 8; 0 }); |
|
|
1367 | $table->add_at (0, 4, new DC::UI::Label text => "Show Bandwidth"); |
|
|
1368 | $table->add_at (1, 4, new DC::UI::CheckBox on_changed => sub { debug_toggle 16; 0 }); |
|
|
1369 | |
1349 | $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1370 | $table->add_at (0, 6, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1350 | |
|
|
1351 | $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# |
1371 | $table->add_at (0, 7, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# |
1352 | |
1372 | |
1353 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1373 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1354 | $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2); |
1374 | $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2); |
1355 | $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); |
1375 | $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); |
1356 | $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2); |
1376 | $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2); |
… | |
… | |
2491 | |
2511 | |
2492 | $DEBUG_STATUS = new DC::UI::Label |
2512 | $DEBUG_STATUS = new DC::UI::Label |
2493 | padding => 0, |
2513 | padding => 0, |
2494 | z => 100, |
2514 | z => 100, |
2495 | force_x => "max", |
2515 | force_x => "max", |
2496 | force_y => 0; |
2516 | force_y => 20; |
2497 | $DEBUG_STATUS->show; |
2517 | $DEBUG_STATUS->show; |
2498 | |
2518 | |
2499 | $STATUSBOX = new DC::UI::Statusbox; |
2519 | $STATUSBOX = new DC::UI::Statusbox; |
2500 | |
2520 | |
2501 | $MODBOX = new DC::UI::Label |
2521 | $MODBOX = new DC::UI::Label |
… | |
… | |
2629 | my $animate_timer; |
2649 | my $animate_timer; |
2630 | |
2650 | |
2631 | my $fps = 9; |
2651 | my $fps = 9; |
2632 | |
2652 | |
2633 | sub force_refresh { |
2653 | sub force_refresh { |
2634 | if ($ENV{CFPLUS_DEBUG} & 4) { |
2654 | if ($DELIANTRA_DEBUG & 4) { |
2635 | $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; |
2655 | $fps = $fps * 0.98 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.02; |
2636 | debug sprintf "%3.2f", $fps; |
2656 | debug sprintf "%3.2f", $fps; |
2637 | } |
2657 | } |
2638 | |
2658 | |
2639 | undef $WANT_REFRESH; |
2659 | undef $WANT_REFRESH; |
… | |
… | |
2877 | our $STARTUP_CANCEL = EV::idle sub { |
2897 | our $STARTUP_CANCEL = EV::idle sub { |
2878 | undef $::STARTUP_CANCEL; |
2898 | undef $::STARTUP_CANCEL; |
2879 | $startup_done->(); |
2899 | $startup_done->(); |
2880 | }; |
2900 | }; |
2881 | |
2901 | |
|
|
2902 | debug_toggle 0; |
|
|
2903 | |
2882 | delete $SIG{__DIE__}; |
2904 | delete $SIG{__DIE__}; |
2883 | EV::loop; |
2905 | EV::loop; |
2884 | |
2906 | |
2885 | DC::write_cfg if $CFG->{config_autosave}; |
2907 | DC::write_cfg if $CFG->{config_autosave}; |
2886 | |
2908 | |
… | |
… | |
2908 | The deliantra client utilises OpenGL for all UI elements and the game. It |
2930 | The deliantra client utilises OpenGL for all UI elements and the game. It |
2909 | is supposed to be used in fullscreen mode and interactively. |
2931 | is supposed to be used in fullscreen mode and interactively. |
2910 | |
2932 | |
2911 | =head1 DEBUGGING |
2933 | =head1 DEBUGGING |
2912 | |
2934 | |
2913 | CFPLUS_DEBUG - environment variable |
2935 | DELIANTRA_DEBUG - environment variable |
2914 | |
2936 | |
2915 | 1 draw borders around widgets |
2937 | 1 draw borders around widgets |
2916 | 2 add low-level widget info to tooltips |
2938 | 2 add low-level widget info to tooltips |
2917 | 4 show fps |
2939 | 4 show fps |
2918 | 8 suppress tooltips |
2940 | 8 suppress tooltips |
|
|
2941 | 16 show bandwidth downstream |
2919 | |
2942 | |
2920 | =head1 AUTHOR |
2943 | =head1 AUTHOR |
2921 | |
2944 | |
2922 | Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
2945 | Marc Lehmann <deliantra@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
2923 | |
2946 | |