… | |
… | |
81 | our $LOGVIEW; |
81 | our $LOGVIEW; |
82 | our $CONSOLE; |
82 | our $CONSOLE; |
83 | our $METASERVER; |
83 | our $METASERVER; |
84 | our $LOGIN_BUTTON; |
84 | our $LOGIN_BUTTON; |
85 | our $QUIT_DIALOG; |
85 | our $QUIT_DIALOG; |
|
|
86 | our $HOST_ENTRY; |
86 | our $SERVER_SETUP; |
87 | our $SERVER_SETUP; |
87 | |
88 | |
88 | our $FLOORBOX; |
89 | our $FLOORBOX; |
89 | our $GAUGES; |
90 | our $GAUGES; |
90 | our $STATWIDS; |
91 | our $STATWIDS; |
… | |
… | |
105 | our $INVR; |
106 | our $INVR; |
106 | our $INV_RIGHT_HB; |
107 | our $INV_RIGHT_HB; |
107 | |
108 | |
108 | our $BIND_WINDOW; |
109 | our $BIND_WINDOW; |
109 | our $BIND_EDITOR; |
110 | our $BIND_EDITOR; |
|
|
111 | |
|
|
112 | our $SPELL_LIST; |
110 | |
113 | |
111 | sub status { |
114 | sub 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 | |
631 | sub 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 | |
|
|
641 | my $METASERVER_ATIME; |
634 | my $METASERVER_ATIME; |
642 | |
635 | |
643 | sub update_metaserver { |
636 | sub 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 | |
|
|
712 | sub metaserver_dialog { |
|
|
713 | my $dialog = new CFClient::UI::FancyFrame |
|
|
714 | title => "Server List", |
|
|
715 | name => 'metaserver_dialog', |
|
|
716 | x => 'center', |
|
|
717 | y => 'center', |
|
|
718 | child => (my $vbox = new CFClient::UI::VBox), |
|
|
719 | on_visibility_change => sub { |
|
|
720 | update_metaserver if $_[1]; |
|
|
721 | }, |
|
|
722 | ; |
|
|
723 | |
|
|
724 | $vbox->add ($dialog->{table} = new CFClient::UI::Table); |
|
|
725 | |
|
|
726 | $dialog |
|
|
727 | } |
|
|
728 | |
720 | sub server_setup { |
729 | sub server_setup { |
721 | my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame |
730 | my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame |
722 | x => "center", |
731 | x => "center", |
723 | y => "center", |
732 | y => "center", |
724 | name => "server_setup", |
733 | name => "server_setup", |
… | |
… | |
731 | |
740 | |
732 | { |
741 | { |
733 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
742 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
734 | |
743 | |
735 | $vbox->add ( |
744 | $vbox->add ( |
736 | my $HOST = new CFClient::UI::Entry |
745 | $HOST_ENTRY = new CFClient::UI::Entry |
737 | expand => 1, |
746 | expand => 1, |
738 | text => $CFG->{host}, |
747 | text => $CFG->{host}, |
739 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
748 | tooltip => "The hostname or ip address of the Crossfire(+) server to connect to", |
740 | on_changed => sub { |
749 | on_changed => sub { |
741 | my ($self, $value) = @_; |
750 | my ($self, $value) = @_; |
… | |
… | |
743 | } |
752 | } |
744 | ); |
753 | ); |
745 | |
754 | |
746 | $METASERVER = metaserver_dialog; |
755 | $METASERVER = metaserver_dialog; |
747 | |
756 | |
748 | $vbox->add (new CFClient::UI::Flopper |
757 | $vbox->add (new CFClient::UI::Button |
749 | expand => 1, |
758 | expand => 1, |
750 | text => "Server List", |
759 | text => "Server List", |
751 | other => $METASERVER, |
760 | other => $METASERVER, |
752 | tooltip => "Show a list of available crossfire servers", |
761 | tooltip => "Show a list of available crossfire servers", |
753 | on_open => sub { |
762 | on_activate => sub { $METASERVER->toggle_visibility }, |
754 | update_metaserver $HOST; |
|
|
755 | } |
|
|
756 | ); |
763 | ); |
757 | } |
764 | } |
758 | |
765 | |
759 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
766 | $table->add (0, 4, new CFClient::UI::Label valign => 0, align => 1, text => "Username"); |
760 | $table->add (1, 4, new CFClient::UI::Entry |
767 | $table->add (1, 4, new CFClient::UI::Entry |
… | |
… | |
948 | |
955 | |
949 | # XXX: Call after $INVR = ... because set_opencont sets the items |
956 | # XXX: Call after $INVR = ... because set_opencont sets the items |
950 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
957 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
951 | |
958 | |
952 | $invwin |
959 | $invwin |
|
|
960 | } |
|
|
961 | |
|
|
962 | sub make_spell_list { |
|
|
963 | $SPELL_LIST = new CFClient::UI::SpellList |
|
|
964 | force_w => $WIDTH * (9/10), |
|
|
965 | force_h => $HEIGHT * (9/10); |
|
|
966 | $SPELL_LIST |
953 | } |
967 | } |
954 | |
968 | |
955 | sub make_binding_window { |
969 | sub make_binding_window { |
956 | my $binding_list = new CFClient::UI::VBox; |
970 | my $binding_list = new CFClient::UI::VBox; |
957 | |
971 | |
… | |
… | |
1047 | $BIND_WINDOW |
1061 | $BIND_WINDOW |
1048 | } |
1062 | } |
1049 | |
1063 | |
1050 | sub make_help_window { |
1064 | sub make_help_window { |
1051 | my $win = new CFClient::UI::FancyFrame |
1065 | my $win = new CFClient::UI::FancyFrame |
|
|
1066 | x => 'center', |
|
|
1067 | y => 'center', |
|
|
1068 | name => 'doc_browser', |
1052 | def_w => int $WIDTH * 7/8, |
1069 | force_w => int $WIDTH * 7/8, |
1053 | def_h => int $HEIGHT * 7/8, |
1070 | force_h => int $HEIGHT * 7/8, |
1054 | title => "Documentation"; |
1071 | title => "Documentation"; |
1055 | |
1072 | |
1056 | $win->add (my $vbox = new CFClient::UI::VBox); |
1073 | $win->add (my $vbox = new CFClient::UI::VBox); |
1057 | |
1074 | |
1058 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1075 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1059 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
1076 | $vbox->add (my $viewer = new CFClient::UI::TextView expand => 1, fontsize => 0.8); |
… | |
… | |
1213 | "Lets you define, edit and delete bindings." |
1230 | "Lets you define, edit and delete bindings." |
1214 | ."There is a shortcut for making bindings: LCTRL+Insert opens the binding editor " |
1231 | ."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 " |
1232 | ."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." |
1233 | ."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 " |
1234 | ."After pressing the combo the binding will be saved automatically and the " |
1218 | ."binding editor closes" |
1235 | ."binding editor closes"); |
1219 | ); |
1236 | |
|
|
1237 | $BUTTONBAR->add (new CFClient::UI::Flopper |
|
|
1238 | text => "Spells", |
|
|
1239 | other => make_spell_list, |
|
|
1240 | tooltip => "The spell list"); |
1220 | |
1241 | |
1221 | $BUTTONBAR->add (new CFClient::UI::Button |
1242 | $BUTTONBAR->add (new CFClient::UI::Button |
1222 | text => "Quit", |
1243 | text => "Quit", |
1223 | tooltip => "Terminates the program", |
1244 | tooltip => "Terminates the program", |
1224 | on_activate => sub { |
1245 | on_activate => sub { |
… | |
… | |
1552 | =head1 USAGE |
1573 | =head1 USAGE |
1553 | |
1574 | |
1554 | cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used |
1575 | cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used |
1555 | fullscreen and interactively. |
1576 | fullscreen and interactively. |
1556 | |
1577 | |
|
|
1578 | =head1 DEBUGGING |
|
|
1579 | |
|
|
1580 | |
|
|
1581 | CFPLUS_DEBUG - environment variable |
|
|
1582 | |
|
|
1583 | 1 draw borders around widgets |
|
|
1584 | 2 add low-level widget info to tooltips |
|
|
1585 | 4 show fps |
|
|
1586 | 8 suppress tooltips |
|
|
1587 | |
1557 | =head1 AUTHOR |
1588 | =head1 AUTHOR |
1558 | |
1589 | |
1559 | Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
1590 | Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
1560 | |
1591 | |
1561 | |
1592 | |