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

Comparing deliantra/Deliantra-Client/DC/Main.pm (file contents):
Revision 1.1 by root, Tue Dec 27 07:23:33 2011 UTC vs.
Revision 1.14 by root, Sat Jan 7 20:07:12 2012 UTC

17 die if $@; 17 die if $@;
18} 18}
19 19
20use common::sense; 20use common::sense;
21use Carp 'verbose'; 21use Carp 'verbose';
22use Cwd ();
23use Digest::MD5 ();
22use EV; 24use EV;
23BEGIN { *time = \&EV::time } 25BEGIN { *time = \&EV::time }
24 26
25use List::Util qw(max min); 27use List::Util qw(max min);
26 28
40 # nop at compiletime 42 # nop at compiletime
41} 43}
42 44
43BEGIN { 45BEGIN {
44 $SIG{__DIE__} = sub { 46 $SIG{__DIE__} = sub {
45 return if $^S; 47 return if $^S; # quick reject
48
49 # return if there are any eval contexts in the csall stack
50 for my $i (0..999) {
51 my ($sub, $is_require) = (caller $i)[3, 7]
52 or last;
53 return if $sub eq "(eval)" && !$is_require;
54 }
55
46 crash "CRASH/DIE: $_[0]" => 1; 56 crash "CRASH/DIE: $_[0]" => 1;
47 DC::fatal Carp::longmess "$_[0]"; 57 DC::fatal Carp::longmess "$_[0]";
48 } 58 }
49} 59}
50 60
133our $PL_NOTEBOOK; 143our $PL_NOTEBOOK;
134our $PL_WINDOW; 144our $PL_WINDOW;
135 145
136our $MUSIC_PLAYING_WIDGET; 146our $MUSIC_PLAYING_WIDGET;
137our $LICENSE_WIDGET; 147our $LICENSE_WIDGET;
148our $DOWNLOADS_WIDGET;
138 149
139our $PICKUP_PAGE; 150our $PICKUP_PAGE;
140our $INVENTORY_PAGE; 151our $INVENTORY_PAGE;
141our $STATS_PAGE; 152our $STATS_PAGE;
142our $SKILL_PAGE; 153our $SKILL_PAGE;
185 AnyEvent::Util::fh_nonblocking $fh, 1; 196 AnyEvent::Util::fh_nonblocking $fh, 1;
186 197
187 $msg =~ s/\s+$//; 198 $msg =~ s/\s+$//;
188 199
189 # backtrace as second step, in case it crashes, too 200 # backtrace as second step, in case it crashes, too
190 crash Carp::longmess "$msg\nbacktrace, for client version $DC::VERSION, generated" 201 crash Carp::longmess "$msg\nbacktrace, for client version $DC::VERSION$Urlader::EXE_VER, generated"
191 if $backtrace; 202 if $backtrace;
192}; 203};
193 204
194sub clienterror($;$) { 205sub clienterror($;$) {
195 my ($msg, $backtrace) = @_; 206 my ($msg, $backtrace) = @_;
197 warn $msg; 208 warn $msg;
198 209
199 return unless $CONN; 210 return unless $CONN;
200 211
201 $CONN->send_exti_msg (clientlog => $msg); 212 $CONN->send_exti_msg (clientlog => $msg);
202 $CONN->send_exti_msg (clientlog => Carp::longmess "$msg\nbacktrace, for client version $DC::VERSION, generated") if $backtrace; 213 $CONN->send_exti_msg (clientlog => Carp::longmess "$msg\nbacktrace, for client version $DC::VERSION$Urlader::EXE_VER, generated") if $backtrace;
203} 214}
204 215
205############################################################################# 216#############################################################################
206 217
207sub status { 218sub status {
512 523
513 DC::Mix_CloseAudio if $SDL_MIXER; 524 DC::Mix_CloseAudio if $SDL_MIXER;
514 undef $SDL_MIXER; 525 undef $SDL_MIXER;
515 526
516 DC::SDL_QuitSubSystem DC::SDL_INIT_AUDIO; 527 DC::SDL_QuitSubSystem DC::SDL_INIT_AUDIO;
528}
529
530#############################################################################
531# Over-the-air updates
532
533sub ota_update {
534 my ($face, $size, $md5) = @_;
535
536 my $coro = Coro::async_pool {
537 my $override = "$Urlader::EXE_DIR/override";
538
539 $MESSAGE_DIST->add_channel ({
540 id => "ota_update",
541 title => "Update",
542 tooltip => "<b>Software Update Log</b>",
543 });
544
545 $MESSAGE_DIST->message ({ type => "ota_update", markup => "preparing override..." });
546
547 my $fh = Coro::AIO::aio_open "$override.tmp", IO::AIO::O_WRONLY | IO::AIO::O_CREAT | IO::AIO::O_TRUNC, 0777;
548
549 unless ($fh) {
550 $MESSAGE_DIST->message ({ type => "ota_update", markup => (DC::asxml "unable to write software update:\n$Urlader::EXE_DIR/override.tmp:\n$!") });
551 return;
552 }
553
554 $MESSAGE_DIST->message ({ type => "ota_update", markup => "downloading $size bytes..." });
555
556 my $cv = AE::cv;
557 my $error;
558
559 $cv->begin (Coro::rouse_cb);
560 $CONN->ask_face (
561 $face,
562 -1000,
563 sub {
564 $STATUSBOX->add (
565 (sprintf "update download: %d/%d", $size - $_[1], $size),
566 pri => -9, group => "ota_update", timeout => 60, fg => [1, 1, 0, 1]
567 );
568
569 $cv->begin;
570 my $len = length $_[2];
571 IO::AIO::aio_write $fh, $_[1], $len, $_[2], undef, sub {
572 $error ||= $_[0] != $len;
573 $cv->end;
574 };
575 },
576 sub {
577 $cv->end;
578 },
579 );
580
581 Coro::rouse_wait;
582
583 $STATUSBOX->clr_group ("ota_update");
584
585 $error ||= Coro::AIO::aio_fsync $fh;
586 $error ||= Coro::AIO::aio_close $fh;
587
588 if ($error) {
589 $MESSAGE_DIST->message ({ type => "ota_update", markup => "file write error, update aborted." });
590 Coro::AIO::aio_unlink "$override.tmp";
591 return;
592 }
593
594 {
595 $MESSAGE_DIST->message ({ type => "ota_update", markup => "verifying update file..." });
596
597 my $fh = Coro::AIO::aio_open "$override.tmp", IO::AIO::O_RDONLY, 0;
598
599 if ($fh) {
600 $error ||= Coro::AIO::aio_stat "$override.tmp";
601 $error ||= -s _ != $size;
602 Coro::AIO::aio_readahead $fh, 0, $size;
603
604 my $f_md5 = new Digest::MD5;
605 binmode $fh; # ugh :(
606 $f_md5->addfile ($fh);
607 $f_md5 = $f_md5->hexdigest;
608 $error ||= $md5 ne $f_md5;
609 }
610 }
611
612 if ($error) {
613 $MESSAGE_DIST->message ({ type => "ota_update", markup => "verification failed, update aborted." });
614 Coro::AIO::aio_unlink "$override.tmp";
615 return;
616 }
617
618 $MESSAGE_DIST->message ({ type => "ota_update", markup => "replacing override file..." });
619
620 if (Coro::AIO::aio_rename "$override.tmp", $override) {
621 $MESSAGE_DIST->message ({ type => "ota_update", markup => "unable to replace override file, update aborted." });
622 Coro::AIO::aio_unlink "$override.tmp";
623 }
624
625 $MESSAGE_DIST->message ({ type => "ota_update", markup => "success - update becomes active after restarting." });
626 };
627
628 $CONN->{ota_update} = Guard::guard {
629 $coro->cancel;
630 };
631}
632
633sub ota_update_ask {
634 my ($ok, $face, $ver, $size, $md5, $changes) = @_;
635
636 $CONN->{w}{ota_dialog} = my $dialog = new DC::UI::Toplevel
637 x => "center",
638 y => "center",
639 z => 55,
640 force_w => $::WIDTH * 0.7,
641 force_h => $::HEIGHT * 0.7,
642 title => "Software update available",
643 child => my $vbox = new DC::UI::VBox,
644 ;
645
646 $vbox->add (new DC::UI::Label
647 ellipsise => 0,
648 text => "The server offers a software update, "
649 . "do you want to start downloading this update in the background?",
650 );
651
652 $vbox->add (new DC::UI::FancyFrame
653 expand => 1,
654 label => "Details",
655 child => (new DC::UI::TextScroller
656 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4,
657 par => [{
658 markup => "<tt>Old revision: $Urlader::EXE_VER\n"
659 . "New revision: $ver\n"
660 . "Download size: $size bytes</tt>\n\n"
661 . "Changes:\n\n"
662 . DC::asxml $changes
663 }],
664 ),
665 );
666
667 $vbox->add (my $hbox = new DC::UI::HBox);
668
669 $hbox->add (new DC::UI::Button
670 expand => 1,
671 text => "Not now",
672 on_activate => sub {
673 $dialog->destroy;
674 0
675 }
676 );
677 $hbox->add (new DC::UI::Button
678 expand => 1,
679 text => "Yes, start downloading",
680 on_activate => sub {
681 $dialog->destroy;
682 ota_update $face, $size, $md5;
683 0
684 },
685 );
686
687 $dialog->show;
688}
689
690sub ota_update_check {
691 return unless defined $Urlader::EXE_ID;
692
693 ::message { markup => "Checking for software update..." };
694
695 $CONN->send_exti_req (ota_update => $Urlader::URLADER_VERSION, $Urlader::EXE_ID, $Urlader::EXE_VER, sub {
696 my ($ok, $face, $ver, $size, $md5, $changes) = @_;
697
698 if ($ok) {
699 if (defined $ver) {
700 ::message { markup => "Server offers version $ver (we are version $Urlader::EXE_VER)." };
701 &ota_update_ask;
702 } else {
703 ::message { markup => "Server has no newer version." };
704 }
705 } else {
706 ::message { markup => "Server does not support software update." };
707 }
708
709# $self->register_face_handler ($exp_table, sub {
710# my ($face) = @_;
711
712# $self->{exp_table} = $self->{json_coder}->decode (delete $face->{data});
713# $_->() for values %{ $self->{on_exp_update} || {} };
714# });
715
716 ()
717 });
517} 718}
518 719
519############################################################################# 720#############################################################################
520 721
521sub destroy_query_dialog { 722sub destroy_query_dialog {
764 mapw => $mapw, 965 mapw => $mapw,
765 maph => $maph, 966 maph => $maph,
766 967
767 c_version => { 968 c_version => {
768 client => "deliantra", 969 client => "deliantra",
769 clientver => $DC::VERSION, 970 clientver => "$DC::VERSION$Urlader::EXE_VER",
770 gl_vendor => DC::OpenGL::gl_vendor, 971 gl_vendor => DC::OpenGL::gl_vendor,
771 gl_version => DC::OpenGL::gl_version, 972 gl_version => DC::OpenGL::gl_version,
772 }, 973 },
773 974
774 map_widget => $MAPWIDGET, 975 map_widget => $MAPWIDGET,
782 }, 983 },
783 984
784 on_connect => sub { 985 on_connect => sub {
785 if ($_[0]) { 986 if ($_[0]) {
786 DC::lowdelay fileno $CONN->{fh}; 987 DC::lowdelay fileno $CONN->{fh};
988
989 ota_update_check;
787 990
788 status "successfully connected to the server"; 991 status "successfully connected to the server";
789 } else { 992 } else {
790 undef $CONN; 993 undef $CONN;
791 status "unable to connect: $!"; 994 status "unable to connect: $!";
1131 text => $CFG->{audio_driver}, 1334 text => $CFG->{audio_driver},
1132 template => "dsound1234", 1335 template => "dsound1234",
1133 tooltip => "You can override the audio driver to use here. Leaving it empty will result " 1336 tooltip => "You can override the audio driver to use here. Leaving it empty will result "
1134 . "in Deliantra picking one automatically. GNU/Linux users often prefer specific " 1337 . "in Deliantra picking one automatically. GNU/Linux users often prefer specific "
1135 . "drivers though, and can experiment with <b>alsa</b>, <b>dsp</b>, <b>esd</b>, <b>pulse</b>, <b>arts</b>, <b>nas</b> " 1338 . "drivers though, and can experiment with <b>alsa</b>, <b>dsp</b>, <b>esd</b>, <b>pulse</b>, <b>arts</b>, <b>nas</b> "
1136 . "or other system-specific drivers. Selecting the wrong driver here will simply result" 1339 . "or other system-specific drivers. Selecting the wrong driver here will simply result "
1137 . "in no sound.", 1340 . "in no sound.",
1138 on_changed => sub { my ($self, $value) = @_; $CFG->{audio_driver} = $value; 1 } 1341 on_changed => sub { my ($self, $value) = @_; $CFG->{audio_driver} = $value; 1 }
1139 ); 1342 );
1140 1343
1141 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); 1344 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects");
1773 1976
1774 $vbox 1977 $vbox
1775} 1978}
1776 1979
1777sub client_setup { 1980sub client_setup {
1981 my $vbox = new DC::UI::VBox;
1982
1983 $vbox->add (my $top = new DC::UI::FancyFrame expand => 1, label => "Client Settings");
1984 $vbox->add (my $bot = new DC::UI::FancyFrame expand => 1, label => "Client Info");
1985
1986 {
1778 my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]; 1987 $top->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]);
1779 1988
1780 my $row = 0; 1989 my $row = 0;
1781 1990
1782 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day"); 1991 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day");
1783 $table->add_at (1, $row++, new DC::UI::CheckBox 1992 $table->add_at (1, $row++, new DC::UI::CheckBox
1784 c_colspan => 2, 1993 c_colspan => 2,
1785 state => $CFG->{show_tips}, 1994 state => $CFG->{show_tips},
1786 tooltip => "Show the <b>Tip of the day</b> window at startup?", 1995 tooltip => "Show the <b>Tip of the day</b> window at startup?",
1787 on_changed => sub { 1996 on_changed => sub {
1788 my ($self, $value) = @_; 1997 my ($self, $value) = @_;
1789 $CFG->{show_tips} = $value; 1998 $CFG->{show_tips} = $value;
1999 0
1790 0 2000 }
1791 } 2001 );
1792 );
1793 2002
1794 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size"); 2003 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Window Size");
1795 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry 2004 $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry
1796 c_colspan => 2, 2005 c_colspan => 2,
1797 text => $CFG->{logview_max_par}, 2006 text => $CFG->{logview_max_par},
1798 tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server " 2007 tooltip => "This is maximum number of messages remembered in the <b>Message</b> window. If the server "
1799 . "sends more messages than this number, older messages get removed to save memory and " 2008 . "sends more messages than this number, older messages get removed to save memory and "
1800 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", 2009 . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.",
1801 on_changed => sub { 2010 on_changed => sub {
1802 my ($self, $value) = @_; 2011 my ($self, $value) = @_;
1803 $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1); 2012 $MESSAGE_DIST->set_max_par ($CFG->{logview_max_par} = $value*1);
1804 0 2013 0
1805 }, 2014 },
1806 ); 2015 );
1807 2016
1808 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Config Autosave"); 2017 $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Config Autosave");
1809 $table->add_at (1, $row, new DC::UI::CheckBox 2018 $table->add_at (1, $row, new DC::UI::CheckBox
1810 state => $CFG->{config_autosave}, 2019 state => $CFG->{config_autosave},
1811 tooltip => "Normally, configuration settings and the user interface layout " 2020 tooltip => "Normally, configuration settings and the user interface layout "
1812 . "are saved on client exit. You can disable this behaviour by " 2021 . "are saved on client exit. You can disable this behaviour by "
1813 . "unchecking this checkbox.", 2022 . "unchecking this checkbox.",
1814 on_changed => sub { 2023 on_changed => sub {
1815 my ($self, $value) = @_; 2024 my ($self, $value) = @_;
1816 $CFG->{config_autosave} = $value; 2025 $CFG->{config_autosave} = $value;
2026 0
1817 0 2027 }
1818 } 2028 );
1819 );
1820 $table->add_at (2, $row++, new DC::UI::Button 2029 $table->add_at (2, $row++, new DC::UI::Button
1821 text => "Save Now", 2030 text => "Save Now",
1822 tooltip => "Use this to manually save configuration and UI layout when " 2031 tooltip => "Use this to manually save configuration and UI layout when "
1823 . "autosave is disabled.", 2032 . "autosave is disabled.",
1824 on_activate => sub { 2033 on_activate => sub {
1825 DC::write_cfg; 2034 DC::write_cfg;
2035 0
1826 0 2036 }
1827 } 2037 );
1828 ); 2038 }
1829 2039
1830 $table 2040 {
2041 $bot->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]);
2042
2043 my $row = 0;
2044
2045 $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Data Directory");
2046 $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $Deliantra::VARDIR, tooltip => "");
2047 $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Database Directory");
2048 $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $DC::DB::DBDIR, tooltip => "");
2049 $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Urlader (Prebuilt)");
2050 $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $ENV{URLADER_VERSION}, tooltip => "");
2051 $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Branch (Prebuilt)");
2052 $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $ENV{URLADER_EXE_ID}, tooltip => "");
2053 $table->add_at (0, $row , new DC::UI::Label align => 1, text => "Revision (Prebuilt)");
2054 $table->add_at (1, $row++, new DC::UI::Label align => 0, text => $ENV{URLADER_EXE_VER}, tooltip => "");
2055 }
2056
2057 $vbox
1831} 2058}
1832 2059
1833sub autopickup_setup { 2060sub autopickup_setup {
1834 my $r = new DC::UI::ScrolledWindow ( 2061 my $r = new DC::UI::ScrolledWindow (
1835 expand => 1, 2062 expand => 1,
2006 2233
2007sub media_window { 2234sub media_window {
2008 my $vb = new DC::UI::VBox; 2235 my $vb = new DC::UI::VBox;
2009 2236
2010 $vb->add (new DC::UI::FancyFrame 2237 $vb->add (new DC::UI::FancyFrame
2011 label => "Currently playing music", 2238 label => "Current background music",
2012 child => new DC::UI::ScrolledWindow scroll_x => 1, scroll_y => 0, 2239 child => new DC::UI::ScrolledWindow scroll_x => 1, scroll_y => 0,
2013 child => ($MUSIC_PLAYING_WIDGET = new DC::UI::Label ellipsise => 0, fontsize => 0.8), 2240 child => ($MUSIC_PLAYING_WIDGET = new DC::UI::Label ellipsise => 0, fontsize => 0.8),
2014 ); 2241 );
2242
2243 $vb->add (new DC::UI::FancyFrame
2244 label => "Current downloads",
2245 child => ($DOWNLOADS_WIDGET = new DC::UI::Table
2246 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4),
2247 );
2248
2249 $DOWNLOADS_WIDGET->connect (visibility_change => sub {
2250 my ($self) = @_;
2251
2252 delete $self->{updater};
2253 return unless $_[1];
2254
2255 $self->{updater} = AE::timer 0, 0.7, sub {
2256 $self->clear;
2257
2258 return unless $CONN;
2259
2260 my @nums = sort { $b <=> $a } keys %{ $CONN->{ix_recv_buf} };
2261 return unless @nums;
2262
2263 $self->add_at (0, 0, new DC::UI::Label align => 1, text => "Face");
2264 $self->add_at (1, 0, new DC::UI::Label align => 0, text => "Octets/Total");
2265
2266 for my $row (0 .. $#nums) {
2267 my $num = $nums[$row];
2268
2269 my $total = length $CONN->{ix_recv_buf}{$num};
2270 my $got = $total - $CONN->{ix_recv_ofs}{$num};
2271
2272 $self->add_at (0, $row + 1, new DC::UI::Label align => 1, text => $num, tooltip => "");
2273 $self->add_at (1, $row + 1, new DC::UI::Label align => 0, text => "$got/$total", tooltip => "");
2274 }
2275 };
2276 });
2015 2277
2016 $vb->add (new DC::UI::FancyFrame 2278 $vb->add (new DC::UI::FancyFrame
2017 label => "Other media used in this session", 2279 label => "Other media used in this session",
2018 expand => 1, 2280 expand => 1,
2019 child => ($LICENSE_WIDGET = new DC::UI::TextScroller 2281 child => ($LICENSE_WIDGET = new DC::UI::TextScroller
2020 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4), 2282 expand => 1, fontsize => 0.8, padding_x => 4, padding_y => 4),
2021 ); 2283 );
2022 2284
2023 $vb 2285 $vb
2024} 2286}
2025 2287
2210sub open_quit_dialog { 2472sub open_quit_dialog {
2211 unless ($QUIT_DIALOG) { 2473 unless ($QUIT_DIALOG) {
2212 $QUIT_DIALOG = new DC::UI::Toplevel 2474 $QUIT_DIALOG = new DC::UI::Toplevel
2213 x => "center", 2475 x => "center",
2214 y => "center", 2476 y => "center",
2215 z => 50, 2477 z => 60,
2216 title => "Really Quit?", 2478 title => "Really Quit?",
2217 on_key_down => sub { 2479 on_key_down => sub {
2218 my ($dialog, $ev) = @_; 2480 my ($dialog, $ev) = @_;
2219 $ev->{sym} == 27 and $dialog->hide; 2481 $ev->{sym} == 27 and $dialog->hide;
2220 } 2482 }
2436 my ($old_w, $old_h) = ($WIDTH, $HEIGHT); 2698 my ($old_w, $old_h) = ($WIDTH, $HEIGHT);
2437 2699
2438 ($WIDTH, $HEIGHT, my ($rgb, $alpha)) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; 2700 ($WIDTH, $HEIGHT, my ($rgb, $alpha)) = @{ $SDL_MODES[$CFG->{sdl_mode}] };
2439 $FULLSCREEN = $CFG->{fullscreen}; 2701 $FULLSCREEN = $CFG->{fullscreen};
2440 $FAST = $CFG->{fast}; 2702 $FAST = $CFG->{fast};
2703
2704 DC::SDL_WM_SetCaption "Deliantra MORPG Client $DC::VERSION$Urlader::EXE_VER", "Deliantra"; # must be after SDL_Init
2441 2705
2442 # due to mac os x braindamage, we simply retry with !fullscreen in case of an error 2706 # due to mac os x braindamage, we simply retry with !fullscreen in case of an error
2443 DC::SDL_SetVideoMode $WIDTH, $HEIGHT, $rgb, $alpha, $FULLSCREEN 2707 DC::SDL_SetVideoMode $WIDTH, $HEIGHT, $rgb, $alpha, $FULLSCREEN
2444 or DC::SDL_SetVideoMode $WIDTH, $HEIGHT, $rgb, $alpha, !$FULLSCREEN 2708 or DC::SDL_SetVideoMode $WIDTH, $HEIGHT, $rgb, $alpha, !$FULLSCREEN
2445 or die "SDL_SetVideoMode failed: " . (DC::SDL_GetError) . "\n"; 2709 or die "SDL_SetVideoMode failed: " . (DC::SDL_GetError) . "\n";
2632 2896
2633our $INPUT_WATCHER = EV::periodic 0, 1 / $MAX_FPS, undef, sub { 2897our $INPUT_WATCHER = EV::periodic 0, 1 / $MAX_FPS, undef, sub {
2634 $NOW = EV::now; 2898 $NOW = EV::now;
2635 2899
2636 ($SDL_CB[$_->{type}] || sub { warn "unhandled event $_->{type}" })->($_) 2900 ($SDL_CB[$_->{type}] || sub { warn "unhandled event $_->{type}" })->($_)
2637 for DC::poll_events; 2901 for DC::peep_events;
2638 2902
2639 if (%animate_object) { 2903 if (%animate_object) {
2640 $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; 2904 $_->animate ($LAST_REFRESH - $NOW) for values %animate_object;
2641 $WANT_REFRESH = 1; 2905 $WANT_REFRESH = 1;
2642 } 2906 }
2814 }; 3078 };
2815 } 3079 }
2816 } 3080 }
2817 } 3081 }
2818 3082
3083 # fontconfig doesn't support relative paths anymore, so use abs_path and keep fingers crossed
3084 # these are ignored under windows, for some reason, and thus set in the loader
2819 $ENV{FONTCONFIG_FILE} = DC::find_rcfile "fonts/fonts.conf"; 3085 $ENV{FONTCONFIG_FILE} = "fonts.conf";
2820 $ENV{FONTCONFIG_DIR} = DC::find_rcfile "fonts"; 3086 $ENV{FONTCONFIG_PATH} = Cwd::abs_path DC::find_rcfile "fonts";
3087 $ENV{FONTCONFIG_DIR} = $ENV{FONTCONFIG_PATH}; # helps with older versions
2821 3088
2822 { 3089 {
2823 my @fonts = map DC::find_rcfile "fonts/$_", qw( 3090 my @fonts = map DC::find_rcfile "fonts/$_", qw(
2824 DejaVuSans.ttf 3091 DejaVuSans.ttf
2825 DejaVuSansMono.ttf 3092 DejaVuSansMono.ttf

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines