ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.215 by root, Mon May 15 00:15:08 2006 UTC vs.
Revision 1.224 by root, Wed May 17 15:18:57 2006 UTC

1#!/opt/bin/perl 1#!/opt/bin/perl
2 2
3use strict; 3use strict;
4use utf8; 4use utf8;
5 5
6# do things only needed for single-binary version (par)
6BEGIN { 7BEGIN {
7 if (%PAR::LibCache) { 8 if (%PAR::LibCache) {
8 @INC = grep ref, @INC; # weed out all paths except pars loader refs 9 @INC = grep ref, @INC; # weed out all paths except pars loader refs
9 10
10 while (my ($filename, $zip) = each %PAR::LibCache) { 11 while (my ($filename, $zip) = each %PAR::LibCache) {
13 $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1") 14 $zip->extractMember ($_, "$ENV{PAR_TEMP}/$1")
14 unless -e "$ENV{PAR_TEMP}/$1"; 15 unless -e "$ENV{PAR_TEMP}/$1";
15 } 16 }
16 } 17 }
17 18
19 # TODO: pango-rc file, anybody?
20
18 unshift @INC, $ENV{PAR_TEMP}; 21 unshift @INC, $ENV{PAR_TEMP};
19
20 if ($^O eq "MSWin32") {
21 $ENV{GTK_RC_FILES} = "$ENV{PAR_TEMP}/share/themes/MS-Windows/gtk-2.0/gtkrc";
22 }
23 } 22 }
24} 23}
25 24
26# need to do it again because that pile of garbage called PAR nukes it before main 25# need to do it again because that pile of garbage called PAR nukes it before main
27unshift @INC, $ENV{PAR_TEMP}; 26unshift @INC, $ENV{PAR_TEMP}
27 if %PAR::LibCache;
28 28
29use Time::HiRes 'time'; 29use Time::HiRes 'time';
30use Pod::POM;
30use Event; 31use Event;
31 32
32use Crossfire; 33use Crossfire;
33use Crossfire::Protocol; 34use Crossfire::Protocol;
34 35
99our $STATUSBOX; 100our $STATUSBOX;
100our $DEBUG_STATUS; 101our $DEBUG_STATUS;
101 102
102our $INVWIN; 103our $INVWIN;
103our $INV; 104our $INV;
105our $INVR;
106our $INVR_LBL;
107our $OPENCONT;
104 108
105sub status { 109sub status {
106 $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]); 110 $STATUSBOX->add ($_[0], pri => -10, group => "status", timeout => 20, fg => [1, 1, 0, 1]);
107} 111}
108 112
164 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); 168 $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]);
165 169
166 $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); 170 $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode");
167 $table->add (1, 0, my $hbox = new CFClient::UI::HBox); 171 $table->add (1, 0, my $hbox = new CFClient::UI::HBox);
168 172
169 $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1]); 173 $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 1, 1]);
170 $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); 174 $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999");
171 175
172 $mode_slider->connect (changed => sub { 176 $mode_slider->connect (changed => sub {
173 my ($self, $value) = @_; 177 my ($self, $value) = @_;
174 178
199 } 203 }
200 ); 204 );
201 205
202 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale"); 206 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Map Scale");
203 $table->add (1, $row++, new CFClient::UI::Slider 207 $table->add (1, $row++, new CFClient::UI::Slider
204 range => [$CFG->{map_scale}, 0.25, 2, 0.05], 208 range => [$CFG->{map_scale}, 0.25, 2, 0.05, 0.05],
205 tooltip => "Enlarge or shrink the displayed map", 209 tooltip => "Enlarge or shrink the displayed map",
206 connect_changed => sub { 210 connect_changed => sub {
207 my ($self, $value) = @_; 211 my ($self, $value) = @_;
208 $CFG->{map_scale} = 0.05 * int $value / 0.05; 212 $CFG->{map_scale} = $value;
209 } 213 }
210 ); 214 );
211 215
212 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War"); 216 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Fog of War");
213 $table->add (1, $row++, new CFClient::UI::CheckBox 217 $table->add (1, $row++, new CFClient::UI::CheckBox
240 } 244 }
241 ); 245 );
242 246
243 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); 247 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize");
244 $table->add (1, $row++, new CFClient::UI::Slider 248 $table->add (1, $row++, new CFClient::UI::Slider
245 range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1], 249 range => [$CFG->{gui_fontsize}, 0.5, 2, 0.1, 0.1],
246 tooltip => "The font size used by most GUI elements", 250 tooltip => "The font size used by most GUI elements",
247 connect_changed => sub { 251 connect_changed => sub { $CFG->{gui_fontsize} = $_[1] },
248 $CFG->{gui_fontsize} = 0.1 * int $_[1] * 10;
249# $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize};
250 }
251 ); 252 );
252 253
253 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize"); 254 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Server Log Fontsize");
254 $table->add (1, $row++, new CFClient::UI::Slider 255 $table->add (1, $row++, new CFClient::UI::Slider
255 range => [$CFG->{log_fontsize}, 0.5, 2, 0.1], 256 range => [$CFG->{log_fontsize}, 0.5, 2, 0.1, 0.1],
256 tooltip => "The font size used by the server log window only", 257 tooltip => "The font size used by the server log window only",
257 connect_changed => sub { 258 connect_changed => sub { $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = $_[1]) },
258 $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = 0.1 * int $_[1] * 10);
259 }
260 ); 259 );
261 260
262 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize"); 261 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Stats Fontsize");
263 262
264 $table->add (1, $row++, new CFClient::UI::Slider 263 $table->add (1, $row++, new CFClient::UI::Slider
265 range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1], 264 range => [$CFG->{stat_fontsize}, 0.5, 2, 0.1, 0.1],
266 tooltip => "The font size used by the statistics window only", 265 tooltip => "The font size used by the statistics window only",
267 connect_changed => sub { 266 connect_changed => sub {
268 $CFG->{stat_fontsize} = 0.1 * int $_[1] * 10; 267 $CFG->{stat_fontsize} = $_[1];
269 &set_stats_window_fontsize; 268 &set_stats_window_fontsize;
270 } 269 }
271 ); 270 );
272 271
273 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size"); 272 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge size");
274 $table->add (1, $row++, new CFClient::UI::Slider 273 $table->add (1, $row++, new CFClient::UI::Slider
275 range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02], 274 range => [$CFG->{gauge_size}, 0.2, 0.8, 0.02],
276 tooltip => "Adjust the size of the stats gauges at the bottom right", 275 tooltip => "Adjust the size of the stats gauges at the bottom right",
277 connect_changed => sub { 276 connect_changed => sub {
278 $CFG->{gauge_size} = $_[1]; 277 $CFG->{gauge_size} = $_[1];
279 my $h = int $HEIGHT * $CFG->{gauge_size}; 278 $GAUGES->{win}->set_size ($WIDTH, int $HEIGHT * $CFG->{gauge_size});
280 $GAUGES->{win}->set_size ($WIDTH, $h);
281 $GAUGES->{win}->move (0, $HEIGHT - $h);
282 } 279 }
283 ); 280 );
284 281
285 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); 282 $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "Gauge fontsize");
286 $table->add (1, $row++, new CFClient::UI::Slider 283 $table->add (1, $row++, new CFClient::UI::Slider
287 range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1], 284 range => [$CFG->{gauge_fontsize}, 0.5, 2.0, 0.1, 0.1],
288 tooltip => "Adjusts the fontsize of the gauges at the bottom right", 285 tooltip => "Adjusts the fontsize of the gauges at the bottom right",
289 connect_changed => sub { 286 connect_changed => sub {
290 $CFG->{gauge_fontsize} = 0.1 * int $_[1] * 10; 287 $CFG->{gauge_fontsize} = $_[1];
291 &set_gauge_window_fontsize; 288 &set_gauge_window_fontsize;
292 } 289 }
293 ); 290 );
294 291
295 $table->add (1, $row++, new CFClient::UI::Button 292 $table->add (1, $row++, new CFClient::UI::Button
670 $HOST->set_text ($CFG->{host} = $host); 667 $HOST->set_text ($CFG->{host} = $host);
671 }), 668 }),
672 (new CFClient::UI::Empty expand => 1), 669 (new CFClient::UI::Empty expand => 1),
673 ]); 670 ]);
674 671
675 $table->add ($_ + 1, $y, new CFClient::UI::Label align => $align[$_], text => $m->[$_], fontsize => 0.8) 672 $table->add ($_ + 1, $y, new CFClient::UI::Label
673 ellipsise => 0, align => $align[$_], text => $m->[$_], fontsize => 0.8)
676 for 0 .. $#$m; 674 for 0 .. $#$m;
677 } 675 }
678 } 676 }
679 }); 677 });
680} 678}
736 ); 734 );
737 735
738 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); 736 $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size");
739 $table->add (1, 7, new CFClient::UI::Slider 737 $table->add (1, 7, new CFClient::UI::Slider
740 req_w => 100, 738 req_w => 100,
741 range => [$CFG->{mapsize}, 10, 100 + 1, 1], 739 range => [$CFG->{mapsize}, 10, 100 + 1, 1, 1],
742 tooltip => "This is the size of the portion of the map update the server sends you. " 740 tooltip => "This is the size of the portion of the map update the server sends you. "
743 ."If you set this to a high value you will be able to see further for example.", 741 ."If you set this to a high value you will be able to see further for example.",
744 connect_changed => sub { 742 connect_changed => sub {
745 my ($self, $value) = @_; 743 my ($self, $value) = @_;
746 744
814 812
815 $window 813 $window
816} 814}
817 815
818sub make_inventory_window { 816sub make_inventory_window {
819 my $invwin = new CFClient::UI::FancyFrame user_w => 300, user_h => 300, title => "Inventory"; 817 my $invwin = new CFClient::UI::FancyFrame
818 user_w => $WIDTH * (4/5), user_h => $HEIGHT * (4/5), title => "Inventory";
819
820 $invwin->add (my $hb = new CFClient::UI::HBox);
821
822 $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1);
823 $vb1->add (my $lbl = new CFClient::UI::Label);
824 $lbl->set_text ("Player");
820 $invwin->add ($INV = new CFClient::UI::Inventory expand => 1); 825 $vb1->add ($INV = new CFClient::UI::Inventory expand => 1);
826
827 $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1);
828 $vb2->add ($INVR_LBL = new CFClient::UI::Label);
829 $INVR_LBL->set_text ("Floor");
830 $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1);
831
821 $invwin 832 $invwin
822} 833}
823 834
824sub sdl_init { 835sub sdl_init {
825 CFClient::SDL_Init 836 CFClient::SDL_Init
1022 1033
1023@conn::ISA = Crossfire::Protocol::; 1034@conn::ISA = Crossfire::Protocol::;
1024 1035
1025sub conn::stats_update { 1036sub conn::stats_update {
1026 my ($self, $stats) = @_; 1037 my ($self, $stats) = @_;
1038
1039 if (my $exp = $stats->{Crossfire::Protocol::CS_STAT_EXP64}) {
1040 my $diff = $exp - $self->{prev_exp};
1041 $STATUSBOX->add ("$diff experience gained", group => "experience $diff", fg => [0.5, 1, 0.5, 0.8], timeout => 5)
1042 if exists $self->{prev_exp} && $diff;
1043 $self->{prev_exp} = $exp;
1044 }
1027 1045
1028 update_stats_window ($stats); 1046 update_stats_window ($stats);
1029} 1047}
1030 1048
1031sub conn::user_send { 1049sub conn::user_send {
1330 [0.74, 0.65, 0.41], 1348 [0.74, 0.65, 0.41],
1331 ); 1349 );
1332 1350
1333 my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0]; 1351 my $time = sprintf "%02d:%02d:%02d", (localtime time)[2,1,0];
1334 1352
1335 $text =~ s/&/&amp;/g; $text =~ s/</&lt;/g; 1353 $text = CFClient::UI::Label::escape $text;
1336 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g; 1354 $text =~ s/\[b\](.*?)\[\/b\]/<b>\1<\/b>/g;
1337 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g; 1355 $text =~ s/\[color=(.*?)\](.*?)\[\/color\]/<span foreground='\1'>\2<\/span>/g;
1338 1356
1339 $LOGVIEW->add_paragraph ($color[$color], 1357 $LOGVIEW->add_paragraph ($color[$color],
1340 join "\n", map "$time $_", split /\n/, $text); 1358 join "\n", map "$time $_", split /\n/, $text);
1356sub conn::spell_add { 1374sub conn::spell_add {
1357 my ($self, $spell) = @_; 1375 my ($self, $spell) = @_;
1358 1376
1359 # TODO 1377 # TODO
1360 # create a widget dynamically, using spell face (CF::Protocol downloads them) 1378 # create a widget dynamically, using spell face (CF::Protocol downloads them)
1361 $MAPWIDGET->add_command ("invoke $spell->{name}", $spell->{message}); 1379 $MAPWIDGET->add_command ("invoke $spell->{name}", CFClient::UI::Label::escape $spell->{message});
1362 $MAPWIDGET->add_command ("cast $spell->{name}", $spell->{message}); 1380 $MAPWIDGET->add_command ("cast $spell->{name}", CFClient::UI::Label::escape $spell->{message});
1363} 1381}
1364 1382
1365sub conn::spell_delete { 1383sub conn::spell_delete {
1366 my ($self, $spell) = @_; 1384 my ($self, $spell) = @_;
1367} 1385}
1368 1386
1369sub conn::addme_success { 1387sub conn::addme_success {
1370 my ($self) = @_; 1388 my ($self) = @_;
1371 1389
1390 $MAPWIDGET->clr_commands;
1391
1372 for my $skill (values %{$self->{skill_info}}) { 1392 for my $skill (values %{$self->{skill_info}}) {
1373 $MAPWIDGET->add_command ("ready_skill $skill", "Ready the skill '$skill'"); 1393 $MAPWIDGET->add_command ("ready_skill $skill", CFClient::UI::Label::escape "Ready the skill '$skill'");
1374 $MAPWIDGET->add_command ("use_skill $skill", "Immediately use the skill '$skill'"); 1394 $MAPWIDGET->add_command ("use_skill $skill", CFClient::UI::Label::escape "Immediately use the skill '$skill'");
1375 } 1395 }
1376 1396
1377 $MAPWIDGET->add_command ("pet\\_mode defend", "Tell pets to stay close to you and defend you"); 1397 $MAPWIDGET->add_command ("petmode defend", "Tell pets to stay close to you and defend you");
1378 $MAPWIDGET->add_command ("pet\\_mode arena", "Same as petmode attack, but also attack other players"); 1398 $MAPWIDGET->add_command ("petmode arena", "Same as petmode sad, but also attack other players");
1379 $MAPWIDGET->add_command ("pet\\_mode sad", "Search &amp; Destroy - tell pets to roam about and attack enemies"); 1399 $MAPWIDGET->add_command ("petmode sad", "Search &amp; Destroy - tell pets to roam about and attack enemies");
1380 $MAPWIDGET->add_command ("kill\\_pets", "kill your pets"); 1400 $MAPWIDGET->add_command ("killpets", "Kill your pets");
1401 $MAPWIDGET->add_command ("chat", "chat TEXT\nChat with all other players");
1402 $MAPWIDGET->add_command ("shout", "shout TEXT\nShout loudly, used for emergencies");
1403 $MAPWIDGET->add_command ("tell", "tell USERNAME TEXT\nPrivately tell a specific player");
1404
1405 my $parser = new Pod::POM;
1406 my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod");
1407
1408 for my $head2 ($pod->head2) {
1409 $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x
1410 or next;
1411
1412 my $cmd = $1;
1413 my @args = split /\|/, $2;
1414 @args = (".*") unless @args;
1415
1416 my $text = CFClient::pod_to_pango $head2;
1417
1418 for my $arg (@args) {
1419 $arg = $arg eq ".*" ? "" : " $arg";
1420
1421 $MAPWIDGET->add_command ("$cmd$arg", $text);
1422 }
1423 }
1381} 1424}
1382 1425
1383sub conn::eof { 1426sub conn::eof {
1427 $MAPWIDGET->clr_commands;
1428
1384 stop_game; 1429 stop_game;
1385} 1430}
1386 1431
1387sub update_floorbox { 1432sub update_floorbox {
1388 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { 1433 $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub {
1406} 1451}
1407 1452
1408sub conn::container_add { 1453sub conn::container_add {
1409 my ($self, $tag, $items) = @_; 1454 my ($self, $tag, $items) = @_;
1410 1455
1411 update_floorbox if $tag == 0; 1456 #d# print "container_add: container $tag ($self->{player}{tag})\n";
1412 1457
1458 if ($tag == 0) {
1459 update_floorbox;
1460 $OPENCONT = 0;
1461 $INVR_LBL->set_text ("Floor");
1462 $INVR->set_items ($self->{container}{0});
1463 } elsif ($tag == $self->{player}{tag}) {
1464 $INVR_LBL->set_text ("Player");
1413 $INV->set_items ($self->{container}{$self->{player}{tag}}) 1465 $INV->set_items ($self->{container}{$self->{player}{tag}})
1414 if $tag == $self->{player}{tag}; 1466 } else {
1467 $OPENCONT = $tag;
1468 $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT}));
1469 $INVR->set_items ($self->{container}{$tag});
1470 }
1415 1471
1416 # $self-<{player}{tag} => player inv 1472 # $self-<{player}{tag} => player inv
1417 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}}; 1473 #use PApp::Util; warn PApp::Util::dumpval $self->{container}{$self->{player}{tag}};
1418} 1474}
1419 1475
1420sub conn::container_clear { 1476sub conn::container_clear {
1421 my ($self, $tag) = @_; 1477 my ($self, $tag) = @_;
1422 1478
1423 update_floorbox if $tag == 0; 1479 #d# print "container_clear: container $tag ($self->{player}{tag})\n";
1424 1480
1481 if ($tag == 0) {
1482 update_floorbox;
1483 $OPENCONT = 0;
1484 $INVR_LBL->set_text ("Floor");
1485 $INVR->set_items ($self->{container}{0});
1486 } elsif ($tag == $self->{player}{tag}) {
1487 $INVR_LBL->set_text ("Player");
1425 $INV->set_items ($self->{container}{$tag}) 1488 $INV->set_items ($self->{container}{$tag})
1426 if $tag == $self->{player}{tag}; 1489 } else {
1490 $OPENCONT = $tag;
1491 $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT}));
1492 $INVR->set_items ($self->{container}{$tag});
1493 }
1427 1494
1428# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0}; 1495# use PApp::Util; warn PApp::Util::dumpval $self->{container}{0};
1429} 1496}
1430 1497
1431sub conn::item_delete { 1498sub conn::item_delete {
1432 my ($self, @items) = @_; 1499 my ($self, @items) = @_;
1433 1500
1434 for (@items) { 1501 for (@items) {
1435 update_floorbox if $_->{container} == 0; 1502 #d# print "item_delete: $_->{tag} from $_->{container} ($self->{player}{tag})\n";
1436 1503
1504 if ($_->{container} == 0) {
1505 update_floorbox;
1506 $OPENCONT = 0;
1507 $INVR_LBL->set_text ("Floor");
1508 $INVR->set_items ($self->{container}{0});
1509 } elsif ($_->{container} == $self->{player}{tag}) {
1510 $INVR_LBL->set_text ("Player");
1511 $INV->set_items ($self->{container}{$self->{player}{tag}})
1512 } else {
1513 $OPENCONT = $_->{container};
1514 $INVR_LBL->set_text (CFClient::UI::InventoryItem::_item_to_desc ($self->{item}->{$OPENCONT}));
1437 $INV->set_items ($self->{container}{$_->{container}}) 1515 $INVR->set_items ($self->{container}{$_->{container}});
1438 if $_->{container} == $self->{player}{tag}; 1516 }
1439 } 1517 }
1440} 1518}
1441 1519
1442sub conn::item_update { 1520sub conn::item_update {
1443 my ($self, $item) = @_; 1521 my ($self, $item) = @_;
1444 1522
1445 update_floorbox if $item->{container} == 0; 1523 #d# print "item_update: $item->{tag} in $item->{container} ($self->{player}{tag}) ($OPENCONT)\n";
1446 1524
1525 if ($item->{tag} == $OPENCONT && not ($item->{flags} & Crossfire::Protocol::F_OPEN)) {
1526 $OPENCONT = 0;
1527 $INVR_LBL->set_text ("Floor");
1528 $INVR->set_items ($self->{container}{0});
1529
1530 $item->{widget}->update_item
1531 if $item->{widget};
1532 } else {
1533 if ($item->{container} == 0) {
1534 update_floorbox;
1535 $OPENCONT = 0;
1536 $INVR_LBL->set_text ("Floor");
1537 $INVR->set_items ($self->{container}{0});
1538 } elsif ($item->{container} == $self->{player}{tag}) {
1447 $INV->set_items ($self->{container}{$item->{container}}) 1539 $INV->set_items ($self->{container}{$item->{container}})
1448 if $item->{container} == $self->{player}{tag}; 1540 }
1541 }
1449} 1542}
1450 1543
1451%SDL_CB = ( 1544%SDL_CB = (
1452 CFClient::SDL_QUIT => sub { 1545 CFClient::SDL_QUIT => sub {
1453 Event::unloop -1; 1546 Event::unloop -1;
1552 $FONT_FIXED = new_from_file CFClient::Font $fonts[1]; 1645 $FONT_FIXED = new_from_file CFClient::Font $fonts[1];
1553 1646
1554 $FONT_PROP->make_default; 1647 $FONT_PROP->make_default;
1555 } 1648 }
1556 1649
1650# compare mono (ft) vs. rgba (cairo)
1651# ft - 1.8s, cairo 3s, even in alpha-only mode
1652# for my $rgba (0..1) {
1653# my $t1 = Time::HiRes::time;
1654# for (1..1000) {
1655# my $layout = CFClient::Layout->new ($rgba);
1656# $layout->set_text ("hallo" x 100);
1657# $layout->render;
1658# }
1659# my $t2 = Time::HiRes::time;
1660# warn $t2-$t1;
1661# }
1662
1557 video_init; 1663 video_init;
1558 audio_init; 1664 audio_init;
1559} 1665}
1560 1666
1561Event::loop; 1667Event::loop;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines