… | |
… | |
101 | our $DEBUG_STATUS; |
101 | our $DEBUG_STATUS; |
102 | |
102 | |
103 | our $INV_WINDOW; |
103 | our $INV_WINDOW; |
104 | our $INV; |
104 | our $INV; |
105 | our $INVR; |
105 | our $INVR; |
106 | our $INVR_LBL; |
106 | our $INV_RIGHT_HB; |
|
|
107 | |
|
|
108 | our $BIND_WINDOW; |
107 | |
109 | |
108 | sub status { |
110 | sub status { |
109 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
111 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
110 | } |
112 | } |
111 | |
113 | |
112 | sub debug { |
114 | sub debug { |
113 | $DEBUG_STATUS->set_text ($_[0]); |
115 | $DEBUG_STATUS->set_text ($_[0]); |
114 | my ($w, $h) = $DEBUG_STATUS->size_request; |
|
|
115 | $DEBUG_STATUS->move ($WIDTH - $w, 0); |
|
|
116 | } |
116 | } |
117 | |
117 | |
118 | sub start_game { |
118 | sub start_game { |
119 | status "logging in..."; |
119 | status "logging in..."; |
120 | |
120 | |
… | |
… | |
179 | $CONN = 0; # false, does not autovivify |
179 | $CONN = 0; # false, does not autovivify |
180 | } |
180 | } |
181 | |
181 | |
182 | sub client_setup { |
182 | sub client_setup { |
183 | my $dialog = new CFClient::UI::FancyFrame |
183 | my $dialog = new CFClient::UI::FancyFrame |
184 | req_x => 1, |
184 | x => 1, |
185 | req_y => $HEIGHT * (1/8), |
185 | y => $HEIGHT * (1/8), |
186 | name => "client_setup", |
186 | name => "client_setup", |
187 | title => "Client Setup", |
187 | title => "Client Setup", |
188 | child => (my $vbox = new CFClient::UI::VBox); |
188 | child => (my $vbox = new CFClient::UI::VBox); |
|
|
189 | |
189 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
190 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
190 | |
191 | |
191 | $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); |
192 | $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); |
192 | $table->add (1, 0, my $hbox = new CFClient::UI::HBox); |
193 | $table->add (1, 0, my $hbox = new CFClient::UI::HBox); |
193 | |
194 | |
194 | $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, req_w => 100, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]); |
195 | $hbox->add (my $mode_slider = new CFClient::UI::Slider force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]); |
195 | $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); |
196 | $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); |
196 | |
197 | |
197 | $mode_slider->connect (changed => sub { |
198 | $mode_slider->connect (changed => sub { |
198 | my ($self, $value) = @_; |
199 | my ($self, $value) = @_; |
199 | |
200 | |
… | |
… | |
387 | |
388 | |
388 | sub make_gauge_window { |
389 | sub make_gauge_window { |
389 | my $gh = int $HEIGHT * $CFG->{gauge_size}; |
390 | my $gh = int $HEIGHT * $CFG->{gauge_size}; |
390 | |
391 | |
391 | my $win = new CFClient::UI::Frame ( |
392 | my $win = new CFClient::UI::Frame ( |
392 | req_x => 0, |
393 | force_x => 0, |
393 | req_y => -1, |
394 | force_y => "max", |
394 | def_w => $WIDTH, |
395 | force_w => $WIDTH, |
395 | def_h => $gh, |
396 | force_h => $gh, |
396 | ); |
397 | ); |
397 | |
398 | |
398 | $win->add (my $hbox = new CFClient::UI::HBox |
399 | $win->add (my $hbox = new CFClient::UI::HBox |
399 | children => [ |
400 | children => [ |
400 | (new CFClient::UI::HBox expand => 1), |
401 | (new CFClient::UI::HBox expand => 1), |
… | |
… | |
436 | &set_gauge_window_fontsize; |
437 | &set_gauge_window_fontsize; |
437 | |
438 | |
438 | $win |
439 | $win |
439 | } |
440 | } |
440 | |
441 | |
|
|
442 | |
441 | sub make_stats_window { |
443 | sub make_stats_window { |
442 | my $tgw = new CFClient::UI::FancyFrame |
444 | my $tgw = new CFClient::UI::FancyFrame |
443 | req_y => $HEIGHT * (2/8), |
445 | y => $HEIGHT * (2/8), |
444 | req_x => -1, |
446 | x => "max", |
445 | title => "Stats", |
447 | title => "Stats", |
446 | name => "stats_window"; |
448 | name => "stats_window"; |
447 | |
449 | |
448 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
450 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
449 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
451 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
450 | can_hover => 1, can_events => 1, |
452 | can_hover => 1, can_events => 1, |
451 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
453 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
… | |
… | |
714 | }); |
716 | }); |
715 | } |
717 | } |
716 | |
718 | |
717 | sub server_setup { |
719 | sub server_setup { |
718 | my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame |
720 | my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame |
719 | x => $WIDTH * (1/3), |
721 | x => "center", |
720 | y => $HEIGHT * (1/8), |
722 | y => "center", |
721 | name => "server_setup", |
723 | name => "server_setup", |
722 | title => "Server Setup", |
724 | title => "Server Setup", |
723 | child => (my $vbox = new CFClient::UI::VBox), |
725 | child => (my $vbox = new CFClient::UI::VBox), |
724 | on_visibility_change => sub { |
|
|
725 | my ($self, $visible) = @_; |
|
|
726 | $self->center if $visible; |
|
|
727 | }, |
|
|
728 | ; |
726 | ; |
729 | |
727 | |
730 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
728 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
731 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
729 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
732 | |
730 | |
… | |
… | |
778 | } |
776 | } |
779 | ); |
777 | ); |
780 | |
778 | |
781 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
779 | $table->add (0, 7, new CFClient::UI::Label valign => 0, align => 1, text => "Map Size"); |
782 | $table->add (1, 7, new CFClient::UI::Slider |
780 | $table->add (1, 7, new CFClient::UI::Slider |
783 | req_w => 100, |
781 | force_w => 100, |
784 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
782 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
785 | tooltip => "This is the size of the portion of the map update the server sends you. " |
783 | tooltip => "This is the size of the portion of the map update the server sends you. " |
786 | . "If you set this to a high value you will be able to see further, " |
784 | . "If you set this to a high value you will be able to see further, " |
787 | . "but you also increase bandwidth requirements and latency. " |
785 | . "but you also increase bandwidth requirements and latency. " |
788 | . "This option is only used once at log-in.", |
786 | . "This option is only used once at log-in.", |
… | |
… | |
837 | my $window = new CFClient::UI::FancyFrame |
835 | my $window = new CFClient::UI::FancyFrame |
838 | name => "message_window", |
836 | name => "message_window", |
839 | title => "Messages", |
837 | title => "Messages", |
840 | border_bg => [1, 1, 1, 1], |
838 | border_bg => [1, 1, 1, 1], |
841 | bg => [0, 0, 0, 0.75], |
839 | bg => [0, 0, 0, 0.75], |
842 | req_x => -1, |
840 | x => "max", |
843 | req_y => 0, |
841 | y => 0, |
844 | def_w => int $::WIDTH / 3, |
842 | force_w => $::WIDTH / 3, |
845 | def_h => int $::HEIGHT / 5, |
843 | force_h => $::HEIGHT / 5, |
846 | child => (my $vbox = new CFClient::UI::VBox); |
844 | child => (my $vbox = new CFClient::UI::VBox); |
847 | |
845 | |
848 | $vbox->add ($LOGVIEW); |
846 | $vbox->add ($LOGVIEW); |
849 | |
847 | |
850 | $vbox->add (my $input = new CFClient::UI::Entry |
848 | $vbox->add (my $input = new CFClient::UI::Entry |
… | |
… | |
864 | }, |
862 | }, |
865 | on_activate => sub { |
863 | on_activate => sub { |
866 | my ($input, $text) = @_; |
864 | my ($input, $text) = @_; |
867 | $input->set_text (''); |
865 | $input->set_text (''); |
868 | |
866 | |
|
|
867 | if ($text =~ /^\/bind\s+(.*)$/) { |
|
|
868 | CFClient::Recorder::open_binding_dialog ([$1]); |
869 | if ($text =~ /^\/(.*)/) { |
869 | } elsif ($text =~ /^\/(.*)/) { |
870 | $::CONN->user_send ($1); |
870 | $::CONN->user_send ($1); |
871 | } else { |
871 | } else { |
872 | my $say_cmd = $::CFG->{say_command} || 'say'; |
872 | my $say_cmd = $::CFG->{say_command} || 'say'; |
873 | $::CONN->user_send ("$say_cmd $text"); |
873 | $::CONN->user_send ("$say_cmd $text"); |
874 | } |
874 | } |
… | |
… | |
882 | }, |
882 | }, |
883 | ); |
883 | ); |
884 | |
884 | |
885 | $CONSOLE = { |
885 | $CONSOLE = { |
886 | window => $window, |
886 | window => $window, |
887 | input => $input |
887 | input => $input, |
888 | }; |
888 | }; |
889 | |
889 | |
890 | $window |
890 | $window |
891 | } |
891 | } |
892 | |
892 | |
893 | sub open_quit_dialog { |
893 | sub open_quit_dialog { |
894 | unless ($QUIT_DIALOG) { |
894 | unless ($QUIT_DIALOG) { |
895 | $QUIT_DIALOG = new CFClient::UI::FancyFrame title => "Really Quit?"; |
895 | $QUIT_DIALOG = new CFClient::UI::FancyFrame |
|
|
896 | x => "center", |
|
|
897 | y => "center", |
|
|
898 | title => "Really Quit?", |
|
|
899 | ; |
896 | |
900 | |
897 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
901 | $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); |
898 | |
902 | |
899 | $vb->add (new CFClient::UI::Label |
903 | $vb->add (new CFClient::UI::Label |
900 | text => "You should find a savebed and apply it first!", |
904 | text => "You should find a savebed and apply it first!", |
… | |
… | |
913 | on_activate => sub { exit }, |
917 | on_activate => sub { exit }, |
914 | ); |
918 | ); |
915 | } |
919 | } |
916 | |
920 | |
917 | $QUIT_DIALOG->show; |
921 | $QUIT_DIALOG->show; |
918 | $QUIT_DIALOG->center; |
|
|
919 | } |
922 | } |
920 | |
923 | |
921 | sub make_inventory_window { |
924 | sub make_inventory_window { |
922 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
925 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
|
|
926 | x => "center", |
|
|
927 | y => "center", |
923 | def_w => $WIDTH * 7/8, |
928 | force_w => $WIDTH * 9/10, |
924 | def_h => $HEIGHT * 7/8, |
929 | force_h => $HEIGHT * 9/10, |
925 | title => "Inventory", |
930 | title => "Inventory", |
926 | name => "inventory_window", |
931 | name => "inventory_window", |
927 | on_visibility_change => sub { |
|
|
928 | my ($self, $visible) = @_; |
|
|
929 | $self->center if $visible; |
|
|
930 | }, |
|
|
931 | ; |
932 | ; |
932 | |
933 | |
933 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
934 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
934 | |
935 | |
935 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
936 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
936 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
937 | $vb1->add (new CFClient::UI::Label align => 0, text => "Player"); |
937 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
938 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
938 | |
939 | |
939 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
940 | $hb->add (my $vb2 = new CFClient::UI::VBox); |
940 | |
941 | |
941 | $vb2->add (my $hb2 = new CFClient::UI::HBox); |
942 | $vb2->add ($INV_RIGHT_HB = new CFClient::UI::HBox); |
942 | $hb2->add ($INVR_LBL = new CFClient::UI::Label align => 0, expand => 1, text => "Floor"); |
|
|
943 | $hb2->add (new CFClient::UI::Button |
|
|
944 | text => "Close", |
|
|
945 | tooltip => "Close the currently open container (if one is open)", |
|
|
946 | on_activate => sub { |
|
|
947 | $CONN->send ("apply $CONN->{open_container}") |
|
|
948 | if $CONN->{open_container} != 0; |
|
|
949 | }, |
|
|
950 | ); |
|
|
951 | |
943 | |
952 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
944 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
953 | |
945 | |
|
|
946 | # XXX: Call after $INVR = ... because set_opencont sets the items |
|
|
947 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
|
|
948 | |
954 | $invwin |
949 | $invwin |
|
|
950 | } |
|
|
951 | |
|
|
952 | sub make_binding_window { |
|
|
953 | my $binding_list = new CFClient::UI::VBox; |
|
|
954 | |
|
|
955 | my $refresh = sub { |
|
|
956 | $binding_list->clear (); |
|
|
957 | |
|
|
958 | for my $mod (keys %{$::CFG->{bindings}}) { |
|
|
959 | for my $sym (keys %{$::CFG->{bindings}->{$mod}}) { |
|
|
960 | my $cmds = $::CFG->{bindings}->{$mod}->{$sym}; |
|
|
961 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
|
|
962 | |
|
|
963 | my $lbl = join "; ", @$cmds; |
|
|
964 | my $nam = CFClient::Recorder::keycombo_to_name ($mod, $sym); |
|
|
965 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
|
|
966 | $hb->add (new CFClient::UI::Button |
|
|
967 | text => "delete", |
|
|
968 | on_activate => sub { |
|
|
969 | $binding_list->remove ($hb); |
|
|
970 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
|
|
971 | }); |
|
|
972 | $hb->add (new CFClient::UI::Label text => "($nam)"); |
|
|
973 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
|
|
974 | } |
|
|
975 | } |
|
|
976 | }; |
|
|
977 | |
|
|
978 | $BIND_WINDOW = new CFClient::UI::FancyFrame |
|
|
979 | title => "Bindings", |
|
|
980 | x => "center", |
|
|
981 | y => "center", |
|
|
982 | def_w => int $WIDTH * 9/10, |
|
|
983 | def_h => int $HEIGHT * 9/10, |
|
|
984 | on_visibility_change => sub { |
|
|
985 | my ($self, $visible) = @_; |
|
|
986 | $refresh->() if $visible; |
|
|
987 | }; |
|
|
988 | |
|
|
989 | $BIND_WINDOW->add ($binding_list); |
|
|
990 | $refresh->(); |
|
|
991 | $BIND_WINDOW |
955 | } |
992 | } |
956 | |
993 | |
957 | sub make_help_window { |
994 | sub make_help_window { |
958 | my $win = new CFClient::UI::FancyFrame |
995 | my $win = new CFClient::UI::FancyFrame |
959 | def_w => int $WIDTH * 7/8, |
996 | def_w => int $WIDTH * 7/8, |
… | |
… | |
1027 | if ($DEBUG_STATUS) { |
1064 | if ($DEBUG_STATUS) { |
1028 | CFClient::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h; |
1065 | CFClient::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h; |
1029 | } else { |
1066 | } else { |
1030 | # create the widgets |
1067 | # create the widgets |
1031 | |
1068 | |
1032 | $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100, req_x => -1; |
1069 | $DEBUG_STATUS = new CFClient::UI::Label |
|
|
1070 | padding => 0, |
|
|
1071 | z => 100, |
|
|
1072 | force_x => "max", |
|
|
1073 | force_y => 0; |
1033 | $DEBUG_STATUS->show; |
1074 | $DEBUG_STATUS->show; |
1034 | |
1075 | |
1035 | $STATUSBOX = new CFClient::UI::Statusbox; |
1076 | $STATUSBOX = new CFClient::UI::Statusbox; |
1036 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, color => [1, 1, 1, 0.8]); |
1077 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, color => [1, 1, 1, 0.8]); |
1037 | |
1078 | |
1038 | (new CFClient::UI::Frame |
1079 | (new CFClient::UI::Frame |
1039 | bg => [0, 0, 0, 0.4], |
1080 | bg => [0, 0, 0, 0.4], |
1040 | req_y => -1, |
1081 | force_x => 0, |
|
|
1082 | force_y => "max", |
1041 | child => $STATUSBOX, |
1083 | child => $STATUSBOX, |
1042 | )->show; |
1084 | )->show; |
1043 | |
1085 | |
1044 | CFClient::UI::FancyFrame->new ( |
1086 | CFClient::UI::FancyFrame->new ( |
|
|
1087 | x => 0, |
|
|
1088 | y => $FONTSIZE + 8, |
1045 | border_bg => [1, 1, 1, 192/255], |
1089 | border_bg => [1, 1, 1, 192/255], |
1046 | bg => [1, 1, 1, 0], |
1090 | bg => [1, 1, 1, 0], |
1047 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
1091 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
1048 | tooltip => "<b>Map</b>. On servers that support this feature, this will display an overview of the surrounding areas.", |
1092 | tooltip => "<b>Map</b>. On servers that support this feature, this will display an overview of the surrounding areas.", |
1049 | ), |
1093 | ), |
… | |
… | |
1072 | can_hover => 1, |
1116 | can_hover => 1, |
1073 | can_events => 1, |
1117 | can_events => 1, |
1074 | tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", |
1118 | tooltip => "<b>Server Log</b>. This text viewer contains all the messages sent by the server.", |
1075 | ; |
1119 | ; |
1076 | |
1120 | |
1077 | $BUTTONBAR = new CFClient::UI::HBox; |
1121 | $BUTTONBAR = new CFClient::UI::HBox x => 0, y => 0; |
1078 | |
1122 | |
1079 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup, |
1123 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup, |
1080 | tooltip => "Toggles a dialog where you can configure various aspects of the client, such as graphics mode, performance, and audio options."); |
1124 | tooltip => "Toggles a dialog where you can configure various aspects of the client, such as graphics mode, performance, and audio options."); |
1081 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup, |
1125 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup, |
1082 | tooltip => "Toggles a dialog where you can configure the server to play on, your username, password and other server-related options."); |
1126 | tooltip => "Toggles a dialog where you can configure the server to play on, your username, password and other server-related options."); |
… | |
… | |
1093 | $BUTTONBAR->add (new CFClient::UI::Button |
1137 | $BUTTONBAR->add (new CFClient::UI::Button |
1094 | text => "Save Config", |
1138 | text => "Save Config", |
1095 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1139 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1096 | on_activate => sub { |
1140 | on_activate => sub { |
1097 | $::CFG->{layout} = CFClient::UI::get_layout; |
1141 | $::CFG->{layout} = CFClient::UI::get_layout; |
1098 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
1142 | CFClient::write_cfg "$Crossfire::VARDIR/cfplusrc"; |
1099 | status "Configuration Saved"; |
1143 | status "Configuration Saved"; |
1100 | }, |
1144 | }, |
1101 | ); |
1145 | ); |
1102 | |
1146 | |
1103 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1147 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1104 | tooltip => "View Documentation"); |
1148 | tooltip => "View Documentation"); |
|
|
1149 | |
|
|
1150 | $BUTTONBAR->add (new CFClient::UI::Flopper |
|
|
1151 | text => "Bindings", |
|
|
1152 | other => make_binding_window, |
|
|
1153 | tooltip => "Lets you delete bindings you have made with the recorder" |
|
|
1154 | ); |
|
|
1155 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "[Rec]", other => CFClient::Recorder::make_window, |
|
|
1156 | tooltip => "This feature lets you record a series of actions (eg. walking a path or ready a skill) and bind them to keys"); |
1105 | |
1157 | |
1106 | $BUTTONBAR->add (new CFClient::UI::Button |
1158 | $BUTTONBAR->add (new CFClient::UI::Button |
1107 | text => "Quit", |
1159 | text => "Quit", |
1108 | tooltip => "Terminates the program", |
1160 | tooltip => "Terminates the program", |
1109 | on_activate => sub { |
1161 | on_activate => sub { |
… | |
… | |
1114 | } |
1166 | } |
1115 | }, |
1167 | }, |
1116 | ); |
1168 | ); |
1117 | |
1169 | |
1118 | $BUTTONBAR->show; |
1170 | $BUTTONBAR->show; |
|
|
1171 | $SERVER_SETUP->show; |
1119 | |
1172 | |
1120 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
1173 | $STATUSBOX->add ("Set video mode $WIDTH×$HEIGHT", timeout => 10, fg => [1, 1, 1, 0.5]); |
1121 | |
|
|
1122 | $SERVER_SETUP->show; |
|
|
1123 | } |
1174 | } |
1124 | } |
1175 | } |
1125 | |
1176 | |
1126 | sub video_shutdown { |
1177 | sub video_shutdown { |
1127 | undef $SDL_ACTIVE; |
1178 | undef $SDL_ACTIVE; |
… | |
… | |
1195 | |
1246 | |
1196 | my %demo;#d# |
1247 | my %demo;#d# |
1197 | |
1248 | |
1198 | sub force_refresh { |
1249 | sub force_refresh { |
1199 | $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; |
1250 | $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; |
1200 | debug sprintf "%3.2f", $fps; |
1251 | debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; |
1201 | |
1252 | |
1202 | $CFClient::UI::ROOT->draw; |
1253 | $CFClient::UI::ROOT->draw; |
1203 | |
1254 | |
1204 | $WANT_REFRESH = 0; |
1255 | $WANT_REFRESH = 0; |
1205 | $CAN_REFRESH = 0; |
1256 | $CAN_REFRESH = 0; |
… | |
… | |
1337 | ############################################################################# |
1388 | ############################################################################# |
1338 | |
1389 | |
1339 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
1390 | $SIG{INT} = $SIG{TERM} = sub { exit }; |
1340 | |
1391 | |
1341 | { |
1392 | { |
1342 | local $SIG{__DIE__} = sub { CFClient::fatal $_[0] }; |
1393 | local $SIG{__DIE__} = sub { CFClient::fatal $_[0] if defined $^S && !$^S }; |
1343 | |
1394 | |
1344 | CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; |
1395 | CFClient::read_cfg "$Crossfire::VARDIR/cfplusrc"; |
1345 | CFClient::UI::set_layout ($::CFG->{layout}); |
1396 | CFClient::UI::set_layout ($::CFG->{layout}); |
1346 | |
1397 | |
1347 | my %DEF_CFG = ( |
1398 | my %DEF_CFG = ( |
1348 | sdl_mode => 0, |
1399 | sdl_mode => 0, |
1349 | width => 640, |
1400 | width => 640, |
… | |
… | |
1427 | |
1478 | |
1428 | END { CFClient::SDL_Quit } |
1479 | END { CFClient::SDL_Quit } |
1429 | |
1480 | |
1430 | =head1 NAME |
1481 | =head1 NAME |
1431 | |
1482 | |
1432 | pclient - A Crossfire+ and Crossfire game client |
1483 | cfplus - A Crossfire+ and Crossfire game client |
1433 | |
1484 | |
1434 | =head1 SYNOPSIS |
1485 | =head1 SYNOPSIS |
1435 | |
1486 | |
1436 | Just run it - no commandline arguments are supported. |
1487 | Just run it - no commandline arguments are supported. |
1437 | |
1488 | |
1438 | =head1 USAGE |
1489 | =head1 USAGE |
1439 | |
1490 | |
1440 | Pclient utilises OpenGL for all UI elements and the game. It is supposed to be used |
1491 | cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used |
1441 | fullscreen and interactively. |
1492 | fullscreen and interactively. |
1442 | |
1493 | |
1443 | =head1 AUTHOR |
1494 | =head1 AUTHOR |
1444 | |
1495 | |
1445 | Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
1496 | Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |