… | |
… | |
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; |
… | |
… | |
104 | our $INV; |
105 | our $INV; |
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; |
|
|
110 | our $BIND_EDITOR; |
|
|
111 | |
|
|
112 | our $SPELL_LIST; |
109 | |
113 | |
110 | sub status { |
114 | sub status { |
111 | $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]); |
112 | } |
116 | } |
113 | |
117 | |
… | |
… | |
190 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
194 | $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); |
191 | |
195 | |
192 | $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); |
196 | $table->add (0, 0, new CFClient::UI::Label valign => 0, align => 1, text => "Video Mode"); |
193 | $table->add (1, 0, my $hbox = new CFClient::UI::HBox); |
197 | $table->add (1, 0, my $hbox = new CFClient::UI::HBox); |
194 | |
198 | |
195 | $hbox->add (my $mode_slider = new CFClient::UI::Slider expand => 1, force_w => 100, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]); |
199 | $hbox->add (my $mode_slider = new CFClient::UI::Slider force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]); |
196 | $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); |
200 | $hbox->add (my $mode_label = new CFClient::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); |
197 | |
201 | |
198 | $mode_slider->connect (changed => sub { |
202 | $mode_slider->connect (changed => sub { |
199 | my ($self, $value) = @_; |
203 | my ($self, $value) = @_; |
200 | |
204 | |
… | |
… | |
625 | |
629 | |
626 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
630 | $STATWIDS->{"res_$_"}->set_text (sprintf "%d%", $stats->{$tbl{$_}}) |
627 | for keys %tbl; |
631 | for keys %tbl; |
628 | } |
632 | } |
629 | |
633 | |
630 | sub metaserver_dialog { |
|
|
631 | my $dialog = new CFClient::UI::FancyFrame |
|
|
632 | title => "Server List", |
|
|
633 | child => (my $vbox = new CFClient::UI::VBox); |
|
|
634 | |
|
|
635 | $vbox->add ($dialog->{table} = new CFClient::UI::Table); |
|
|
636 | |
|
|
637 | $dialog |
|
|
638 | } |
|
|
639 | |
|
|
640 | my $METASERVER_ATIME; |
634 | my $METASERVER_ATIME; |
641 | |
635 | |
642 | sub update_metaserver { |
636 | sub update_metaserver { |
643 | my ($HOST) = @_; |
|
|
644 | |
|
|
645 | return if $METASERVER_ATIME > time; |
637 | return if $METASERVER_ATIME > time; |
646 | $METASERVER_ATIME = time + 60; |
638 | $METASERVER_ATIME = time + 60; |
647 | |
639 | |
648 | my $table = $METASERVER->{table}; |
640 | my $table = $METASERVER->{table}; |
649 | $table->clear; |
641 | $table->clear; |
… | |
… | |
701 | |
693 | |
702 | $y++; |
694 | $y++; |
703 | |
695 | |
704 | $table->add (0, $y, new CFClient::UI::VBox children => [ |
696 | $table->add (0, $y, new CFClient::UI::VBox children => [ |
705 | (new CFClient::UI::Button text => "Use", on_activate => sub { |
697 | (new CFClient::UI::Button text => "Use", on_activate => sub { |
706 | $HOST->set_text ($CFG->{host} = $host); |
698 | $HOST_ENTRY->set_text ($CFG->{host} = $host); |
|
|
699 | $METASERVER->toggle_visibility; |
707 | }), |
700 | }), |
708 | (new CFClient::UI::Empty expand => 1), |
701 | (new CFClient::UI::Empty expand => 1), |
709 | ]); |
702 | ]); |
710 | |
703 | |
711 | $table->add ($_ + 1, $y, new CFClient::UI::Label |
704 | $table->add ($_ + 1, $y, new CFClient::UI::Label |
… | |
… | |
714 | } |
707 | } |
715 | } |
708 | } |
716 | }); |
709 | }); |
717 | } |
710 | } |
718 | |
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 | |
719 | sub server_setup { |
729 | sub server_setup { |
720 | my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame |
730 | my $dialog = $SERVER_SETUP = new CFClient::UI::FancyFrame |
721 | x => "center", |
731 | x => "center", |
722 | y => "center", |
732 | y => "center", |
723 | name => "server_setup", |
733 | name => "server_setup", |
… | |
… | |
730 | |
740 | |
731 | { |
741 | { |
732 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
742 | $table->add (1, 2, my $vbox = new CFClient::UI::VBox); |
733 | |
743 | |
734 | $vbox->add ( |
744 | $vbox->add ( |
735 | my $HOST = new CFClient::UI::Entry |
745 | $HOST_ENTRY = new CFClient::UI::Entry |
736 | expand => 1, |
746 | expand => 1, |
737 | text => $CFG->{host}, |
747 | text => $CFG->{host}, |
738 | 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", |
739 | on_changed => sub { |
749 | on_changed => sub { |
740 | my ($self, $value) = @_; |
750 | my ($self, $value) = @_; |
… | |
… | |
742 | } |
752 | } |
743 | ); |
753 | ); |
744 | |
754 | |
745 | $METASERVER = metaserver_dialog; |
755 | $METASERVER = metaserver_dialog; |
746 | |
756 | |
747 | $vbox->add (new CFClient::UI::Flopper |
757 | $vbox->add (new CFClient::UI::Button |
748 | expand => 1, |
758 | expand => 1, |
749 | text => "Server List", |
759 | text => "Server List", |
750 | other => $METASERVER, |
760 | other => $METASERVER, |
751 | tooltip => "Show a list of available crossfire servers", |
761 | tooltip => "Show a list of available crossfire servers", |
752 | on_open => sub { |
762 | on_activate => sub { $METASERVER->toggle_visibility }, |
753 | update_metaserver $HOST; |
|
|
754 | } |
|
|
755 | ); |
763 | ); |
756 | } |
764 | } |
757 | |
765 | |
758 | $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"); |
759 | $table->add (1, 4, new CFClient::UI::Entry |
767 | $table->add (1, 4, new CFClient::UI::Entry |
… | |
… | |
863 | on_activate => sub { |
871 | on_activate => sub { |
864 | my ($input, $text) = @_; |
872 | my ($input, $text) = @_; |
865 | $input->set_text (''); |
873 | $input->set_text (''); |
866 | |
874 | |
867 | if ($text =~ /^\/bind\s+(.*)$/) { |
875 | if ($text =~ /^\/bind\s+(.*)$/) { |
868 | CFClient::Recorder::open_binding_dialog ([$1]); |
876 | CFClient::Binder::open_binding_dialog (sub { |
|
|
877 | my ($mod, $sym) = @_; |
|
|
878 | $::CFG->{bindings}->{$mod}->{$sym} = [$1]; |
|
|
879 | }); |
869 | } elsif ($text =~ /^\/(.*)/) { |
880 | } elsif ($text =~ /^\/(.*)/) { |
870 | $::CONN->user_send ($1); |
881 | $::CONN->user_send ($1); |
871 | } else { |
882 | } else { |
872 | my $say_cmd = $::CFG->{say_command} || 'say'; |
883 | my $say_cmd = $::CFG->{say_command} || 'say'; |
873 | $::CONN->user_send ("$say_cmd $text"); |
884 | $::CONN->user_send ("$say_cmd $text"); |
… | |
… | |
921 | $QUIT_DIALOG->show; |
932 | $QUIT_DIALOG->show; |
922 | } |
933 | } |
923 | |
934 | |
924 | sub make_inventory_window { |
935 | sub make_inventory_window { |
925 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
936 | my $invwin = $INV_WINDOW = new CFClient::UI::FancyFrame |
926 | x => "center", |
937 | x => "center", |
927 | y => "center", |
938 | y => "center", |
928 | def_w => $WIDTH * 9/10, |
939 | force_w => $WIDTH * 9/10, |
929 | def_h => $HEIGHT * 9/10, |
940 | force_h => $HEIGHT * 9/10, |
930 | title => "Inventory", |
941 | title => "Inventory", |
931 | name => "inventory_window", |
|
|
932 | ; |
942 | ; |
933 | |
943 | |
934 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
944 | $invwin->add (my $hb = new CFClient::UI::HBox homogeneous => 1); |
935 | |
945 | |
936 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
946 | $hb->add (my $vb1 = new CFClient::UI::VBox); |
… | |
… | |
947 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
957 | CFClient::Protocol::set_opencont ($::CONN, 0, "Floor"); |
948 | |
958 | |
949 | $invwin |
959 | $invwin |
950 | } |
960 | } |
951 | |
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 |
|
|
967 | } |
|
|
968 | |
952 | sub make_binding_window { |
969 | sub make_binding_window { |
953 | my $binding_list = new CFClient::UI::VBox; |
970 | my $binding_list = new CFClient::UI::VBox; |
954 | |
971 | |
|
|
972 | my $refresh; |
955 | my $refresh = sub { |
973 | $refresh = sub { |
956 | $binding_list->clear (); |
974 | $binding_list->clear (); |
957 | |
975 | |
958 | for my $mod (keys %{$::CFG->{bindings}}) { |
976 | for my $mod (keys %{$::CFG->{bindings}}) { |
959 | for my $sym (keys %{$::CFG->{bindings}->{$mod}}) { |
977 | for my $sym (keys %{$::CFG->{bindings}->{$mod}}) { |
960 | my $cmds = $::CFG->{bindings}->{$mod}->{$sym}; |
978 | my $cmds = $::CFG->{bindings}->{$mod}->{$sym}; |
961 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
979 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
962 | |
980 | |
963 | my $lbl = join "; ", @$cmds; |
981 | my $lbl = join "; ", @$cmds; |
964 | my $nam = CFClient::Recorder::keycombo_to_name ($mod, $sym); |
982 | my $nam = CFClient::Binder::keycombo_to_name ($mod, $sym); |
965 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
983 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
966 | $hb->add (new CFClient::UI::Button |
984 | $hb->add (new CFClient::UI::Button |
967 | text => "delete", |
985 | text => "delete", |
|
|
986 | tooltip => "Deletes the binding", |
968 | on_activate => sub { |
987 | on_activate => sub { |
969 | $binding_list->remove ($hb); |
988 | $binding_list->remove ($hb); |
970 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
989 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
971 | }); |
990 | }); |
|
|
991 | |
|
|
992 | $hb->add (new CFClient::UI::Button |
|
|
993 | text => "edit", |
|
|
994 | tooltip => "Edits the binding", |
|
|
995 | on_activate => sub { |
|
|
996 | $::BIND_EDITOR->set_binding ( |
|
|
997 | $mod, $sym, $::CFG->{bindings}->{$mod}->{$sym}, |
|
|
998 | sub { |
|
|
999 | my ($nmod, $nsym, $ncmds) = @_; |
|
|
1000 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
|
|
1001 | $::CFG->{bindings}->{$nmod}->{$nsym} = $ncmds; |
|
|
1002 | $refresh->(); |
|
|
1003 | $::BIND_WINDOW->show; |
|
|
1004 | }, |
|
|
1005 | sub { |
|
|
1006 | $::BIND_WINDOW->show; |
|
|
1007 | }); |
|
|
1008 | $::BIND_EDITOR->show; |
|
|
1009 | $::BIND_WINDOW->hide; |
|
|
1010 | }); |
|
|
1011 | |
972 | $hb->add (new CFClient::UI::Label text => "($nam)"); |
1012 | $hb->add (new CFClient::UI::Label text => "(Key: $nam)"); |
973 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
1013 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
974 | } |
1014 | } |
975 | } |
1015 | } |
976 | }; |
1016 | }; |
977 | |
1017 | |
… | |
… | |
984 | on_visibility_change => sub { |
1024 | on_visibility_change => sub { |
985 | my ($self, $visible) = @_; |
1025 | my ($self, $visible) = @_; |
986 | $refresh->() if $visible; |
1026 | $refresh->() if $visible; |
987 | }; |
1027 | }; |
988 | |
1028 | |
|
|
1029 | $BIND_WINDOW->add (my $vb = new CFClient::UI::VBox); |
989 | $BIND_WINDOW->add ($binding_list); |
1030 | $vb->add ($binding_list); |
|
|
1031 | $vb->add (my $hb = new CFClient::UI::HBox); |
|
|
1032 | $hb->add (new CFClient::UI::Button |
|
|
1033 | text => "record new", |
|
|
1034 | expand => 1, |
|
|
1035 | tooltip => "This button opens the binding editor with an empty binding.", |
|
|
1036 | on_activate => sub { |
|
|
1037 | $::BIND_EDITOR->set_binding (undef, undef, [], |
|
|
1038 | sub { |
|
|
1039 | my ($mod, $sym, $cmds) = @_; |
|
|
1040 | $::CFG->{bindings}->{$mod}->{$sym} = $cmds; |
|
|
1041 | $refresh->(); |
|
|
1042 | $::BIND_WINDOW->show; |
|
|
1043 | }, |
|
|
1044 | sub { |
|
|
1045 | $::BIND_WINDOW->show; |
|
|
1046 | }); |
|
|
1047 | $::BIND_WINDOW->hide; |
|
|
1048 | $::BIND_EDITOR->show; |
|
|
1049 | }, |
|
|
1050 | ); |
|
|
1051 | $hb->add (new CFClient::UI::Button |
|
|
1052 | text => "close", |
|
|
1053 | tooltip => "Closes the binding window", |
|
|
1054 | expand => 1, |
|
|
1055 | on_activate => sub { |
|
|
1056 | $::BIND_WINDOW->hide; |
|
|
1057 | } |
|
|
1058 | ); |
|
|
1059 | |
990 | $refresh->(); |
1060 | $refresh->(); |
991 | $BIND_WINDOW |
1061 | $BIND_WINDOW |
992 | } |
1062 | } |
993 | |
1063 | |
994 | sub make_help_window { |
1064 | sub make_help_window { |
995 | my $win = new CFClient::UI::FancyFrame |
1065 | my $win = new CFClient::UI::FancyFrame |
|
|
1066 | x => 'center', |
|
|
1067 | y => 'center', |
|
|
1068 | name => 'doc_browser', |
996 | def_w => int $WIDTH * 7/8, |
1069 | force_w => int $WIDTH * 7/8, |
997 | def_h => int $HEIGHT * 7/8, |
1070 | force_h => int $HEIGHT * 7/8, |
998 | title => "Documentation"; |
1071 | title => "Documentation"; |
999 | |
1072 | |
1000 | $win->add (my $vbox = new CFClient::UI::VBox); |
1073 | $win->add (my $vbox = new CFClient::UI::VBox); |
1001 | |
1074 | |
1002 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1075 | $vbox->add (my $buttons = new CFClient::UI::HBox); |
1003 | $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); |
… | |
… | |
1070 | padding => 0, |
1143 | padding => 0, |
1071 | z => 100, |
1144 | z => 100, |
1072 | force_x => "max", |
1145 | force_x => "max", |
1073 | force_y => 0; |
1146 | force_y => 0; |
1074 | $DEBUG_STATUS->show; |
1147 | $DEBUG_STATUS->show; |
1075 | |
1148 | |
|
|
1149 | $BIND_EDITOR = new CFClient::UI::BindEditor (x => "max", y => 0); |
|
|
1150 | |
1076 | $STATUSBOX = new CFClient::UI::Statusbox; |
1151 | $STATUSBOX = new CFClient::UI::Statusbox; |
1077 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, color => [1, 1, 1, 0.8]); |
1152 | $STATUSBOX->add ("Use <b>Alt-Enter</b> to toggle fullscreen mode", pri => -100, color => [1, 1, 1, 0.8]); |
1078 | |
1153 | |
1079 | (new CFClient::UI::Frame |
1154 | (new CFClient::UI::Frame |
1080 | bg => [0, 0, 0, 0.4], |
1155 | bg => [0, 0, 0, 0.4], |
… | |
… | |
1082 | force_y => "max", |
1157 | force_y => "max", |
1083 | child => $STATUSBOX, |
1158 | child => $STATUSBOX, |
1084 | )->show; |
1159 | )->show; |
1085 | |
1160 | |
1086 | CFClient::UI::FancyFrame->new ( |
1161 | CFClient::UI::FancyFrame->new ( |
|
|
1162 | title => "Mini Map", |
|
|
1163 | name => "mapmap", |
1087 | x => 0, |
1164 | x => 0, |
1088 | y => $FONTSIZE + 8, |
1165 | y => $FONTSIZE + 8, |
1089 | border_bg => [1, 1, 1, 192/255], |
1166 | border_bg => [1, 1, 1, 192/255], |
1090 | bg => [1, 1, 1, 0], |
1167 | bg => [1, 1, 1, 0], |
1091 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
1168 | child => ($MAPMAP = new CFClient::MapWidget::MapMap |
… | |
… | |
1130 | 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 |
1207 | 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 |
1131 | |
1208 | |
1132 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, |
1209 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Stats Window", other => make_stats_window, |
1133 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
1210 | tooltip => "Toggles the statistics window, where all your Stats and Resistances are being displayed at all times."); |
1134 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, |
1211 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Inventory", other => make_inventory_window, |
1135 | tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)."); |
1212 | tooltip => "Toggles the inventory window, where you can manage your loot (or treaures :)." |
|
|
1213 | ."You can also hit the Tab-key to show/hide the Inventory."); |
1136 | |
1214 | |
1137 | $BUTTONBAR->add (new CFClient::UI::Button |
1215 | $BUTTONBAR->add (new CFClient::UI::Button |
1138 | text => "Save Config", |
1216 | text => "Save Config", |
1139 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1217 | tooltip => "Saves the options chosen in the client setting, server settings and the window layout to be restored on later runs.", |
1140 | on_activate => sub { |
1218 | on_activate => sub { |
… | |
… | |
1148 | tooltip => "View Documentation"); |
1226 | tooltip => "View Documentation"); |
1149 | |
1227 | |
1150 | $BUTTONBAR->add (new CFClient::UI::Flopper |
1228 | $BUTTONBAR->add (new CFClient::UI::Flopper |
1151 | text => "Bindings", |
1229 | text => "Bindings", |
1152 | other => make_binding_window, |
1230 | other => make_binding_window, |
1153 | tooltip => "Lets you delete bindings you have made with the recorder" |
1231 | tooltip => |
1154 | ); |
1232 | "Lets you define, edit and delete bindings." |
1155 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "[Rec]", other => CFClient::Recorder::make_window, |
1233 | ."There is a shortcut for making bindings: LCTRL+Insert opens the binding editor " |
1156 | tooltip => "This feature lets you record a series of actions (eg. walking a path or ready a skill) and bind them to keys"); |
1234 | ."with nothing set and the recording started. After doing the actions you " |
|
|
1235 | ."want to record press Insert and you will be asked to press a key-combo." |
|
|
1236 | ."After pressing the combo the binding will be saved automatically and the " |
|
|
1237 | ."binding editor closes"); |
|
|
1238 | |
|
|
1239 | $BUTTONBAR->add (new CFClient::UI::Flopper |
|
|
1240 | text => "Spells", |
|
|
1241 | other => make_spell_list, |
|
|
1242 | tooltip => "The spell list"); |
1157 | |
1243 | |
1158 | $BUTTONBAR->add (new CFClient::UI::Button |
1244 | $BUTTONBAR->add (new CFClient::UI::Button |
1159 | text => "Quit", |
1245 | text => "Quit", |
1160 | tooltip => "Terminates the program", |
1246 | tooltip => "Terminates the program", |
1161 | on_activate => sub { |
1247 | on_activate => sub { |
… | |
… | |
1246 | |
1332 | |
1247 | my %demo;#d# |
1333 | my %demo;#d# |
1248 | |
1334 | |
1249 | sub force_refresh { |
1335 | sub force_refresh { |
1250 | $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; |
1336 | $fps = $fps * 0.95 + 1 / (($NOW - $LAST_REFRESH) || 0.1) * 0.05; |
1251 | debug sprintf "%3.2f", $fps; |
1337 | debug sprintf "%3.2f", $fps if $ENV{CFPLUS_DEBUG} & 4; |
1252 | |
1338 | |
1253 | $CFClient::UI::ROOT->draw; |
1339 | $CFClient::UI::ROOT->draw; |
1254 | |
1340 | |
1255 | $WANT_REFRESH = 0; |
1341 | $WANT_REFRESH = 0; |
1256 | $CAN_REFRESH = 0; |
1342 | $CAN_REFRESH = 0; |
… | |
… | |
1489 | =head1 USAGE |
1575 | =head1 USAGE |
1490 | |
1576 | |
1491 | cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used |
1577 | cfplus utilises OpenGL for all UI elements and the game. It is supposed to be used |
1492 | fullscreen and interactively. |
1578 | fullscreen and interactively. |
1493 | |
1579 | |
|
|
1580 | =head1 DEBUGGING |
|
|
1581 | |
|
|
1582 | |
|
|
1583 | CFPLUS_DEBUG - environment variable |
|
|
1584 | |
|
|
1585 | 1 draw borders around widgets |
|
|
1586 | 2 add low-level widget info to tooltips |
|
|
1587 | 4 show fps |
|
|
1588 | 8 suppress tooltips |
|
|
1589 | |
1494 | =head1 AUTHOR |
1590 | =head1 AUTHOR |
1495 | |
1591 | |
1496 | Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
1592 | Marc Lehmann <crossfire@schmorp.de>, Robin Redeker <elmex@ta-sa.org> |
1497 | |
1593 | |
1498 | |
1594 | |