… | |
… | |
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], pri => -10, group => "status", timeout => 20, color => [1, 1, 0, 1]); |
106 | $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, color => [1, 1, 0, 1]); |
107 | $CFClient::UI::ROOT->on_post_alloc ($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 => -100, size => 0.8, color => [1, 1, 1, 0.8]); |
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), |
… | |
… | |
1330 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
1338 | $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; |
1331 | |
1339 | |
1332 | $LOGVIEW->add_paragraph ($color[$color], |
1340 | $LOGVIEW->add_paragraph ($color[$color], |
1333 | join "\n", map "$time $_", split /\n/, $text); |
1341 | join "\n", map "$time $_", split /\n/, $text); |
1334 | |
1342 | |
1335 | $STATUS_LINE->add ($text, |
1343 | $STATUSBOX->add ($text, |
1336 | group => $text, |
1344 | group => $text, |
1337 | color => $color[$color], |
1345 | color => $color[$color], |
1338 | timeout => 60, |
1346 | timeout => 60, |
1339 | tooltip_font => $::FONT_FIXED, |
1347 | tooltip_font => $::FONT_FIXED, |
1340 | ); |
1348 | ); |