--- deliantra/Deliantra-Client/bin/deliantra 2008/01/06 17:40:45 1.25 +++ deliantra/Deliantra-Client/bin/deliantra 2008/03/25 19:28:56 1.32 @@ -192,6 +192,7 @@ our $ALT_ENTER_MESSAGE; our $STATUSBOX; +our $MODBOX; our $DEBUG_STATUS; our $INV; @@ -212,6 +213,32 @@ $MESSAGE_DIST->message (@_); } +sub update_modbox { + my $mod = DC::SDL_GetModState; + + my $markup; + + $markup .= $mod & DC::KMOD_CTRL + ? ($MAPWIDGET->{ctrl} ? "[REPEAT]" : "[REPEAT]") + : "[ once ]"; + + $markup .= $mod & DC::KMOD_SHIFT + ? ($MAPWIDGET->{shft} ? "[FIRE]" : "[FIRE]") + : "[move]"; + + $markup .= $mod & (DC::KMOD_ALT | DC::KMOD_META) + ? "[ALT]" + : "[alt]"; + + $markup .= $mod & DC::KMOD_NUM + ? "[NUM]" + : "[num]"; + + # around next statement works around some bug that keeps the + # "font =>" from being used on windows + $MODBOX->set_markup ("$markup"); +} + ############################################################################# #TODO: maybe move into own audio module... @@ -722,7 +749,7 @@ mapw => $mapsize, maph => $mapsize, - client => "cfplus $DC::VERSION $] $^O", + client => "$DC::VERSION $] $^O", map_widget => $MAPWIDGET, statusbox => $STATUSBOX, @@ -740,6 +767,7 @@ status "login successful"; } else { + warn $@; status "unable to connect"; stop_game(); } @@ -1530,7 +1558,7 @@ $HOST_ENTRY = new DC::UI::Entry expand => 1, text => $CFG->{profile}{default}{host}, - tooltip => "The hostname or ip address of the Deliantra server to connect to", + tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. gameserver.deliantra.net)", on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{host} = $value; @@ -1543,7 +1571,7 @@ expand => 1, text => "Server List", other => $METASERVER, - tooltip => "Show a list of available crossfire servers", + tooltip => "Show a list of available Deliantra servers", on_activate => sub { $METASERVER->toggle_visibility; 0 }, on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, ); @@ -1603,7 +1631,7 @@ . "computing time. A value of 0 disables this feature, but that is not recommended.", on_changed => sub { my ($self, $value) = @_; - $MESSAGE_DIST->set_max_para ($CFG->{logview_max_par} = $value*1); + $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); 0 }, ); @@ -1949,7 +1977,7 @@ for my $node (@path) { $buttons->add (new DC::UI::Button - text => $node->{kw}[0], + text => $node->[DC::Pod::N_KW][0], tooltip => "go to " . (DC::asxml DC::Pod::full_path $node) . "", on_activate => sub { push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = (); @@ -1959,7 +1987,7 @@ $buttons->add (new DC::UI::Label text => "/"); } - $buttons->add (new DC::UI::Label text => $node->{kw}[0], padding_x => 4, padding_y => 4); + $buttons->add (new DC::UI::Label text => $node->[DC::Pod::N_KW][0], padding_x => 4, padding_y => 4); $curnode = $node; @@ -2148,15 +2176,35 @@ $DEBUG_STATUS->show; $STATUSBOX = new DC::UI::Statusbox; - $STATUSBOX->add ("Use Alt-Enter to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); + + $MODBOX = new DC::UI::Label + can_events => 1, + can_hover => 1, + markup => "", + align => 0, + font => $FONT_FIXED, + tooltip => "#modifier_box", + tooltip_width => 0.67, + ; + + update_modbox; (new DC::UI::Frame bg => [0, 0, 0, 0.4], force_x => 0, force_y => "max", - child => $STATUSBOX, + child => (my $LR = new DC::UI::VBox), )->show; + $LR->add ($STATUSBOX); + $LR->add ($MODBOX); + $LR->add (new DC::UI::Label + align => 0, + markup => "Use Alt-Enter to toggle fullscreen mode", + fontsize => 0.5, + fg => [1, 1, 0, 0.7], + ); + DC::UI::Toplevel->new ( title => "Minimap", name => "mapmap", @@ -2347,10 +2395,14 @@ video_shutdown; video_init; } else { - DC::UI::feed_sdl_key_down_event ($_[0]); + &DC::UI::feed_sdl_key_down_event; } + update_modbox; + }, + DC::SDL_KEYUP => sub { + &DC::UI::feed_sdl_key_up_event; + update_modbox; }, - DC::SDL_KEYUP => \&DC::UI::feed_sdl_key_up_event, DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, @@ -2376,7 +2428,7 @@ } else { #TODO: compatibility cruft DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; - print STDERR "INFO: used old configuratrion file\n"; + print STDERR "INFO: used old configuration file\n"; } DC::DB::Server::run; @@ -2459,12 +2511,12 @@ DC::add_font $_ for @fonts; - DC::pango_init; - $FONT_PROP = new_from_file DC::Font $fonts[0]; $FONT_FIXED = new_from_file DC::Font $fonts[1]; $FONT_PROP->make_default; + + DC::pango_init; } # compare mono (ft) vs. rgba (cairo)