… | |
… | |
97 | |
97 | |
98 | our $ALT_ENTER_MESSAGE; |
98 | our $ALT_ENTER_MESSAGE; |
99 | our $STATUSBOX; |
99 | our $STATUSBOX; |
100 | our $DEBUG_STATUS; |
100 | our $DEBUG_STATUS; |
101 | |
101 | |
102 | our $INVWIN; |
|
|
103 | our $INV; |
102 | our $INV; |
104 | our $INVR; |
103 | our $INVR; |
105 | our $INVR_LBL; |
104 | our $INVR_LBL; |
106 | |
105 | |
107 | sub status { |
106 | sub status { |
… | |
… | |
178 | unless $BUTTONBAR->{children}[1]->{state}; |
177 | unless $BUTTONBAR->{children}[1]->{state}; |
179 | } |
178 | } |
180 | |
179 | |
181 | sub client_setup { |
180 | sub client_setup { |
182 | my $dialog = new CFClient::UI::FancyFrame |
181 | my $dialog = new CFClient::UI::FancyFrame |
|
|
182 | name => "client_setup", |
183 | title => "Client Setup", |
183 | title => "Client Setup", |
184 | child => (my $vbox = new CFClient::UI::VBox); |
184 | child => (my $vbox = new CFClient::UI::VBox); |
185 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
185 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
186 | |
186 | |
187 | $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); |
187 | $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); |
… | |
… | |
255 | state => $CFG->{fow_smooth}, |
255 | state => $CFG->{fow_smooth}, |
256 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.", |
256 | tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.", |
257 | connect_changed => sub { |
257 | connect_changed => sub { |
258 | my ($self, $value) = @_; |
258 | my ($self, $value) = @_; |
259 | $CFG->{fow_smooth} = $value; |
259 | $CFG->{fow_smooth} = $value; |
260 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::GL_VERSION < 1.2; |
260 | status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFClient::OpenGL::GL_VERSION < 1.2; |
261 | } |
261 | } |
262 | ); |
262 | ); |
263 | |
263 | |
264 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
264 | $table->add (0, $row, new CFClient::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
265 | $table->add (1, $row++, new CFClient::UI::Slider |
265 | $table->add (1, $row++, new CFClient::UI::Slider |
… | |
… | |
432 | |
432 | |
433 | $win |
433 | $win |
434 | } |
434 | } |
435 | |
435 | |
436 | sub make_stats_window { |
436 | sub make_stats_window { |
437 | my $tgw = new CFClient::UI::FancyFrame title => "Stats"; |
437 | my $tgw = new CFClient::UI::FancyFrame title => "Stats", name => "stats_window"; |
438 | |
438 | |
439 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
439 | $tgw->add (new CFClient::UI::Window child => my $vb = new CFClient::UI::VBox); |
440 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
440 | $vb->add ($STATWIDS->{title} = new CFClient::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
441 | can_hover => 1, can_events => 1, |
441 | can_hover => 1, can_events => 1, |
442 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
442 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
… | |
… | |
445 | tooltip => "The map you are currently on (if supported by the server)."); |
445 | tooltip => "The map you are currently on (if supported by the server)."); |
446 | |
446 | |
447 | $vb->add (my $hb0 = new CFClient::UI::HBox); |
447 | $vb->add (my $hb0 = new CFClient::UI::HBox); |
448 | $hb0->add ($STATWIDS->{weight} = new CFClient::UI::Label valign => 0, align => -1, text => "Weight:", expand => 1, |
448 | $hb0->add ($STATWIDS->{weight} = new CFClient::UI::Label valign => 0, align => -1, text => "Weight:", expand => 1, |
449 | can_hover => 1, can_events => 1, |
449 | can_hover => 1, can_events => 1, |
450 | tooltip => "This is the amount the Player weights."); |
450 | tooltip => "The weight of the player including all inventory items."); |
451 | $hb0->add ($STATWIDS->{m_weight} = new CFClient::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1, |
451 | $hb0->add ($STATWIDS->{m_weight} = new CFClient::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1, |
452 | can_hover => 1, can_events => 1, |
452 | can_hover => 1, can_events => 1, |
453 | tooltip => "The weight limit, you can't carry more than this."); |
453 | tooltip => "The weight limit: you cannot carry more than this."); |
454 | |
454 | |
455 | |
455 | |
456 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
456 | $vb->add (my $hb = new CFClient::UI::HBox expand => 1); |
457 | $hb->add (my $tbl = new CFClient::UI::Table expand => 1); |
457 | $hb->add (my $tbl = new CFClient::UI::Table expand => 1); |
458 | |
458 | |
… | |
… | |
705 | }); |
705 | }); |
706 | } |
706 | } |
707 | |
707 | |
708 | sub server_setup { |
708 | sub server_setup { |
709 | my $dialog = new CFClient::UI::FancyFrame |
709 | my $dialog = new CFClient::UI::FancyFrame |
|
|
710 | name => "server_setup", |
710 | title => "Server Setup", |
711 | title => "Server Setup", |
711 | child => (my $vbox = new CFClient::UI::VBox); |
712 | child => (my $vbox = new CFClient::UI::VBox); |
712 | |
713 | |
713 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
714 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
714 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
715 | $table->add (0, 2, new CFClient::UI::Label valign => 0, align => 1, text => "Host:Port"); |
… | |
… | |
816 | $dialog |
817 | $dialog |
817 | } |
818 | } |
818 | |
819 | |
819 | sub message_window { |
820 | sub message_window { |
820 | my $window = new CFClient::UI::FancyFrame |
821 | my $window = new CFClient::UI::FancyFrame |
|
|
822 | name => "message_window", |
821 | title => "Messages", |
823 | title => "Messages", |
822 | border_bg => [1, 1, 1, 1], |
824 | border_bg => [1, 1, 1, 1], |
823 | bg => [0, 0, 0, 0.75], |
825 | bg => [0, 0, 0, 0.75], |
824 | user_w => int $::WIDTH / 3, |
826 | user_w => int $::WIDTH / 3, |
825 | user_h => int $::HEIGHT / 5, |
827 | user_h => int $::HEIGHT / 5, |
… | |
… | |
900 | } |
902 | } |
901 | } |
903 | } |
902 | |
904 | |
903 | sub make_inventory_window { |
905 | sub make_inventory_window { |
904 | my $invwin = new CFClient::UI::FancyFrame |
906 | my $invwin = new CFClient::UI::FancyFrame |
905 | user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Inventory"; |
907 | user_w => $WIDTH * (7/8), user_h => $HEIGHT * (7/8), title => "Inventory", name => "inventory_window"; |
906 | |
908 | |
907 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
909 | $invwin->add (my $hb = new CFClient::UI::HBox expand => 1); |
908 | |
910 | |
909 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
911 | $hb->add (my $vb1 = new CFClient::UI::VBox expand => 1); |
910 | $vb1->add (my $lbl = new CFClient::UI::Label xalign => 0.5); |
912 | $vb1->add (my $lbl = new CFClient::UI::Label align => 0); |
911 | $lbl->set_text ("Player"); |
913 | $lbl->set_text ("Player"); |
912 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
914 | $vb1->add ($INV = new CFClient::UI::Inventory expand => 1); |
913 | |
915 | |
914 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
916 | $hb->add (my $vb2 = new CFClient::UI::VBox expand => 1); |
|
|
917 | |
|
|
918 | $vb2->add (my $hb2 = new CFClient::UI::HBox); |
915 | $vb2->add ($INVR_LBL = new CFClient::UI::Label xalign => 0.5); |
919 | $hb2->add ($INVR_LBL = new CFClient::UI::Label align => 0, expand => 1); |
|
|
920 | $hb2->add (new CFClient::UI::Button |
|
|
921 | text => "Close", |
|
|
922 | tooltip => "Close the currently open container (if one is open)", |
|
|
923 | connect_activate => sub { |
|
|
924 | $CONN->send ("apply $CONN->{open_container}") |
|
|
925 | if $CONN->{open_container} != 0; |
|
|
926 | }, |
|
|
927 | ); |
|
|
928 | |
916 | $INVR_LBL->set_text ("Floor"); |
929 | $INVR_LBL->set_text ("Floor"); |
917 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
930 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
918 | |
931 | |
919 | $invwin |
932 | $invwin |
920 | } |
933 | } |
… | |
… | |
1055 | |
1068 | |
1056 | $BUTTONBAR->add (new CFClient::UI::Button |
1069 | $BUTTONBAR->add (new CFClient::UI::Button |
1057 | text => "Save Config", |
1070 | text => "Save Config", |
1058 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1071 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1059 | connect_activate => sub { |
1072 | connect_activate => sub { |
|
|
1073 | $::CFG->{layout} = CFClient::UI::get_layout; |
1060 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
1074 | CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; |
1061 | status "Configuration Saved"; |
1075 | status "Configuration Saved"; |
1062 | }, |
1076 | }, |
1063 | ); |
1077 | ); |
1064 | |
1078 | |
… | |
… | |
1308 | |
1322 | |
1309 | { |
1323 | { |
1310 | local $SIG{__DIE__} = sub { CFClient::fatal $_[0] }; |
1324 | local $SIG{__DIE__} = sub { CFClient::fatal $_[0] }; |
1311 | |
1325 | |
1312 | CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; |
1326 | CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; |
|
|
1327 | CFClient::UI::set_layout ($::CFG->{layout}); |
1313 | |
1328 | |
1314 | my %DEF_CFG = ( |
1329 | my %DEF_CFG = ( |
1315 | sdl_mode => 0, |
1330 | sdl_mode => 0, |
1316 | width => 640, |
1331 | width => 640, |
1317 | height => 480, |
1332 | height => 480, |