… | |
… | |
190 | our $SDL_ACTIVE; |
190 | our $SDL_ACTIVE; |
191 | our %SDL_CB; |
191 | our %SDL_CB; |
192 | |
192 | |
193 | our $ALT_ENTER_MESSAGE; |
193 | our $ALT_ENTER_MESSAGE; |
194 | our $STATUSBOX; |
194 | our $STATUSBOX; |
|
|
195 | our $MODBOX; |
195 | our $DEBUG_STATUS; |
196 | our $DEBUG_STATUS; |
196 | |
197 | |
197 | our $INV; |
198 | our $INV; |
198 | our $INVR; |
199 | our $INVR; |
199 | our $INVR_HB; |
200 | our $INVR_HB; |
… | |
… | |
208 | $DEBUG_STATUS->set_text ($_[0]); |
209 | $DEBUG_STATUS->set_text ($_[0]); |
209 | } |
210 | } |
210 | |
211 | |
211 | sub message { |
212 | sub message { |
212 | $MESSAGE_DIST->message (@_); |
213 | $MESSAGE_DIST->message (@_); |
|
|
214 | } |
|
|
215 | |
|
|
216 | sub 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 | |
… | |
… | |
1528 | |
1556 | |
1529 | $vbox->add ( |
1557 | $vbox->add ( |
1530 | $HOST_ENTRY = new DC::UI::Entry |
1558 | $HOST_ENTRY = new DC::UI::Entry |
1531 | expand => 1, |
1559 | expand => 1, |
1532 | text => $CFG->{profile}{default}{host}, |
1560 | text => $CFG->{profile}{default}{host}, |
1533 | tooltip => "The hostname or ip address of the Deliantra server to connect to", |
1561 | tooltip => "The hostname or ip address of the Deliantra server to connect to (e.g. <b>gameserver.deliantra.net</b>)", |
1534 | on_changed => sub { |
1562 | on_changed => sub { |
1535 | my ($self, $value) = @_; |
1563 | my ($self, $value) = @_; |
1536 | $CFG->{profile}{default}{host} = $value; |
1564 | $CFG->{profile}{default}{host} = $value; |
1537 | 1 |
1565 | 1 |
1538 | } |
1566 | } |
… | |
… | |
1541 | if (0) { #d# disabled |
1569 | if (0) { #d# disabled |
1542 | $vbox->add (new DC::UI::Button |
1570 | $vbox->add (new DC::UI::Button |
1543 | expand => 1, |
1571 | expand => 1, |
1544 | text => "Server List", |
1572 | text => "Server List", |
1545 | other => $METASERVER, |
1573 | other => $METASERVER, |
1546 | tooltip => "Show a list of available crossfire servers", |
1574 | tooltip => "Show a list of available Deliantra servers", |
1547 | on_activate => sub { $METASERVER->toggle_visibility; 0 }, |
1575 | on_activate => sub { $METASERVER->toggle_visibility; 0 }, |
1548 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, |
1576 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, |
1549 | ); |
1577 | ); |
1550 | }#d# |
1578 | }#d# |
1551 | } |
1579 | } |
… | |
… | |
1601 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1629 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1602 | . "sends more messages than this number, older messages get removed to save memory and " |
1630 | . "sends more messages than this number, older messages get removed to save memory and " |
1603 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1631 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1604 | on_changed => sub { |
1632 | on_changed => sub { |
1605 | my ($self, $value) = @_; |
1633 | my ($self, $value) = @_; |
1606 | $MESSAGE_DIST->set_max_para ($CFG->{logview_max_par} = $value*1); |
1634 | $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); |
1607 | 0 |
1635 | 0 |
1608 | }, |
1636 | }, |
1609 | ); |
1637 | ); |
1610 | |
1638 | |
1611 | $table |
1639 | $table |
… | |
… | |
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) { |
… | |
… | |
2374 | if (-e "$Deliantra::VARDIR/client.cf") { |
2426 | if (-e "$Deliantra::VARDIR/client.cf") { |
2375 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2427 | DC::read_cfg "$Deliantra::VARDIR/client.cf"; |
2376 | } else { |
2428 | } else { |
2377 | #TODO: compatibility cruft |
2429 | #TODO: compatibility cruft |
2378 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2430 | DC::read_cfg "$Deliantra::OLDDIR/cfplusrc"; |
2379 | print STDERR "INFO: used old configuratrion file\n"; |
2431 | print STDERR "INFO: used old configuration file\n"; |
2380 | } |
2432 | } |
2381 | |
2433 | |
2382 | DC::DB::Server::run; |
2434 | DC::DB::Server::run; |
2383 | |
2435 | |
2384 | DC::UI::set_layout ($::CFG->{layout}); |
2436 | DC::UI::set_layout ($::CFG->{layout}); |
… | |
… | |
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) { |