… | |
… | |
94 | our $SDL_MIXER; |
94 | our $SDL_MIXER; |
95 | our @SOUNDS; # event => file mapping |
95 | our @SOUNDS; # event => file mapping |
96 | our %AUDIO_CHUNKS; # audio files |
96 | our %AUDIO_CHUNKS; # audio files |
97 | |
97 | |
98 | our $ALT_ENTER_MESSAGE; |
98 | our $ALT_ENTER_MESSAGE; |
99 | our $STATUS_LINE; |
99 | our $STATUSBOX; |
100 | our $DEBUG_STATUS; |
100 | our $DEBUG_STATUS; |
101 | |
101 | |
102 | our $INVWIN; |
102 | our $INVWIN; |
103 | our $INV; |
103 | our $INV; |
104 | |
104 | |
105 | sub status { |
105 | sub status { |
106 | $STATUS_LINE->add ($_[0], group => "status", timeout => 60); |
106 | $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, color => [1, 1, 0, 1]); |
107 | $CFClient::UI::ROOT->on_refresh ($STATUS_LINE => sub { |
107 | $CFClient::UI::ROOT->on_post_alloc (status_line_positioner => sub { |
|
|
108 | my $widget = $STATUSBOX->{parent}; |
108 | $STATUS_LINE->move (0, $HEIGHT - $STATUS_LINE->{h});#d# to in toplevel |
109 | $widget->move (0, $HEIGHT - $widget->{h});#d# to in toplevel |
109 | }); |
110 | }); |
110 | } |
111 | } |
111 | |
112 | |
112 | sub debug { |
113 | sub debug { |
113 | $DEBUG_STATUS->set_text ($_[0]); |
114 | $DEBUG_STATUS->set_text ($_[0]); |
… | |
… | |
381 | y => $HEIGHT - $gh, x => 0, user_w => $WIDTH, user_h => $gh |
382 | y => $HEIGHT - $gh, x => 0, user_w => $WIDTH, user_h => $gh |
382 | ); |
383 | ); |
383 | $win->add (my $hbox = new CFClient::UI::HBox |
384 | $win->add (my $hbox = new CFClient::UI::HBox |
384 | children => [ |
385 | children => [ |
385 | (new CFClient::UI::HBox expand => 1), |
386 | (new CFClient::UI::HBox expand => 1), |
386 | ($FLOORBOX = new CFClient::UI::VBox), |
387 | (new CFClient::UI::VBox children => [ |
|
|
388 | (new CFClient::UI::Empty expand => 1), |
|
|
389 | (new CFClient::UI::Frame bg => [0, 0, 0, 0.4], child => ($FLOORBOX = new CFClient::UI::VBox)), |
|
|
390 | ]), |
387 | (my $vbox = new CFClient::UI::VBox), |
391 | (my $vbox = new CFClient::UI::VBox), |
388 | ], |
392 | ], |
389 | ); |
393 | ); |
390 | |
394 | |
391 | $vbox->add (new CFClient::UI::HBox |
395 | $vbox->add (new CFClient::UI::HBox |
… | |
… | |
855 | # create the widgets |
859 | # create the widgets |
856 | |
860 | |
857 | $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100, text => "hulla", x => 100;#d# |
861 | $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100, text => "hulla", x => 100;#d# |
858 | $DEBUG_STATUS->show; |
862 | $DEBUG_STATUS->show; |
859 | |
863 | |
860 | $STATUS_LINE = new CFClient::UI::Statusbox; |
864 | $STATUSBOX = new CFClient::UI::Statusbox; |
861 | $STATUS_LINE->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => 0, size => 0.8, color => [1, 1, 1]); |
865 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, size => 0.8, color => [1, 1, 1, 0.8]); |
862 | $STATUS_LINE->show; |
866 | |
|
|
867 | (new CFClient::UI::Frame |
|
|
868 | bg => [0, 0, 0, 0.4], |
|
|
869 | child => $STATUSBOX, |
|
|
870 | )->show; |
863 | |
871 | |
864 | CFClient::UI::FancyFrame->new ( |
872 | CFClient::UI::FancyFrame->new ( |
865 | border_bg => [1, 1, 1, 192/255], |
873 | border_bg => [1, 1, 1, 192/255], |
866 | bg => [1, 1, 1, 0], |
874 | bg => [1, 1, 1, 0], |
867 | child => ($MAPMAP = new CFClient::MapWidget::MapMap), |
875 | child => ($MAPMAP = new CFClient::MapWidget::MapMap), |
… | |
… | |
900 | }); |
908 | }); |
901 | |
909 | |
902 | $BUTTONBAR->show; |
910 | $BUTTONBAR->show; |
903 | |
911 | |
904 | # delay till geometry is constant |
912 | # delay till geometry is constant |
905 | $CFClient::UI::ROOT->on_refresh (startup => sub { |
913 | $CFClient::UI::ROOT->on_post_alloc (startup => sub { |
906 | $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup |
914 | $BUTTONBAR->{children}[1]->emit ("activate"); # pop up server setup |
907 | }); |
915 | }); |
908 | force_refresh (); |
916 | force_refresh (); |
909 | } |
917 | } |
910 | } |
918 | } |
… | |
… | |
1323 | [0.74, 0.65, 0.41], |
1331 | [0.74, 0.65, 0.41], |
1324 | ); |
1332 | ); |
1325 | |
1333 | |
1326 | my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0]; |
1334 | my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0]; |
1327 | |
1335 | |
1328 | $LOGVIEW->add_paragraph ($color[$color], |
|
|
1329 | join "\n", map "$time $_", split /\n/, $text); |
|
|
1330 | |
|
|
1331 | $text =~ s/&/&/g; $text =~ s/</</g; |
1336 | $text =~ s/&/&/g; $text =~ s/</</g; |
1332 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
1337 | $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; |
1333 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
1338 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
1334 | $STATUS_LINE->add ($text, color => $color[$color], timeout => 60); |
1339 | |
|
|
1340 | $LOGVIEW->add_paragraph ($color[$color], |
|
|
1341 | join "\n", map "$time $_", split /\n/, $text); |
|
|
1342 | |
|
|
1343 | $STATUSBOX->add ($text, |
|
|
1344 | group => $text, |
|
|
1345 | color => $color[$color], |
|
|
1346 | timeout => 60, |
|
|
1347 | tooltip_font => $::FONT_FIXED, |
|
|
1348 | ); |
1335 | } |
1349 | } |
1336 | |
1350 | |
1337 | sub conn::drawextinfo { |
1351 | sub conn::drawextinfo { |
1338 | my ($self, $color, $type, $subtype, $message) = @_; |
1352 | my ($self, $color, $type, $subtype, $message) = @_; |
1339 | |
1353 | |