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.35 by elmex, Tue May 30 14:45:56 2006 UTC vs.
Revision 1.43 by elmex, Fri Jun 2 16:27:28 2006 UTC

81our $LOGVIEW; 81our $LOGVIEW;
82our $CONSOLE; 82our $CONSOLE;
83our $METASERVER; 83our $METASERVER;
84our $LOGIN_BUTTON; 84our $LOGIN_BUTTON;
85our $QUIT_DIALOG; 85our $QUIT_DIALOG;
86our $HOST_ENTRY;
86our $SERVER_SETUP; 87our $SERVER_SETUP;
87 88
88our $FLOORBOX; 89our $FLOORBOX;
89our $GAUGES; 90our $GAUGES;
90our $STATWIDS; 91our $STATWIDS;
105our $INVR; 106our $INVR;
106our $INV_RIGHT_HB; 107our $INV_RIGHT_HB;
107 108
108our $BIND_WINDOW; 109our $BIND_WINDOW;
109our $BIND_EDITOR; 110our $BIND_EDITOR;
111
112our $SPELL_LIST;
113our $PICKUP_CFG;
110 114
111sub status { 115sub status {
112 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 116 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
113} 117}
114 118
626 630
627 $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) 631 $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}})
628 for keys %tbl; 632 for keys %tbl;
629} 633}
630 634
631sub metaserver_dialog {
632 my $dialog = new CFClient::UI::FancyFrame
633 title => "Server List",
634 child => (my $vbox = new CFClient::UI::VBox);
635
636 $vbox->add ($dialog->{table} = new CFClient::UI::Table);
637
638 $dialog
639}
640
641my $METASERVER_ATIME; 635my $METASERVER_ATIME;
642 636
643sub update_metaserver { 637sub update_metaserver {
644 my ($HOST) = @_;
645
646 return if $METASERVER_ATIME > time; 638 return if $METASERVER_ATIME > time;
647 $METASERVER_ATIME = time + 60; 639 $METASERVER_ATIME = time + 60;
648 640
649 my $table = $METASERVER->{table}; 641 my $table = $METASERVER->{table};
650 $table->clear; 642 $table->clear;
702 694
703 $y++; 695 $y++;
704 696
705 $table->add (0, $y, new CFClient::UI::VBox children => [ 697 $table->add (0, $y, new CFClient::UI::VBox children => [
706 (new CFClient::UI::Button text => "Use", on_activate => sub { 698 (new CFClient::UI::Button text => "Use", on_activate => sub {
707 $HOST->set_text ($CFG->{host} = $host); 699 $HOST_ENTRY->set_text ($CFG->{host} = $host);
700 $METASERVER->toggle_visibility;
708 }), 701 }),
709 (new CFClient::UI::Empty expand => 1), 702 (new CFClient::UI::Empty expand => 1),
710 ]); 703 ]);
711 704
712 $table->add ($_ + 1, $y, new CFClient::UI::Label 705 $table->add ($_ + 1, $y, new CFClient::UI::Label
715 } 708 }
716 } 709 }
717 }); 710 });
718} 711}
719 712
713sub metaserver_dialog {
714 my $dialog = new CFClient::UI::FancyFrame
715 title => "Server List",
716 name => 'metaserver_dialog',
717 x => 'center',
718 y => 'center',
719 child => (my $vbox = new CFClient::UI::VBox),
720 on_visibility_change => sub {
721 update_metaserver if $_[1];
722 },
723 ;
724
725 $vbox->add ($dialog->{table} = new CFClient::UI::Table);
726
727 $dialog
728}
729
720sub server_setup { 730sub server_setup {
721 my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame 731 my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame
722 x => "center", 732 x => "center",
723 y => "center", 733 y => "center",
724 name => "server_setup", 734 name => "server_setup",
731 741
732 { 742 {
733 $table->add (1, 2, my $vbox = new CFClient::UI::VBox); 743 $table->add (1, 2, my $vbox = new CFClient::UI::VBox);
734 744
735 $vbox->add ( 745 $vbox->add (
736 my $HOST = new CFClient::UI::Entry 746 $HOST_ENTRY = new CFClient::UI::Entry
737 expand => 1, 747 expand => 1,
738 text => $CFG->{host}, 748 text => $CFG->{host},
739 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", 749 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to",
740 on_changed => sub { 750 on_changed => sub {
741 my ($self, $value) = @_; 751 my ($self, $value) = @_;
743 } 753 }
744 ); 754 );
745 755
746 $METASERVER = metaserver_dialog; 756 $METASERVER = metaserver_dialog;
747 757
748 $vbox->add (new CFClient::UI::Flopper 758 $vbox->add (new CFClient::UI::Button
749 expand => 1, 759 expand => 1,
750 text => "Server List", 760 text => "Server List",
751 other => $METASERVER, 761 other => $METASERVER,
752 tooltip => "Show a list of available crossfire servers", 762 tooltip => "Show a list of available crossfire servers",
753 on_open => sub { 763 on_activate => sub { $METASERVER->toggle_visibility },
754 update_metaserver $HOST;
755 }
756 ); 764 );
757 } 765 }
758 766
759 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); 767 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username");
760 $table->add (1, 4, new CFClient::UI::Entry 768 $table->add (1, 4, new CFClient::UI::Entry
923 } 931 }
924 932
925 $QUIT_DIALOG->show; 933 $QUIT_DIALOG->show;
926} 934}
927 935
936sub make_pickup_cfg_window {
937 $PICKUP_CFG = new CFClient::UI::FancyFrame
938 x => "center",
939 y => "center",
940 force_w => $WIDTH * 3/10,
941 force_h => $HEIGHT * 9/10;
942
943 my $tbl = new CFClient::UI::Table;
944 my $tblrow = 0;
945 $PICKUP_CFG->add (my $sw = new CFClient::UI::ScrolledWindow scrolled => $tbl);
946
947 for (
948 ["General"],
949 ["Enable (new) autopickup" => CFClient::Pickup::PU_NEWMODE],
950 ["Inhibit autopickup" => CFClient::Pickup::PU_INHIBIT],
951 ["Stop before pickup" => CFClient::Pickup::PU_STOP],
952 ["Debug autopickup" => CFClient::Pickup::PU_DEBUG],
953 ["Weapons"],
954 ["All weapons" => CFClient::Pickup::PU_ALLWEAPON],
955 ["Missile weapons" => CFClient::Pickup::PU_MISSILEWEAPON],
956 ["Bows" => CFClient::Pickup::PU_BOW],
957 ["Arrows" => CFClient::Pickup::PU_ARROW],
958 ["Armour"],
959 ["Helmets" => CFClient::Pickup::PU_HELMET],
960 ["Shields" => CFClient::Pickup::PU_SHIELD],
961 ["Body Armour" => CFClient::Pickup::PU_ARMOUR],
962 ["Boots" => CFClient::Pickup::PU_BOOTS],
963 ["Gloves" => CFClient::Pickup::PU_GLOVES],
964 ["Cloaks" => CFClient::Pickup::PU_CLOAK],
965 ["Readables"],
966 ["Spellbooks" => CFClient::Pickup::PU_SPELLBOOK],
967 ["Skillscrolls" => CFClient::Pickup::PU_SKILLSCROLL],
968 ["Normal Books/Scrolls" => CFClient::Pickup::PU_READABLES],
969 ["Misc"],
970 ["Food" => CFClient::Pickup::PU_FOOD],
971 ["Drinks" => CFClient::Pickup::PU_DRINK],
972 ["Valuables (Money, Gems)" => CFClient::Pickup::PU_VALUABLES],
973 ["Keys" => CFClient::Pickup::PU_KEY],
974 ["Magical Items" => CFClient::Pickup::PU_MAGICAL],
975 ["Potions" => CFClient::Pickup::PU_POTION],
976 ["Magic Devices" => CFClient::Pickup::PU_MAGIC_DEVICE],
977 ["Ignore cursed" => CFClient::Pickup::PU_NOT_CURSED],
978 ["Jewelery" => CFClient::Pickup::PU_JEWELS],
979 )
980 {
981 unless (defined $_->[1]) {
982 $tbl->add (0, $tblrow++, new CFClient::UI::Label text => $_->[0], align => 0);
983 } else {
984 my $mask = $_->[1];
985 $tbl->add (0, $tblrow, new CFClient::UI::Label text => $_->[0], align => -1);
986 $tbl->add (1, $tblrow++, new CFClient::UI::CheckBox
987 state => $CFG->{pickup} & $mask,
988 on_changed => sub {
989 my ($box, $value) = @_;
990 if ($value) {
991 $CFG->{pickup} |= $mask;
992 } else {
993 $CFG->{pickup} = $CFG->{pickup} & ~$mask;
994 }
995 $::CONN->send (sprintf "command pickup %u", $CFG->{pickup});
996 });
997 }
998 }
999
1000 $PICKUP_CFG
1001}
1002
928sub make_inventory_window { 1003sub make_inventory_window {
929 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame 1004 my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame
930 x => "center", 1005 x => "center",
931 y => "center", 1006 y => "center",
932 force_w => $WIDTH * 9/10, 1007 force_w => $WIDTH * 9/10,
933 force_h => $HEIGHT * 9/10, 1008 force_h => $HEIGHT * 9/10,
934 title => "Inventory", 1009 title => "Inventory",
935 name => "inventory_window",
936 ; 1010 ;
937 1011
938 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); 1012 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1);
939 1013
940 $hb->add (my $vb1 = new CFClient::UI::VBox); 1014 $hb->add (my $vb1 = new CFClient::UI::VBox);
949 1023
950 # XXX: Call after $INVR = ... because set_opencont sets the items 1024 # XXX: Call after $INVR = ... because set_opencont sets the items
951 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); 1025 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor");
952 1026
953 $invwin 1027 $invwin
1028}
1029
1030sub make_spell_list {
1031 $SPELL_LIST = new CFClient::UI::SpellList
1032 force_w => $WIDTH * (9/10),
1033 force_h => $HEIGHT * (9/10);
1034 $SPELL_LIST
954} 1035}
955 1036
956sub make_binding_window { 1037sub make_binding_window {
957 my $binding_list = new CFClient::UI::VBox; 1038 my $binding_list = new CFClient::UI::VBox;
958 1039
1048 $BIND_WINDOW 1129 $BIND_WINDOW
1049} 1130}
1050 1131
1051sub make_help_window { 1132sub make_help_window {
1052 my $win = new CFClient::UI::FancyFrame 1133 my $win = new CFClient::UI::FancyFrame
1134 x => 'center',
1135 y => 'center',
1136 name => 'doc_browser',
1053 def_w => int $WIDTH * 7/8, 1137 force_w => int $WIDTH * 7/8,
1054 def_h => int $HEIGHT * 7/8, 1138 force_h => int $HEIGHT * 7/8,
1055 title => "Documentation"; 1139 title => "Documentation";
1056 1140
1057 $win->add (my $vbox = new CFClient::UI::VBox); 1141 $win->add (my $vbox = new CFClient::UI::VBox);
1058 1142
1059 $vbox->add (my $buttons = new CFClient::UI::HBox); 1143 $vbox->add (my $buttons = new CFClient::UI::HBox);
1060 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); 1144 $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8);
1141 force_y => "max", 1225 force_y => "max",
1142 child => $STATUSBOX, 1226 child => $STATUSBOX,
1143 )->show; 1227 )->show;
1144 1228
1145 CFClient::UI::FancyFrame->new ( 1229 CFClient::UI::FancyFrame->new (
1230 title => "Mini Map",
1231 name => "mapmap",
1146 x => 0, 1232 x => 0,
1147 y => $FONTSIZE + 8, 1233 y => $FONTSIZE + 8,
1148 border_bg => [1, 1, 1, 192/255], 1234 border_bg => [1, 1, 1, 192/255],
1149 bg => [1, 1, 1, 0], 1235 bg => [1, 1, 1, 0],
1150 child => ($MAPMAP = new CFClient::MapWidget::MapMap 1236 child => ($MAPMAP = new CFClient::MapWidget::MapMap
1189 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 1275 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
1190 1276
1191 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, 1277 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window,
1192 tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); 1278 tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times.");
1193 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, 1279 $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window,
1194 tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)."); 1280 tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)."
1281 ."You can also hit the Tab-key to show/hide the Inventory.");
1195 1282
1196 $BUTTONBAR->add (new CFClient::UI::Button 1283 $BUTTONBAR->add (new CFClient::UI::Button
1197 text => "Save Config", 1284 text => "Save Config",
1198 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", 1285 tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.",
1199 on_activate => sub { 1286 on_activate => sub {
1213 "Lets you define, edit and delete bindings." 1300 "Lets you define, edit and delete bindings."
1214 ."There is a shortcut for making bindings: LCTRL+Insert opens the binding editor " 1301 ."There is a shortcut for making bindings: LCTRL+Insert opens the binding editor "
1215 ."with nothing set and the recording started. After doing the actions you " 1302 ."with nothing set and the recording started. After doing the actions you "
1216 ."want to record press Insert and you will be asked to press a key-combo." 1303 ."want to record press Insert and you will be asked to press a key-combo."
1217 ."After pressing the combo the binding will be saved automatically and the " 1304 ."After pressing the combo the binding will be saved automatically and the "
1218 ."binding editor closes" 1305 ."binding editor closes");
1219 ); 1306
1307 $BUTTONBAR->add (new CFClient::UI::Flopper
1308 text => "Spells",
1309 other => make_spell_list,
1310 tooltip => "The spell list");
1311
1312 $BUTTONBAR->add (new CFClient::UI::Flopper
1313 text => "Pickup",
1314 other => make_pickup_cfg_window,
1315 tooltip => "The pickup dialog");
1316
1220 1317
1221 $BUTTONBAR->add (new CFClient::UI::Button 1318 $BUTTONBAR->add (new CFClient::UI::Button
1222 text => "Quit", 1319 text => "Quit",
1223 tooltip => "Terminates the program", 1320 tooltip => "Terminates the program",
1224 on_activate => sub { 1321 on_activate => sub {
1552=head1 USAGE 1649=head1 USAGE
1553 1650
1554cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used 1651cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used
1555fullscreen and interactively. 1652fullscreen and interactively.
1556 1653
1654=head1 DEBUGGING
1655
1656
1657CFPLUS_DEBUG - environment variable
1658
1659 1 draw borders around widgets
1660 2 add low-level widget info to tooltips
1661 4 show fps
1662 8 suppress tooltips
1663
1557=head1 AUTHOR 1664=head1 AUTHOR
1558 1665
1559Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> 1666Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org>
1560 1667
1561 1668

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines