… | |
… | |
34 | use Crossfire::Protocol; |
34 | use Crossfire::Protocol; |
35 | |
35 | |
36 | use Compress::LZF; |
36 | use Compress::LZF; |
37 | |
37 | |
38 | use CFClient; |
38 | use CFClient; |
|
|
39 | use CFClient::OpenGL (); |
39 | use CFClient::UI; |
40 | use CFClient::UI; |
40 | use CFClient::MapWidget; |
41 | use CFClient::MapWidget; |
41 | |
42 | |
42 | $Event::DIED = sub { |
43 | $Event::DIED = sub { |
43 | # TODO: display dialog box or so |
44 | # TODO: display dialog box or so |
… | |
… | |
966 | or die "SDL_SetVideoMode failed: " . (CFClient::SDL_GetError) . "\n"; |
967 | or die "SDL_SetVideoMode failed: " . (CFClient::SDL_GetError) . "\n"; |
967 | |
968 | |
968 | $SDL_ACTIVE = 1; |
969 | $SDL_ACTIVE = 1; |
969 | $LAST_REFRESH = time - 0.01; |
970 | $LAST_REFRESH = time - 0.01; |
970 | |
971 | |
971 | CFClient::gl_init; |
972 | CFClient::OpenGL::init; |
972 | |
973 | |
973 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
974 | $FONTSIZE = int $HEIGHT / 40 * $CFG->{gui_fontsize}; |
974 | |
975 | |
975 | $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# |
976 | $CFClient::UI::ROOT->configure (0, 0, $WIDTH, $HEIGHT);#d# |
976 | |
977 | |
… | |
… | |
1257 | $MAPWIDGET->clr_commands; |
1258 | $MAPWIDGET->clr_commands; |
1258 | |
1259 | |
1259 | my $parser = new Pod::POM; |
1260 | my $parser = new Pod::POM; |
1260 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod"); |
1261 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/command_help.pod"); |
1261 | |
1262 | |
1262 | for my $head2 ($pod->head2) { |
1263 | for my $head2 ($pod->head1->[-2]->head2) { |
1263 | $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
1264 | $head2->title =~ /^(\S+) (?:\s+ \( ([^\)]*) \) )?/x |
1264 | or next; |
1265 | or next; |
1265 | |
1266 | |
1266 | my $cmd = $1; |
1267 | my $cmd = $1; |
1267 | my @args = split /\|/, $2; |
1268 | my @args = split /\|/, $2; |
… | |
… | |
1687 | my $parser = new Pod::POM; |
1688 | my $parser = new Pod::POM; |
1688 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); |
1689 | my $pod = $parser->parse_file (CFClient::find_rcfile "pod/skill_help.pod"); |
1689 | |
1690 | |
1690 | my %skill_tooltip; |
1691 | my %skill_tooltip; |
1691 | |
1692 | |
1692 | for my $head2 ($pod->head2) { |
1693 | for my $head2 ($pod->head1->[-2]->head2) { |
1693 | $skill_tooltip{$head2->title} = CFClient::pod_to_pango $head2->content; |
1694 | $skill_tooltip{$head2->title} = CFClient::pod_to_pango $head2->content; |
1694 | } |
1695 | } |
1695 | |
1696 | |
1696 | for my $skill (values %{$self->{skill_info}}) { |
1697 | for my $skill (values %{$self->{skill_info}}) { |
1697 | $MAPWIDGET->add_command ("ready_skill $skill", |
1698 | $MAPWIDGET->add_command ("ready_skill $skill", |
… | |
… | |
1755 | sub update_floorbox { |
1756 | sub update_floorbox { |
1756 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1757 | $CFClient::UI::ROOT->on_refresh ($FLOORBOX => sub { |
1757 | return unless $CONN; |
1758 | return unless $CONN; |
1758 | |
1759 | |
1759 | $FLOORBOX->clear; |
1760 | $FLOORBOX->clear; |
1760 | $FLOORBOX->add (0, 1, new CFClient::UI::Empty expand => 1); |
|
|
1761 | |
1761 | |
1762 | my $row; |
1762 | my $row; |
1763 | for (@{ $CONN->{container}{0} }) { |
1763 | for (@{ $CONN->{container}{0} }) { |
1764 | if (++$row < 7) { |
1764 | if ($row < 7) { |
1765 | local $_->{face_widget}; # hack to force recreation of widget |
1765 | local $_->{face_widget}; # hack to force recreation of widget |
1766 | local $_->{desc_widget}; # hack to force recreation of widget |
1766 | local $_->{desc_widget}; # hack to force recreation of widget |
1767 | CFClient::Item::update_widgets $_; |
1767 | CFClient::Item::update_widgets $_; |
1768 | |
1768 | |
1769 | $FLOORBOX->add (0, $row, $_->{face_widget}); |
1769 | $FLOORBOX->add (0, $row, $_->{face_widget}); |
1770 | $FLOORBOX->add (1, $row, $_->{desc_widget}); |
1770 | $FLOORBOX->add (1, $row, $_->{desc_widget}); |
|
|
1771 | |
|
|
1772 | $row++; |
1771 | } else { |
1773 | } else { |
1772 | $FLOORBOX->add (new CFClient::UI::Label text => "More..."); |
1774 | $FLOORBOX->add (1, $row, new CFClient::UI::Label text => "More..."); |
1773 | last; |
1775 | last; |
1774 | } |
1776 | } |
1775 | } |
1777 | } |
1776 | }); |
1778 | }); |
1777 | |
1779 | |