ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/cfplus
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/cfplus (file contents):
Revision 1.29 by root, Mon May 29 21:54:16 2006 UTC vs.
Revision 1.30 by root, Tue May 30 01:42:16 2006 UTC

111 $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]);
112} 112}
113 113
114sub debug { 114sub debug {
115 $DEBUG_STATUS->set_text ($_[0]); 115 $DEBUG_STATUS->set_text ($_[0]);
116 my ($w, $h) = $DEBUG_STATUS->size_request;
117 $DEBUG_STATUS->move ($WIDTH - $w, 0);
118} 116}
119 117
120sub start_game { 118sub start_game {
121 status "logging in..."; 119 status "logging in...";
122 120
181 $CONN = 0; # false, does not autovivify 179 $CONN = 0; # false, does not autovivify
182} 180}
183 181
184sub client_setup { 182sub client_setup {
185 my $dialog = new CFClient::UI::FancyFrame 183 my $dialog = new CFClient::UI::FancyFrame
186 req_x => 1, 184 x => 1,
187 req_y => $HEIGHT * (1/8), 185 y => $HEIGHT * (1/8),
188 name => "client_setup", 186 name => "client_setup",
189 title => "Client Setup", 187 title => "Client Setup",
190 child => (my $vbox = new CFClient::UI::VBox); 188 child => (my $vbox = new CFClient::UI::VBox);
189
191 $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]);
192 191
193 $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");
194 $table->add (1, 0, my $hbox = new CFClient::UI::HBox); 193 $table->add (1, 0, my $hbox = new CFClient::UI::HBox);
195 194
196 $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 expand => 1, force_w => 100, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]);
197 $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");
198 197
199 $mode_slider->connect (changed => sub { 198 $mode_slider->connect (changed => sub {
200 my ($self, $value) = @_; 199 my ($self, $value) = @_;
201 200
389 388
390sub make_gauge_window { 389sub make_gauge_window {
391 my $gh = int $HEIGHT * $CFG->{gauge_size}; 390 my $gh = int $HEIGHT * $CFG->{gauge_size};
392 391
393 my $win = new CFClient::UI::Frame ( 392 my $win = new CFClient::UI::Frame (
394 req_x => 0, 393 force_x => 0,
395 req_y => -1, 394 force_y => "max",
396 def_w => $WIDTH, 395 force_w => $WIDTH,
397 def_h => $gh, 396 force_h => $gh,
398 ); 397 );
399 398
400 $win->add (my $hbox = new CFClient::UI::HBox 399 $win->add (my $hbox = new CFClient::UI::HBox
401 children => [ 400 children => [
402 (new CFClient::UI::HBox expand => 1), 401 (new CFClient::UI::HBox expand => 1),
441} 440}
442 441
443 442
444sub make_stats_window { 443sub make_stats_window {
445 my $tgw = new CFClient::UI::FancyFrame 444 my $tgw = new CFClient::UI::FancyFrame
446 req_y => $HEIGHT * (2/8), 445 y => $HEIGHT * (2/8),
447 req_x => -1, 446 x => "max",
448 title => "Stats", 447 title => "Stats",
449 name => "stats_window"; 448 name => "stats_window";
450 449
451 $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);
452 $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,
453 can_hover => 1, can_events => 1, 452 can_hover => 1, can_events => 1,
454 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.");
717 }); 716 });
718} 717}
719 718
720sub server_setup { 719sub server_setup {
721 my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame 720 my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame
722 x => $WIDTH * (1/3), 721 x => "center",
723 y => $HEIGHT * (1/8), 722 y => "center",
724 name => "server_setup", 723 name => "server_setup",
725 title => "Server Setup", 724 title => "Server Setup",
726 child => (my $vbox = new CFClient::UI::VBox), 725 child => (my $vbox = new CFClient::UI::VBox),
727 on_visibility_change => sub {
728 my ($self, $visible) = @_;
729 $self->center if $visible;
730 },
731 ; 726 ;
732 727
733 $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]);
734 $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");
735 730
781 } 776 }
782 ); 777 );
783 778
784 $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");
785 $table->add (1, 7, new CFClient::UI::Slider 780 $table->add (1, 7, new CFClient::UI::Slider
786 req_w => 100, 781 force_w => 100,
787 range => [$CFG->{mapsize}, 10, 100, 0, 1], 782 range => [$CFG->{mapsize}, 10, 100, 0, 1],
788 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. "
789 . "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, "
790 . "but you also increase bandwidth requirements and latency. " 785 . "but you also increase bandwidth requirements and latency. "
791 . "This option is only used once at log-in.", 786 . "This option is only used once at log-in.",
840 my $window = new CFClient::UI::FancyFrame 835 my $window = new CFClient::UI::FancyFrame
841 name => "message_window", 836 name => "message_window",
842 title => "Messages", 837 title => "Messages",
843 border_bg => [1, 1, 1, 1], 838 border_bg => [1, 1, 1, 1],
844 bg => [0, 0, 0, 0.75], 839 bg => [0, 0, 0, 0.75],
845 req_x => -1, 840 x => "max",
846 req_y => 0, 841 y => 0,
847 def_w => int $::WIDTH / 3, 842 force_w => $::WIDTH / 3,
848 def_h => int $::HEIGHT / 5, 843 force_h => $::HEIGHT / 5,
849 child => (my $vbox = new CFClient::UI::VBox); 844 child => (my $vbox = new CFClient::UI::VBox);
850 845
851 $vbox->add ($LOGVIEW); 846 $vbox->add ($LOGVIEW);
852 847
853 $vbox->add (my $input = new CFClient::UI::Entry 848 $vbox->add (my $input = new CFClient::UI::Entry
887 }, 882 },
888 ); 883 );
889 884
890 $CONSOLE = { 885 $CONSOLE = {
891 window => $window, 886 window => $window,
892 input => $input 887 input => $input,
893 }; 888 };
894 889
895 $window 890 $window
896} 891}
897 892
898sub open_quit_dialog { 893sub open_quit_dialog {
899 unless ($QUIT_DIALOG) { 894 unless ($QUIT_DIALOG) {
900 $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 ;
901 900
902 $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1); 901 $QUIT_DIALOG->add (my $vb = new CFClient::UI::VBox expand => 1);
903 902
904 $vb->add (new CFClient::UI::Label 903 $vb->add (new CFClient::UI::Label
905 text => "You should find a savebed and apply it first!", 904 text => "You should find a savebed and apply it first!",
918 on_activate => sub { exit }, 917 on_activate => sub { exit },
919 ); 918 );
920 } 919 }
921 920
922 $QUIT_DIALOG->show; 921 $QUIT_DIALOG->show;
923 $QUIT_DIALOG->center;
924} 922}
925 923
926sub make_inventory_window { 924sub make_inventory_window {
927 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame 925 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame
926 x => "center",
927 y => "center",
928 def_w => $WIDTH * 7/8, 928 def_w => $WIDTH * 9/10,
929 def_h => $HEIGHT * 7/8, 929 def_h => $HEIGHT * 9/10,
930 title => "Inventory", 930 title => "Inventory",
931 name => "inventory_window", 931 name => "inventory_window",
932 on_visibility_change => sub {
933 my ($self, $visible) = @_;
934 $self->center if $visible;
935 },
936 ; 932 ;
937 933
938 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); 934 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1);
939 935
940 $hb->add (my $vb1 = new CFClient::UI::VBox); 936 $hb->add (my $vb1 = new CFClient::UI::VBox);
979 } 975 }
980 }; 976 };
981 977
982 $BIND_WINDOW = new CFClient::UI::FancyFrame 978 $BIND_WINDOW = new CFClient::UI::FancyFrame
983 title => "Bindings", 979 title => "Bindings",
980 x => "center",
981 y => "center",
984 def_w => int $WIDTH * 7/8, 982 def_w => int $WIDTH * 9/10,
985 def_h => int $HEIGHT * 7/8, 983 def_h => int $HEIGHT * 9/10,
986 on_visibility_change => sub { 984 on_visibility_change => sub {
987 my ($self, $visible) = @_; 985 my ($self, $visible) = @_;
988 if ($visible) { 986 $refresh->() if $visible;
989 $self->center;
990 $refresh->()
991 }
992 }; 987 };
993 988
994 $BIND_WINDOW->add ($binding_list); 989 $BIND_WINDOW->add ($binding_list);
995 $refresh->(); 990 $refresh->();
996 $BIND_WINDOW 991 $BIND_WINDOW
1069 if ($DEBUG_STATUS) { 1064 if ($DEBUG_STATUS) {
1070 CFClient::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h; 1065 CFClient::UI::rescale_widgets $WIDTH / $old_w, $HEIGHT / $old_h;
1071 } else { 1066 } else {
1072 # create the widgets 1067 # create the widgets
1073 1068
1074 $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;
1075 $DEBUG_STATUS->show; 1074 $DEBUG_STATUS->show;
1076 1075
1077 $STATUSBOX = new CFClient::UI::Statusbox; 1076 $STATUSBOX = new CFClient::UI::Statusbox;
1078 $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]);
1079 1078
1080 (new CFClient::UI::Frame 1079 (new CFClient::UI::Frame
1081 bg => [0, 0, 0, 0.4], 1080 bg => [0, 0, 0, 0.4],
1082 req_y => -1, 1081 force_x => 0,
1082 force_y => "max",
1083 child => $STATUSBOX, 1083 child => $STATUSBOX,
1084 )->show; 1084 )->show;
1085 1085
1086 CFClient::UI::FancyFrame->new ( 1086 CFClient::UI::FancyFrame->new (
1087 x => 0,
1088 y => $FONTSIZE + 8,
1087 border_bg => [1, 1, 1, 192/255], 1089 border_bg => [1, 1, 1, 192/255],
1088 bg => [1, 1, 1, 0], 1090 bg => [1, 1, 1, 0],
1089 child => ($MAPMAP = new CFClient::MapWidget::MapMap 1091 child => ($MAPMAP = new CFClient::MapWidget::MapMap
1090 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.",
1091 ), 1093 ),
1114 can_hover => 1, 1116 can_hover => 1,
1115 can_events => 1, 1117 can_events => 1,
1116 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.",
1117 ; 1119 ;
1118 1120
1119 $BUTTONBAR = new CFClient::UI::HBox; 1121 $BUTTONBAR = new CFClient::UI::HBox x => 0, y => 0;
1120 1122
1121 $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,
1122 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.");
1123 $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,
1124 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.");
1164 } 1166 }
1165 }, 1167 },
1166 ); 1168 );
1167 1169
1168 $BUTTONBAR->show; 1170 $BUTTONBAR->show;
1171 $SERVER_SETUP->show;
1169 1172
1170 $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]);
1171
1172 $SERVER_SETUP->show;
1173 } 1174 }
1174} 1175}
1175 1176
1176sub video_shutdown { 1177sub video_shutdown {
1177 undef $SDL_ACTIVE; 1178 undef $SDL_ACTIVE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines