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.36 by elmex, Tue May 30 14:59:26 2006 UTC vs.
Revision 1.40 by root, Fri Jun 2 02:12:04 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;
110 113
111sub status { 114sub status {
112 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); 115 $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]);
113} 116}
114 117
626 629
627 $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) 630 $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}})
628 for keys %tbl; 631 for keys %tbl;
629} 632}
630 633
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; 634my $METASERVER_ATIME;
642 635
643sub update_metaserver { 636sub update_metaserver {
644 my ($HOST) = @_;
645
646 return if $METASERVER_ATIME > time; 637 return if $METASERVER_ATIME > time;
647 $METASERVER_ATIME = time + 60; 638 $METASERVER_ATIME = time + 60;
648 639
649 my $table = $METASERVER->{table}; 640 my $table = $METASERVER->{table};
650 $table->clear; 641 $table->clear;
702 693
703 $y++; 694 $y++;
704 695
705 $table->add (0, $y, new CFClient::UI::VBox children => [ 696 $table->add (0, $y, new CFClient::UI::VBox children => [
706 (new CFClient::UI::Button text => "Use", on_activate => sub { 697 (new CFClient::UI::Button text => "Use", on_activate => sub {
707 $HOST->set_text ($CFG->{host} = $host); 698 $HOST_ENTRY->set_text ($CFG->{host} = $host);
699 $METASERVER->toggle_visibility;
708 }), 700 }),
709 (new CFClient::UI::Empty expand => 1), 701 (new CFClient::UI::Empty expand => 1),
710 ]); 702 ]);
711 703
712 $table->add ($_ + 1, $y, new CFClient::UI::Label 704 $table->add ($_ + 1, $y, new CFClient::UI::Label
715 } 707 }
716 } 708 }
717 }); 709 });
718} 710}
719 711
712sub metaserver_dialog {
713 my $dialog = new CFClient::UI::FancyFrame
714 title => "Server List",
715 x => 'center',
716 y => 'center',
717 child => (my $vbox = new CFClient::UI::VBox),
718 on_visibility_change => sub {
719 update_metaserver if $_[1];
720 },
721 ;
722
723 $vbox->add ($dialog->{table} = new CFClient::UI::Table);
724
725 $dialog
726}
727
720sub server_setup { 728sub server_setup {
721 my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame 729 my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame
722 x => "center", 730 x => "center",
723 y => "center", 731 y => "center",
724 name => "server_setup", 732 name => "server_setup",
731 739
732 { 740 {
733 $table->add (1, 2, my $vbox = new CFClient::UI::VBox); 741 $table->add (1, 2, my $vbox = new CFClient::UI::VBox);
734 742
735 $vbox->add ( 743 $vbox->add (
736 my $HOST = new CFClient::UI::Entry 744 $HOST_ENTRY = new CFClient::UI::Entry
737 expand => 1, 745 expand => 1,
738 text => $CFG->{host}, 746 text => $CFG->{host},
739 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", 747 tooltip => "The hostname or ip address of the Crossfire(+) server to connect to",
740 on_changed => sub { 748 on_changed => sub {
741 my ($self, $value) = @_; 749 my ($self, $value) = @_;
743 } 751 }
744 ); 752 );
745 753
746 $METASERVER = metaserver_dialog; 754 $METASERVER = metaserver_dialog;
747 755
748 $vbox->add (new CFClient::UI::Flopper 756 $vbox->add (new CFClient::UI::Button
749 expand => 1, 757 expand => 1,
750 text => "Server List", 758 text => "Server List",
751 other => $METASERVER, 759 other => $METASERVER,
752 tooltip => "Show a list of available crossfire servers", 760 tooltip => "Show a list of available crossfire servers",
753 on_open => sub { 761 on_activate => sub { $METASERVER->toggle_visibility },
754 update_metaserver $HOST;
755 }
756 ); 762 );
757 } 763 }
758 764
759 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); 765 $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username");
760 $table->add (1, 4, new CFClient::UI::Entry 766 $table->add (1, 4, new CFClient::UI::Entry
930 x => "center", 936 x => "center",
931 y => "center", 937 y => "center",
932 force_w => $WIDTH * 9/10, 938 force_w => $WIDTH * 9/10,
933 force_h => $HEIGHT * 9/10, 939 force_h => $HEIGHT * 9/10,
934 title => "Inventory", 940 title => "Inventory",
935 name => "inventory_window",
936 ; 941 ;
937 942
938 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); 943 $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1);
939 944
940 $hb->add (my $vb1 = new CFClient::UI::VBox); 945 $hb->add (my $vb1 = new CFClient::UI::VBox);
949 954
950 # XXX: Call after $INVR = ... because set_opencont sets the items 955 # XXX: Call after $INVR = ... because set_opencont sets the items
951 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); 956 CFClient::Protocol::set_opencont ($::CONN, 0, "Floor");
952 957
953 $invwin 958 $invwin
959}
960
961sub make_spell_list {
962 $SPELL_LIST = new CFClient::UI::SpellList
963 force_w => $WIDTH * (9/10),
964 force_h => $HEIGHT * (9/10);
965 $SPELL_LIST
954} 966}
955 967
956sub make_binding_window { 968sub make_binding_window {
957 my $binding_list = new CFClient::UI::VBox; 969 my $binding_list = new CFClient::UI::VBox;
958 970
1214 "Lets you define, edit and delete bindings." 1226 "Lets you define, edit and delete bindings."
1215 ."There is a shortcut for making bindings: LCTRL+Insert opens the binding editor " 1227 ."There is a shortcut for making bindings: LCTRL+Insert opens the binding editor "
1216 ."with nothing set and the recording started. After doing the actions you " 1228 ."with nothing set and the recording started. After doing the actions you "
1217 ."want to record press Insert and you will be asked to press a key-combo." 1229 ."want to record press Insert and you will be asked to press a key-combo."
1218 ."After pressing the combo the binding will be saved automatically and the " 1230 ."After pressing the combo the binding will be saved automatically and the "
1219 ."binding editor closes" 1231 ."binding editor closes");
1220 ); 1232
1233 $BUTTONBAR->add (new CFClient::UI::Flopper
1234 text => "Spells",
1235 other => make_spell_list,
1236 tooltip => "The spell list");
1221 1237
1222 $BUTTONBAR->add (new CFClient::UI::Button 1238 $BUTTONBAR->add (new CFClient::UI::Button
1223 text => "Quit", 1239 text => "Quit",
1224 tooltip => "Terminates the program", 1240 tooltip => "Terminates the program",
1225 on_activate => sub { 1241 on_activate => sub {
1553=head1 USAGE 1569=head1 USAGE
1554 1570
1555cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used 1571cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used
1556fullscreen and interactively. 1572fullscreen and interactively.
1557 1573
1574=head1 DEBUGGING
1575
1576
1577CFPLUS_DEBUG - environment variable
1578
1579 1 draw borders around widgets
1580 2 add low-level widget info to tooltips
1581 4 show fps
1582 8 suppress tooltips
1583
1558=head1 AUTHOR 1584=head1 AUTHOR
1559 1585
1560Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> 1586Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org>
1561 1587
1562 1588

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines