… | |
… | |
166 | |
166 | |
167 | our $MAP; |
167 | our $MAP; |
168 | our $MAPMAP; |
168 | our $MAPMAP; |
169 | our $MAPWIDGET; |
169 | our $MAPWIDGET; |
170 | our $COMPLETER; |
170 | our $COMPLETER; |
171 | our $BUTTONBAR; |
171 | our $MENUFRAME; # the rectangle at the top |
|
|
172 | our $MENUBAR; # the hbox at the top |
|
|
173 | our $MENUPOPUP; |
|
|
174 | our $BUTTONBAR; # the menu buttons |
172 | our $METASERVER; |
175 | our $METASERVER; |
173 | our $LOGIN_BUTTON; |
176 | our $LOGIN_BUTTON; |
174 | our $QUIT_DIALOG; |
177 | our $QUIT_DIALOG; |
175 | our $HOST_ENTRY; |
178 | our $HOST_ENTRY; |
176 | our $FULLSCREEN_ENABLE; |
179 | our $FULLSCREEN_ENABLE; |
… | |
… | |
343 | or return; |
346 | or return; |
344 | |
347 | |
345 | $meta->{data} |
348 | $meta->{data} |
346 | or return; |
349 | or return; |
347 | |
350 | |
348 | # if its a jingle, play it as ambient music |
351 | # if it's a jingle, play it as ambient music |
349 | if ($meta->{data}{jingle}) { |
352 | if ($meta->{data}{jingle}) { |
350 | if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue |
353 | if (delete $AUDIO_PLAY{$face}) { # take the jingle out of the sound queue |
351 | push @MUSIC_JINGLE, $meta; # push it oto the music/jingle queue |
354 | push @MUSIC_JINGLE, $meta; # push it unto the music/jingle queue |
352 | &audio_music_push ($face); |
355 | &audio_music_push ($face); |
353 | } |
356 | } |
354 | } else { |
357 | } else { |
355 | # fetch from database |
358 | # fetch from database |
356 | DC::DB::get res_data => $meta->{name}, sub { |
359 | DC::DB::get res_data => $meta->{name}, sub { |
357 | my $rwops = new DC::RW $_[0]; |
360 | my $rwops = new DC::RW $_[0]; |
358 | my $chunk = new DC::MixChunk $rwops |
361 | my $chunk = new DC::MixChunk $rwops |
359 | or Carp::confess "sound face " . (JSON::XS::encode_json $meta) . " unloadable: " . DC::Mix_GetError; |
362 | or Carp::confess "sound face " . (JSON::XS::encode_json $meta) . " (" . (unpack "H64", $_[0]) . ") unloadable: " . DC::Mix_GetError; |
360 | $chunk->volume (($meta->{data}{volume} || 1) * 128); |
363 | $chunk->volume (($meta->{data}{volume} || 1) * 128); |
361 | $AUDIO_CHUNK{$face} = $chunk; |
364 | $AUDIO_CHUNK{$face} = $chunk; |
362 | |
365 | |
363 | audio_sound_push ($face); |
366 | audio_sound_push ($face); |
364 | }; |
367 | }; |
… | |
… | |
411 | |
414 | |
412 | audio_music_update_volume; |
415 | audio_music_update_volume; |
413 | |
416 | |
414 | $MUSIC_PLAYING_DATA = \$_[0]; |
417 | $MUSIC_PLAYING_DATA = \$_[0]; |
415 | |
418 | |
|
|
419 | $meta->{path} or length $_[0] |
|
|
420 | or return clienterror "empty music face from res_data ($meta->{face})";#d# |
|
|
421 | |
416 | my $rwops = $meta->{path} |
422 | my $rwops = $meta->{path} |
417 | ? new_from_file DC::RW $meta->{path} |
423 | ? (new_from_file DC::RW $meta->{path} or return clienterror "unable to load music face $meta->{path}: $!")#d#clienterror |
418 | : new DC::RW $$MUSIC_PLAYING_DATA; |
424 | : new DC::RW $$MUSIC_PLAYING_DATA; |
419 | |
425 | |
420 | $MUSIC_PLAYER = new DC::MixMusic $rwops |
426 | $MUSIC_PLAYER = new DC::MixMusic $rwops |
421 | or return clienterror "music face $meta->{face} unloadable: " . DC::Mix_GetError => 1; |
427 | or return clienterror "music face $meta->{face} unloadable: " . DC::Mix_GetError => 1; |
422 | |
428 | |
… | |
… | |
915 | |
921 | |
916 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Video Mode"); |
922 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Video Mode"); |
917 | $table->add_at (1, $row++, my $hbox = new DC::UI::HBox); |
923 | $table->add_at (1, $row++, my $hbox = new DC::UI::HBox); |
918 | |
924 | |
919 | $hbox->add ($MODE_SLIDER = new DC::UI::Slider |
925 | $hbox->add ($MODE_SLIDER = new DC::UI::Slider |
|
|
926 | c_rescale => 1, |
920 | force_w => $WIDTH * 0.1, expand => 1, |
927 | force_w => $WIDTH * 0.1, expand => 1, |
921 | range => [ ($CFG->{sdl_mode}) x 3 ], |
928 | range => [ ($CFG->{sdl_mode}) x 3 ], |
922 | tooltip => $vidmode_tooltip); |
929 | tooltip => $vidmode_tooltip); |
923 | $hbox->add (my $mode_label = new DC::UI::Label |
930 | $hbox->add (my $mode_label = new DC::UI::Label |
924 | height => 0.8, template => "9999x9999@9+9", |
931 | height => 0.8, template => "9999x9999@9+9", |
… | |
… | |
1248 | } |
1255 | } |
1249 | |
1256 | |
1250 | sub make_gauge_window { |
1257 | sub make_gauge_window { |
1251 | my $gh = int $HEIGHT * $CFG->{gauge_size}; |
1258 | my $gh = int $HEIGHT * $CFG->{gauge_size}; |
1252 | |
1259 | |
1253 | my $win = new DC::UI::Frame ( |
1260 | $GAUGES->{win} = my $win = new DC::UI::Frame ( |
1254 | force_x => 0, |
1261 | force_x => 0, |
1255 | force_y => "max", |
1262 | force_y => "max", |
1256 | force_w => $WIDTH, |
1263 | force_w => $WIDTH, |
1257 | force_h => $gh, |
1264 | force_h => $gh, |
1258 | ); |
1265 | ); |
… | |
… | |
1274 | (new DC::UI::Empty expand => 1), |
1281 | (new DC::UI::Empty expand => 1), |
1275 | (my $hb = new DC::UI::HBox), |
1282 | (my $hb = new DC::UI::HBox), |
1276 | ], |
1283 | ], |
1277 | ); |
1284 | ); |
1278 | |
1285 | |
1279 | $hb->add (my $hg = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health"); |
1286 | $hb->add ($GAUGES->{hp} = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health"); |
1280 | $hb->add (my $mg = new DC::UI::Gauge type => 'mana', tooltip => "#stat_mana"); |
1287 | $hb->add ($GAUGES->{mana} = new DC::UI::Gauge type => 'mana', tooltip => "#stat_mana"); |
1281 | $hb->add (my $gg = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace"); |
1288 | $hb->add ($GAUGES->{grace} = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace"); |
1282 | $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food"); |
1289 | $hb->add ($GAUGES->{food} = new DC::UI::Gauge type => 'food', tooltip => "#stat_food"); |
1283 | |
|
|
1284 | $vbox->add (my $exp = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); |
|
|
1285 | $vbox->add (my $prg = new DC::UI::ExperienceProgress); |
|
|
1286 | $vbox->add (my $sklprg = new DC::UI::ExperienceProgress); |
|
|
1287 | $vbox->add (my $rng = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); |
|
|
1288 | |
|
|
1289 | $GAUGES = { |
|
|
1290 | exp => $exp, prg => $prg, sklprg => $sklprg, |
|
|
1291 | win => $win, range => $rng, |
|
|
1292 | hp => $hg, mana => $mg, grace => $gg, food => $fg, |
|
|
1293 | }; |
|
|
1294 | |
1290 | |
1295 | &set_gauge_window_fontsize; |
1291 | &set_gauge_window_fontsize; |
1296 | |
1292 | |
1297 | $win |
1293 | $win |
1298 | } |
1294 | } |
… | |
… | |
1752 | |
1748 | |
1753 | my $row = 0; |
1749 | my $row = 0; |
1754 | |
1750 | |
1755 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day"); |
1751 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day"); |
1756 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1752 | $table->add_at (1, $row++, new DC::UI::CheckBox |
|
|
1753 | c_colspan => 2, |
1757 | state => $CFG->{show_tips}, |
1754 | state => $CFG->{show_tips}, |
1758 | tooltip => "Show the <b>Tip of the day</b> window at startup?", |
1755 | tooltip => "Show the <b>Tip of the day</b> window at startup?", |
1759 | on_changed => sub { |
1756 | on_changed => sub { |
1760 | my ($self, $value) = @_; |
1757 | my ($self, $value) = @_; |
1761 | $CFG->{show_tips} = $value; |
1758 | $CFG->{show_tips} = $value; |
… | |
… | |
1763 | } |
1760 | } |
1764 | ); |
1761 | ); |
1765 | |
1762 | |
1766 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size"); |
1763 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size"); |
1767 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
1764 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
|
|
1765 | c_colspan => 2, |
1768 | text => $CFG->{logview_max_par}, |
1766 | text => $CFG->{logview_max_par}, |
1769 | tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server " |
1767 | tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server " |
1770 | . "sends more messages than this number, older messages get removed to save memory and " |
1768 | . "sends more messages than this number, older messages get removed to save memory and " |
1771 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1769 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1772 | on_changed => sub { |
1770 | on_changed => sub { |
1773 | my ($self, $value) = @_; |
1771 | my ($self, $value) = @_; |
1774 | $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); |
1772 | $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); |
1775 | 0 |
1773 | 0 |
1776 | }, |
1774 | }, |
|
|
1775 | ); |
|
|
1776 | |
|
|
1777 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Config Autosave"); |
|
|
1778 | $table->add_at (1, $row, new DC::UI::CheckBox |
|
|
1779 | state => $CFG->{config_autosave}, |
|
|
1780 | tooltip => "Normally, configuration settings and the user interface layout " |
|
|
1781 | . "are saved on client exit. You can disable this behaviour by " |
|
|
1782 | . "unchecking this checkbox.", |
|
|
1783 | on_changed => sub { |
|
|
1784 | my ($self, $value) = @_; |
|
|
1785 | $CFG->{config_autosave} = $value; |
|
|
1786 | 0 |
|
|
1787 | } |
|
|
1788 | ); |
|
|
1789 | $table->add_at (2, $row++, new DC::UI::Button |
|
|
1790 | text => "Save Now", |
|
|
1791 | tooltip => "Use this to manually save configuration and UI layout when " |
|
|
1792 | . "autosave is disabled.", |
|
|
1793 | on_activate => sub { |
|
|
1794 | DC::write_cfg; |
|
|
1795 | 0 |
|
|
1796 | } |
1777 | ); |
1797 | ); |
1778 | |
1798 | |
1779 | $table |
1799 | $table |
1780 | } |
1800 | } |
1781 | |
1801 | |
… | |
… | |
1998 | $PL_NOTEBOOK->set_current_page ($widget); |
2018 | $PL_NOTEBOOK->set_current_page ($widget); |
1999 | $PL_WINDOW->show; |
2019 | $PL_WINDOW->show; |
2000 | } |
2020 | } |
2001 | } |
2021 | } |
2002 | |
2022 | |
2003 | sub player_window { |
2023 | sub make_playerbook { |
2004 | my $plwin = $PL_WINDOW = new DC::UI::Toplevel |
2024 | my $plwin = $PL_WINDOW = new DC::UI::Toplevel |
2005 | x => "center", |
2025 | x => "center", |
2006 | y => "center", |
2026 | y => "center", |
2007 | force_w => $WIDTH * 9/10, |
2027 | force_w => $WIDTH * 9/10, |
2008 | force_h => $HEIGHT * 9/10, |
2028 | force_h => $HEIGHT * 9/10, |
… | |
… | |
2042 | "License, Author and Source info for media sent by the server."); |
2062 | "License, Author and Source info for media sent by the server."); |
2043 | |
2063 | |
2044 | $ntb->set_current_page ($INVENTORY_PAGE); |
2064 | $ntb->set_current_page ($INVENTORY_PAGE); |
2045 | |
2065 | |
2046 | $plwin->add ($ntb); |
2066 | $plwin->add ($ntb); |
2047 | $plwin |
|
|
2048 | } |
2067 | } |
2049 | |
2068 | |
2050 | sub keyboard_setup { |
2069 | sub keyboard_setup { |
2051 | DC::Macro::keyboard_setup |
2070 | DC::Macro::keyboard_setup |
2052 | } |
2071 | } |
… | |
… | |
2149 | $load_node->((DC::Pod::find @path)[0]); |
2168 | $load_node->((DC::Pod::find @path)[0]); |
2150 | $win->show; |
2169 | $win->show; |
2151 | }; |
2170 | }; |
2152 | |
2171 | |
2153 | $win |
2172 | $win |
2154 | } |
|
|
2155 | |
|
|
2156 | sub open_string_query { |
|
|
2157 | my ($title, $cb, $txt, $tooltip) = @_; |
|
|
2158 | my $dialog = new DC::UI::Toplevel |
|
|
2159 | x => "center", |
|
|
2160 | y => "center", |
|
|
2161 | z => 50, |
|
|
2162 | force_w => $WIDTH * 4/5, |
|
|
2163 | title => $title; |
|
|
2164 | |
|
|
2165 | $dialog->add ( |
|
|
2166 | my $e = new DC::UI::Entry |
|
|
2167 | on_activate => sub { $cb->(@_); $dialog->hide; 0 }, |
|
|
2168 | on_key_down => sub { $_[1]->{sym} == 27 and $dialog->hide; 0 }, |
|
|
2169 | tooltip => $tooltip |
|
|
2170 | ); |
|
|
2171 | |
|
|
2172 | $e->grab_focus; |
|
|
2173 | $e->set_text ($txt) if $txt; |
|
|
2174 | $dialog->show; |
|
|
2175 | } |
2173 | } |
2176 | |
2174 | |
2177 | sub open_quit_dialog { |
2175 | sub open_quit_dialog { |
2178 | unless ($QUIT_DIALOG) { |
2176 | unless ($QUIT_DIALOG) { |
2179 | $QUIT_DIALOG = new DC::UI::Toplevel |
2177 | $QUIT_DIALOG = new DC::UI::Toplevel |
… | |
… | |
2212 | |
2210 | |
2213 | $QUIT_DIALOG->show; |
2211 | $QUIT_DIALOG->show; |
2214 | $QUIT_DIALOG->grab_focus; |
2212 | $QUIT_DIALOG->grab_focus; |
2215 | } |
2213 | } |
2216 | |
2214 | |
|
|
2215 | sub make_menuframe { |
|
|
2216 | $MENUFRAME = new DC::UI::Toplevel |
|
|
2217 | border => 0, |
|
|
2218 | force_x => 0, |
|
|
2219 | force_y => 0, |
|
|
2220 | force_w => $::WIDTH, |
|
|
2221 | child => ($MENUBAR = new DC::UI::HBox), |
|
|
2222 | ; |
|
|
2223 | |
|
|
2224 | $MENUBAR->add ($BUTTONBAR = new DC::UI::Buttonbar); |
|
|
2225 | |
|
|
2226 | # XXX: this has to be done before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
|
|
2227 | make_gauge_window->show; |
|
|
2228 | |
|
|
2229 | # $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW, |
|
|
2230 | # tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
|
|
2231 | |
|
|
2232 | make_playerbook; |
|
|
2233 | |
|
|
2234 | $MENUPOPUP = DC::UI::Menu->new (items => [ |
|
|
2235 | ["Setup…" , sub { $SETUP_DIALOG->toggle_visibility}], |
|
|
2236 | ["Playerbook…\tTab", sub { $PL_WINDOW ->toggle_visibility}], |
|
|
2237 | ["Help Browser…" , sub { $HELP_WINDOW ->toggle_visibility}], |
|
|
2238 | ["Quit…" , sub { |
|
|
2239 | if ($CONN) { |
|
|
2240 | open_quit_dialog; |
|
|
2241 | } else { |
|
|
2242 | EV::unloop EV::UNLOOP_ALL; |
|
|
2243 | } |
|
|
2244 | }], |
|
|
2245 | ]); |
|
|
2246 | |
|
|
2247 | $BUTTONBAR->add (new DC::UI::Button text => "Menu…", |
|
|
2248 | tooltip => "Shows the main menu", |
|
|
2249 | on_button_down => sub { $MENUPOPUP->popup ($_[1]) }, |
|
|
2250 | ); |
|
|
2251 | |
|
|
2252 | $MENUBAR->add ($GAUGES->{prg} = new DC::UI::ExperienceProgress |
|
|
2253 | c_rescale => 1, |
|
|
2254 | padding_x => 6, |
|
|
2255 | padding_y => 3, |
|
|
2256 | force_w => $::WIDTH * 0.1, |
|
|
2257 | tooltip => "This progress bar shows your progress towards the next character level.", |
|
|
2258 | ); |
|
|
2259 | $MENUBAR->add ($GAUGES->{exp} = new DC::UI::Label |
|
|
2260 | align => 1, can_hover => 1, can_events => 1, |
|
|
2261 | text => "Total Experience", |
|
|
2262 | tooltip => "#stat_exp", |
|
|
2263 | fontsize => 0.8, |
|
|
2264 | ); |
|
|
2265 | $MENUBAR->add ($GAUGES->{sklprg} = new DC::UI::ExperienceProgress |
|
|
2266 | c_rescale => 1, |
|
|
2267 | padding_x => 6, |
|
|
2268 | padding_y => 3, |
|
|
2269 | force_w => $::WIDTH * 0.2, |
|
|
2270 | tooltip => "This progress bar shows the currently used skill and your progress towards the next skill level of that skill.", |
|
|
2271 | ); |
|
|
2272 | $MENUBAR->add ($GAUGES->{range} = new DC::UI::Label |
|
|
2273 | expand => 1, |
|
|
2274 | align => 1, can_hover => 1, can_events => 1, |
|
|
2275 | text => "Range and Combat Slots", |
|
|
2276 | tooltip => "#stat_ranged", |
|
|
2277 | ); |
|
|
2278 | |
|
|
2279 | $MENUFRAME->show; |
|
|
2280 | } |
|
|
2281 | |
|
|
2282 | sub open_string_query { |
|
|
2283 | my ($title, $cb, $txt, $tooltip) = @_; |
|
|
2284 | my $dialog = new DC::UI::Toplevel |
|
|
2285 | x => "center", |
|
|
2286 | y => "center", |
|
|
2287 | z => 50, |
|
|
2288 | force_w => $WIDTH * 4/5, |
|
|
2289 | title => $title; |
|
|
2290 | |
|
|
2291 | $dialog->add ( |
|
|
2292 | my $e = new DC::UI::Entry |
|
|
2293 | on_activate => sub { $cb->(@_); $dialog->hide; 0 }, |
|
|
2294 | on_key_down => sub { $_[1]->{sym} == 27 and $dialog->hide; 0 }, |
|
|
2295 | tooltip => $tooltip |
|
|
2296 | ); |
|
|
2297 | |
|
|
2298 | $e->grab_focus; |
|
|
2299 | $e->set_text ($txt) if $txt; |
|
|
2300 | $dialog->show; |
|
|
2301 | } |
|
|
2302 | |
2217 | sub show_tip_of_the_day { |
2303 | sub show_tip_of_the_day { |
2218 | # find all tips |
2304 | # find all tips |
2219 | my @tod = DC::Pod::find tip_of_the_day => "*"; |
2305 | my @tod = DC::Pod::find tip_of_the_day => "*"; |
2220 | |
2306 | |
2221 | DC::DB::get state => "tip_of_the_day", sub { |
2307 | DC::DB::get state => "tip_of_the_day", sub { |
… | |
… | |
2360 | |
2446 | |
2361 | (new DC::UI::Frame |
2447 | (new DC::UI::Frame |
2362 | bg => [0, 0, 0, 0.4], |
2448 | bg => [0, 0, 0, 0.4], |
2363 | force_x => 0, |
2449 | force_x => 0, |
2364 | force_y => "max", |
2450 | force_y => "max", |
2365 | child => (my $LR = new DC::UI::VBox), |
2451 | child => (my $LL = new DC::UI::VBox), |
2366 | )->show; |
2452 | )->show; |
2367 | |
2453 | |
2368 | $LR->add ($STATUSBOX); |
2454 | $LL->add ($STATUSBOX); |
2369 | $LR->add ($MODBOX); |
2455 | $LL->add ($MODBOX); |
2370 | $LR->add (new DC::UI::Label |
2456 | $LL->add (new DC::UI::Label |
2371 | align => 0, |
2457 | align => 0, |
2372 | markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode", |
2458 | markup => "Use <b>Alt-Enter</b> to toggle fullscreen mode", |
2373 | fontsize => 0.5, |
2459 | fontsize => 0.5, |
2374 | fg => [1, 1, 0, 0.7], |
2460 | fg => [1, 1, 0, 0.7], |
2375 | ); |
2461 | ); |
… | |
… | |
2444 | . "After pressing the combo the binding will be saved automatically and the " |
2530 | . "After pressing the combo the binding will be saved automatically and the " |
2445 | . "binding editor closes"); |
2531 | . "binding editor closes"); |
2446 | $SETUP_NOTEBOOK->add_tab (Debug => debug_setup, |
2532 | $SETUP_NOTEBOOK->add_tab (Debug => debug_setup, |
2447 | "Some debuggin' options. Do not ask."); |
2533 | "Some debuggin' options. Do not ask."); |
2448 | |
2534 | |
2449 | $BUTTONBAR = new DC::UI::Buttonbar x => 0, y => 0, z => 200; # put on top |
2535 | make_menuframe; |
2450 | |
2536 | |
2451 | $BUTTONBAR->add (new DC::UI::Flopper text => "Setup", other => $SETUP_DIALOG, |
|
|
2452 | tooltip => "Toggles a dialog where you can configure all aspects of this client."); |
|
|
2453 | |
|
|
2454 | # $BUTTONBAR->add (new DC::UI::Flopper text => "Message Window", other => $MESSAGE_WINDOW, |
|
|
2455 | # tooltip => "Toggles the server message log, where the client collects <i>all</i> messages from the server."); |
|
|
2456 | |
|
|
2457 | make_gauge_window->show; # XXX: this has to be set before make_stats_window as make_stats_window calls update_stats_window which updated the gauges also X-D |
|
|
2458 | |
|
|
2459 | $BUTTONBAR->add (new DC::UI::Flopper text => "Playerbook", other => player_window, |
|
|
2460 | tooltip => "Toggles the player view, where you can manage Inventory, Spells, Skills and see your Stats."); |
|
|
2461 | |
|
|
2462 | $BUTTONBAR->add (new DC::UI::Button |
|
|
2463 | text => "Save Config", |
|
|
2464 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
|
|
2465 | on_activate => sub { |
|
|
2466 | $::CFG->{layout} = DC::UI::get_layout; |
|
|
2467 | DC::write_cfg; |
|
|
2468 | status "Configuration Saved"; |
|
|
2469 | 0 |
|
|
2470 | }, |
|
|
2471 | ); |
|
|
2472 | |
|
|
2473 | $BUTTONBAR->add (new DC::UI::Flopper text => "Help!", other => $HELP_WINDOW = help_window, |
|
|
2474 | tooltip => "View Documentation"); |
|
|
2475 | |
|
|
2476 | $BUTTONBAR->add (new DC::UI::Button |
|
|
2477 | text => "Quit", |
|
|
2478 | tooltip => "Terminates the program", |
|
|
2479 | on_activate => sub { |
|
|
2480 | if ($CONN) { |
|
|
2481 | open_quit_dialog; |
|
|
2482 | } else { |
|
|
2483 | EV::unloop EV::UNLOOP_ALL; |
|
|
2484 | } |
|
|
2485 | 0 |
|
|
2486 | }, |
|
|
2487 | ); |
|
|
2488 | |
|
|
2489 | $BUTTONBAR->show; |
|
|
2490 | $SETUP_DIALOG->show; |
2537 | $SETUP_DIALOG->show; |
2491 | $MESSAGE_WINDOW->show; |
2538 | $MESSAGE_WINDOW->show; |
2492 | } |
2539 | } |
2493 | |
2540 | |
2494 | $MODE_SLIDER->set_range ([$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1, 1]); |
2541 | $MODE_SLIDER->set_range ([$CFG->{sdl_mode}, 0, scalar @SDL_MODES, 1, 1]); |
… | |
… | |
2631 | DC::DB::open_db; |
2678 | DC::DB::open_db; |
2632 | |
2679 | |
2633 | DC::UI::set_layout ($::CFG->{layout}); |
2680 | DC::UI::set_layout ($::CFG->{layout}); |
2634 | |
2681 | |
2635 | my %DEF_CFG = ( |
2682 | my %DEF_CFG = ( |
|
|
2683 | config_autosave => 1, |
2636 | sdl_mode => undef, |
2684 | sdl_mode => undef, |
2637 | fullscreen => 1, |
2685 | fullscreen => 1, |
2638 | fast => 0, |
2686 | fast => 0, |
2639 | force_opengl11 => undef, |
2687 | force_opengl11 => undef, |
2640 | disable_alpha => 0, |
2688 | disable_alpha => 0, |
… | |
… | |
2737 | }; |
2785 | }; |
2738 | |
2786 | |
2739 | delete $SIG{__DIE__}; |
2787 | delete $SIG{__DIE__}; |
2740 | EV::loop; |
2788 | EV::loop; |
2741 | |
2789 | |
|
|
2790 | DC::write_cfg if $CFG->{config_autosave}; |
|
|
2791 | |
2742 | #video_shutdown; |
2792 | #video_shutdown; |
2743 | #audio_shutdown; |
2793 | #audio_shutdown; |
|
|
2794 | |
2744 | DC::OpenGL::quit; |
2795 | DC::OpenGL::quit; |
2745 | DC::SDL_Quit; |
2796 | DC::SDL_Quit; |
2746 | DC::DB::Server::stop; |
2797 | DC::DB::Server::stop; |
2747 | } |
2798 | } |
2748 | |
2799 | |