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.31 by root, Tue Mar 25 02:12:35 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
1947 my @path = DC::Pod::full_path_of $node; 1974 my @path = DC::Pod::full_path_of $node;
1948 pop @path; # drop current node 1975 pop @path; # drop current node
1949 1976
1950 for my $node (@path) { 1977 for my $node (@path) {
1951 $buttons->add (new DC::UI::Button 1978 $buttons->add (new DC::UI::Button
1952 text => $node->{kw}[0], 1979 text => $node->[DC::Pod::N_KW][0],
1953 tooltip => "go to <i>" . (DC::asxml DC::Pod::full_path $node) . "</i>", 1980 tooltip => "go to <i>" . (DC::asxml DC::Pod::full_path $node) . "</i>",
1954 on_activate => sub { 1981 on_activate => sub {
1955 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = (); 1982 push @history, [$curnode, $viewer->current_paragraph] if $curnode; @future = ();
1956 $load_node->($node); 1983 $load_node->($node);
1957 }, 1984 },
1958 ); 1985 );
1959 $buttons->add (new DC::UI::Label text => "/"); 1986 $buttons->add (new DC::UI::Label text => "/");
1960 } 1987 }
1961 1988
1962 $buttons->add (new DC::UI::Label text => $node->{kw}[0], padding_x => 4, padding_y => 4); 1989 $buttons->add (new DC::UI::Label text => $node->[DC::Pod::N_KW][0], padding_x => 4, padding_y => 4);
1963 1990
1964 $curnode = $node; 1991 $curnode = $node;
1965 1992
1966 $viewer->clear; 1993 $viewer->clear;
1967 $viewer->add_paragraph (DC::Pod::as_paragraphs DC::Pod::section_of $curnode); 1994 $viewer->add_paragraph (DC::Pod::as_paragraphs DC::Pod::section_of $curnode);
2146 force_x => "max", 2173 force_x => "max",
2147 force_y => 0; 2174 force_y => 0;
2148 $DEBUG_STATUS->show; 2175 $DEBUG_STATUS->show;
2149 2176
2150 $STATUSBOX = new DC::UI::Statusbox; 2177 $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]); 2178
2179 $MODBOX = new DC::UI::Label
2180 can_events => 1,
2181 can_hover => 1,
2182 markup => "",
2183 align => 0,
2184 font => $FONT_FIXED,
2185 tooltip => "#modifier_box",
2186 tooltip_width => 0.67,
2187 ;
2188
2189 update_modbox;
2152 2190
2153 (new DC::UI::Frame 2191 (new DC::UI::Frame
2154 bg => [0, 0, 0, 0.4], 2192 bg => [0, 0, 0, 0.4],
2155 force_x => 0, 2193 force_x => 0,
2156 force_y => "max", 2194 force_y => "max",
2157 child => $STATUSBOX, 2195 child => (my $LR = new DC::UI::VBox),
2158 )->show; 2196 )->show;
2197
2198 $LR->add ($STATUSBOX);
2199 $LR->add ($MODBOX);
2200 $LR->add (new DC::UI::Label
2201 align => 0,
2202 markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode",
2203 fontsize => 0.5,
2204 fg => [1, 1, 0, 0.7],
2205 );
2159 2206
2160 DC::UI::Toplevel->new ( 2207 DC::UI::Toplevel->new (
2161 title => "Minimap", 2208 title => "Minimap",
2162 name => "mapmap", 2209 name => "mapmap",
2163 x => 0, 2210 x => 0,
2345 # alt-enter 2392 # alt-enter
2346 $FULLSCREEN_ENABLE->toggle; 2393 $FULLSCREEN_ENABLE->toggle;
2347 video_shutdown; 2394 video_shutdown;
2348 video_init; 2395 video_init;
2349 } else { 2396 } else {
2350 DC::UI::feed_sdl_key_down_event ($_[0]); 2397 &DC::UI::feed_sdl_key_down_event;
2351 } 2398 }
2399 update_modbox;
2352 }, 2400 },
2353 DC::SDL_KEYUP => \&DC::UI::feed_sdl_key_up_event, 2401 DC::SDL_KEYUP => sub {
2402 &DC::UI::feed_sdl_key_up_event;
2403 update_modbox;
2404 },
2354 DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event, 2405 DC::SDL_MOUSEMOTION => \&DC::UI::feed_sdl_motion_event,
2355 DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event, 2406 DC::SDL_MOUSEBUTTONDOWN => \&DC::UI::feed_sdl_button_down_event,
2356 DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event, 2407 DC::SDL_MOUSEBUTTONUP => \&DC::UI::feed_sdl_button_up_event,
2357 DC::SDL_USEREVENT => sub { 2408 DC::SDL_USEREVENT => sub {
2358 if ($_[0]{code} == 1) { 2409 if ($_[0]{code} == 1) {
2457 DejaVuSansMono-BoldOblique.ttf 2508 DejaVuSansMono-BoldOblique.ttf
2458 ); 2509 );
2459 2510
2460 DC::add_font $_ for @fonts; 2511 DC::add_font $_ for @fonts;
2461 2512
2462 DC::pango_init;
2463
2464 $FONT_PROP = new_from_file DC::Font $fonts[0]; 2513 $FONT_PROP = new_from_file DC::Font $fonts[0];
2465 $FONT_FIXED = new_from_file DC::Font $fonts[1]; 2514 $FONT_FIXED = new_from_file DC::Font $fonts[1];
2466 2515
2467 $FONT_PROP->make_default; 2516 $FONT_PROP->make_default;
2517
2518 DC::pango_init;
2468 } 2519 }
2469 2520
2470# compare mono (ft) vs. rgba (cairo) 2521# compare mono (ft) vs. rgba (cairo)
2471# ft - 1.8s, cairo 3s, even in alpha-only mode 2522# ft - 1.8s, cairo 3s, even in alpha-only mode
2472# for my $rgba (0..1) { 2523# for my $rgba (0..1) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines