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

Comparing deliantra/Deliantra-Client/bin/deliantra (file contents):
Revision 1.28 by root, Thu Mar 20 22:28:35 2008 UTC vs.
Revision 1.32 by root, Tue Mar 25 19:28:56 2008 UTC

190our $SDL_ACTIVE; 190our $SDL_ACTIVE;
191our %SDL_CB; 191our %SDL_CB;
192 192
193our $ALT_ENTER_MESSAGE; 193our $ALT_ENTER_MESSAGE;
194our $STATUSBOX; 194our $STATUSBOX;
195our $MODBOX;
195our $DEBUG_STATUS; 196our $DEBUG_STATUS;
196 197
197our $INV; 198our $INV;
198our $INVR; 199our $INVR;
199our $INVR_HB; 200our $INVR_HB;
208 $DEBUG_STATUS->set_text ($_[0]); 209 $DEBUG_STATUS->set_text ($_[0]);
209} 210}
210 211
211sub message { 212sub message {
212 $MESSAGE_DIST->message (@_); 213 $MESSAGE_DIST->message (@_);
214}
215
216sub update_modbox {
217 my $mod = DC::SDL_GetModState;
218
219 my $markup;
220
221 $markup .= $mod & DC::KMOD_CTRL
222 ? ($MAPWIDGET->{ctrl} ? "[REPEAT]" : "[<span foreground='#888'>REPEAT</span>]")
223 : "[<span foreground='#888'> once </span>]";
224
225 $markup .= $mod & DC::KMOD_SHIFT
226 ? ($MAPWIDGET->{shft} ? "[FIRE]" : "[<span foreground='#888'>FIRE</span>]")
227 : "[<span foreground='#888'>move</span>]";
228
229 $markup .= $mod & (DC::KMOD_ALT | DC::KMOD_META)
230 ? "[ALT]"
231 : "[<span foreground='#888'>alt</span>]";
232
233 $markup .= $mod & DC::KMOD_NUM
234 ? "[NUM]"
235 : "[<span foreground='#888'>num</span>]";
236
237 # <tt> around next statement works around some bug that keeps the
238 # "font =>" from being used on windows
239 $MODBOX->set_markup ("<tt>$markup</tt>");
213} 240}
214 241
215############################################################################# 242#############################################################################
216#TODO: maybe move into own audio module... 243#TODO: maybe move into own audio module...
217 244
738 if ($CONN) { 765 if ($CONN) {
739 DC::lowdelay fileno $CONN->{fh}; 766 DC::lowdelay fileno $CONN->{fh};
740 767
741 status "login successful"; 768 status "login successful";
742 } else { 769 } else {
770 warn $@;
743 status "unable to connect"; 771 status "unable to connect";
744 stop_game(); 772 stop_game();
745 } 773 }
746} 774}
747 775
1947 my @path = DC::Pod::full_path_of $node; 1975 my @path = DC::Pod::full_path_of $node;
1948 pop @path; # drop current node 1976 pop @path; # drop current node
1949 1977
1950 for my $node (@path) { 1978 for my $node (@path) {
1951 $buttons->add (new DC::UI::Button 1979 $buttons->add (new DC::UI::Button
1952 text => $node->{kw}[0], 1980 text => $node->[DC::Pod::N_KW][0],
1953 tooltip => "go to <i>" . (DC::asxml DC::Pod::full_path $node) . "</i>", 1981 tooltip => "go to <i>" . (DC::asxml DC::Pod::full_path $node) . "</i>",
1954 on_activate => sub { 1982 on_activate => sub {
1955 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = (); 1983 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1956 $load_node->($node); 1984 $load_node->($node);
1957 }, 1985 },
1958 ); 1986 );
1959 $buttons->add (new DC::UI::Label text => "/"); 1987 $buttons->add (new DC::UI::Label text => "/");
1960 } 1988 }
1961 1989
1962 $buttons->add (new DC::UI::Label text => $node->{kw}[0], padding_x => 4, padding_y => 4); 1990 $buttons->add (new DC::UI::Label text => $node->[DC::Pod::N_KW][0], padding_x => 4, padding_y => 4);
1963 1991
1964 $curnode = $node; 1992 $curnode = $node;
1965 1993
1966 $viewer->clear; 1994 $viewer->clear;
1967 $viewer->add_paragraph (DC::Pod::as_paragraphs DC::Pod::section_of $curnode); 1995 $viewer->add_paragraph (DC::Pod::as_paragraphs DC::Pod::section_of $curnode);
2146 force_x => "max", 2174 force_x => "max",
2147 force_y => 0; 2175 force_y => 0;
2148 $DEBUG_STATUS->show; 2176 $DEBUG_STATUS->show;
2149 2177
2150 $STATUSBOX = new DC::UI::Statusbox; 2178 $STATUSBOX = new DC::UI::Statusbox;
2151 $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", timeout => 864000, pri => -100, color => [1, 1, 1, 0.8]); 2179
2180 $MODBOX = new DC::UI::Label
2181 can_events => 1,
2182 can_hover => 1,
2183 markup => "",
2184 align => 0,
2185 font => $FONT_FIXED,
2186 tooltip => "#modifier_box",
2187 tooltip_width => 0.67,
2188 ;
2189
2190 update_modbox;
2152 2191
2153 (new DC::UI::Frame 2192 (new DC::UI::Frame
2154 bg => [0, 0, 0, 0.4], 2193 bg => [0, 0, 0, 0.4],
2155 force_x => 0, 2194 force_x => 0,
2156 force_y => "max", 2195 force_y => "max",
2157 child => $STATUSBOX, 2196 child => (my $LR = new DC::UI::VBox),
2158 )->show; 2197 )->show;
2198
2199 $LR->add ($STATUSBOX);
2200 $LR->add ($MODBOX);
2201 $LR->add (new DC::UI::Label
2202 align => 0,
2203 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode",
2204 fontsize => 0.5,
2205 fg => [1, 1, 0, 0.7],
2206 );
2159 2207
2160 DC::UI::Toplevel->new ( 2208 DC::UI::Toplevel->new (
2161 title => "Minimap", 2209 title => "Minimap",
2162 name => "mapmap", 2210 name => "mapmap",
2163 x => 0, 2211 x => 0,
2345 # alt-enter 2393 # alt-enter
2346 $FULLSCREEN_ENABLE->toggle; 2394 $FULLSCREEN_ENABLE->toggle;
2347 video_shutdown; 2395 video_shutdown;
2348 video_init; 2396 video_init;
2349 } else { 2397 } else {
2350 DC::UI::feed_sdl_key_down_event ($_[0]); 2398 &DC::UI::feed_sdl_key_down_event;
2351 } 2399 }
2400 update_modbox;
2352 }, 2401 },
2353 DC::SDL_KEYUP => \&DC::UI::feed_sdl_key_up_event, 2402 DC::SDL_KEYUP => sub {
2403 &DC::UI::feed_sdl_key_up_event;
2404 update_modbox;
2405 },
2354 DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, 2406 DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event,
2355 DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, 2407 DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event,
2356 DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, 2408 DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event,
2357 DC::SDL_USEREVENT => sub { 2409 DC::SDL_USEREVENT => sub {
2358 if ($_[0]{code} == 1) { 2410 if ($_[0]{code} == 1) {
2457 DejaVuSansMono-BoldOblique.ttf 2509 DejaVuSansMono-BoldOblique.ttf
2458 ); 2510 );
2459 2511
2460 DC::add_font $_ for @fonts; 2512 DC::add_font $_ for @fonts;
2461 2513
2462 DC::pango_init;
2463
2464 $FONT_PROP = new_from_file DC::Font $fonts[0]; 2514 $FONT_PROP = new_from_file DC::Font $fonts[0];
2465 $FONT_FIXED = new_from_file DC::Font $fonts[1]; 2515 $FONT_FIXED = new_from_file DC::Font $fonts[1];
2466 2516
2467 $FONT_PROP->make_default; 2517 $FONT_PROP->make_default;
2518
2519 DC::pango_init;
2468 } 2520 }
2469 2521
2470# compare mono (ft) vs. rgba (cairo) 2522# compare mono (ft) vs. rgba (cairo)
2471# ft - 1.8s, cairo 3s, even in alpha-only mode 2523# ft - 1.8s, cairo 3s, even in alpha-only mode
2472# for my $rgba (0..1) { 2524# for my $rgba (0..1) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines