… | |
… | |
78 | } |
78 | } |
79 | |
79 | |
80 | # prepend private library directory |
80 | # prepend private library directory |
81 | BEGIN { |
81 | BEGIN { |
82 | for (grep !ref, @INC) { |
82 | for (grep !ref, @INC) { |
83 | my $path = "$_/Deliantra/Client/private/dc"; |
83 | my $path = "$_/Deliantra/Client/private"; |
84 | if (-d $path) { |
84 | if (-d $path) { |
85 | unshift @INC, $path; |
85 | unshift @INC, $path; |
86 | last; |
86 | last; |
87 | } |
87 | } |
88 | } |
88 | } |
… | |
… | |
108 | use DC::UI; |
108 | use DC::UI; |
109 | use DC::UI::Canvas; |
109 | use DC::UI::Canvas; |
110 | use DC::UI::Inventory; |
110 | use DC::UI::Inventory; |
111 | use DC::UI::SpellList; |
111 | use DC::UI::SpellList; |
112 | use DC::UI::Dockable; |
112 | use DC::UI::Dockable; |
|
|
113 | use DC::UI::Dockbar; |
113 | use DC::UI::MessageWindow; |
114 | use DC::UI::MessageWindow; |
114 | use DC::UI::ChatView; |
115 | use DC::UI::ChatView; |
|
|
116 | use DC::MessageDistributor; |
115 | use DC::Pod; |
117 | use DC::Pod; |
116 | use DC::MapWidget; |
118 | use DC::MapWidget; |
117 | use DC::Macro; |
119 | use DC::Macro; |
118 | |
120 | |
119 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
121 | $SIG{QUIT} = sub { Carp::cluck "QUIT" }; |
… | |
… | |
122 | $EV::DIED = sub { |
124 | $EV::DIED = sub { |
123 | DC::fatal Carp::longmess $@; |
125 | DC::fatal Carp::longmess $@; |
124 | }; |
126 | }; |
125 | |
127 | |
126 | my $MAX_FPS = 60; |
128 | my $MAX_FPS = 60; |
127 | my $MIN_FPS = 5; # unused as of yet |
|
|
128 | |
129 | |
129 | our $META_SERVER = "http://metaserver.schmorp.de/current.json"; |
130 | our $META_SERVER = "http://metaserver.schmorp.de/current.json"; |
130 | |
131 | |
131 | our $LAST_REFRESH; |
132 | our $LAST_REFRESH; |
132 | our $NOW; |
133 | our $NOW; |
… | |
… | |
179 | our $SPELL_PAGE; |
180 | our $SPELL_PAGE; |
180 | our $SPELL_LIST; |
181 | our $SPELL_LIST; |
181 | |
182 | |
182 | our $HELP_WINDOW; |
183 | our $HELP_WINDOW; |
183 | our $MESSAGE_WINDOW; |
184 | our $MESSAGE_WINDOW; |
|
|
185 | our $MESSAGE_DIST; |
184 | our $FLOORBOX; |
186 | our $FLOORBOX; |
185 | our $GAUGES; |
187 | our $GAUGES; |
186 | our $STATWIDS; |
188 | our $STATWIDS; |
187 | |
189 | |
188 | our $SDL_ACTIVE; |
190 | our $SDL_ACTIVE; |
… | |
… | |
205 | sub debug { |
207 | sub debug { |
206 | $DEBUG_STATUS->set_text ($_[0]); |
208 | $DEBUG_STATUS->set_text ($_[0]); |
207 | } |
209 | } |
208 | |
210 | |
209 | sub message { |
211 | sub message { |
210 | $MESSAGE_WINDOW->message (@_); |
212 | $MESSAGE_DIST->message (@_); |
211 | } |
213 | } |
212 | |
214 | |
213 | ############################################################################# |
215 | ############################################################################# |
214 | #TODO: maybe move into own audio module... |
216 | #TODO: maybe move into own audio module... |
215 | |
217 | |
… | |
… | |
654 | [Cha => CS_STAT_CHA], |
656 | [Cha => CS_STAT_CHA], |
655 | ) { |
657 | ) { |
656 | my ($name, $id) = @$_; |
658 | my ($name, $id) = @$_; |
657 | $hbox->add (new DC::UI::Label |
659 | $hbox->add (new DC::UI::Label |
658 | markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>", |
660 | markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>", |
659 | align => 0, |
|
|
660 | expand => 1, |
661 | expand => 1, |
661 | can_events => 1, |
662 | can_events => 1, |
662 | can_hover => 1, |
663 | can_hover => 1, |
663 | tooltip => "#stat_$name", |
664 | tooltip => "#stat_$name", |
664 | ); |
665 | ); |
… | |
… | |
770 | |
771 | |
771 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]); |
772 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]); |
772 | |
773 | |
773 | my $row = 0; |
774 | my $row = 0; |
774 | |
775 | |
775 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "OpenGL Info"); |
776 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "OpenGL Info"); |
776 | $table->add_at (1, $row++, new DC::UI::Label valign => 0, fontsize => 0.8, text => DC::OpenGL::gl_vendor . ", " . DC::OpenGL::gl_version, |
777 | $table->add_at (1, $row++, new DC::UI::Label fontsize => 0.8, text => DC::OpenGL::gl_vendor . ", " . DC::OpenGL::gl_version, |
777 | can_events => 1, |
778 | can_events => 1, |
778 | tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>"); |
779 | tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>"); |
779 | |
780 | |
780 | my $vidmode_tooltip = |
781 | my $vidmode_tooltip = |
781 | "<b>Video Mode.</b> The video mode to use for fullscreen (and the window size for windowed operation). " |
782 | "<b>Video Mode.</b> The video mode to use for fullscreen (and the window size for windowed operation). " |
782 | . "The format is <i>width</i> x <i>height</i> \@ <i>depth-per-channel</i> + <i>alpha-channel</i>."; |
783 | . "The format is <i>width</i> x <i>height</i> \@ <i>depth-per-channel</i> + <i>alpha-channel</i>."; |
783 | |
784 | |
784 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Video Mode"); |
785 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Video Mode"); |
785 | $table->add_at (1, $row++, my $hbox = new DC::UI::HBox); |
786 | $table->add_at (1, $row++, my $hbox = new DC::UI::HBox); |
786 | |
787 | |
787 | $hbox->add (my $mode_slider = new DC::UI::Slider |
788 | $hbox->add (my $mode_slider = new DC::UI::Slider |
788 | force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1], |
789 | force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1], |
789 | tooltip => $vidmode_tooltip); |
790 | tooltip => $vidmode_tooltip); |
790 | $hbox->add (my $mode_label = new DC::UI::Label |
791 | $hbox->add (my $mode_label = new DC::UI::Label |
791 | align => 0, valign => 0, height => 0.8, template => "9999x9999@9+9", |
792 | height => 0.8, template => "9999x9999@9+9", |
792 | can_events => 1, tooltip => $vidmode_tooltip); |
793 | can_events => 1, tooltip => $vidmode_tooltip); |
793 | |
794 | |
794 | $mode_slider->connect (changed => sub { |
795 | $mode_slider->connect (changed => sub { |
795 | my ($self, $value) = @_; |
796 | my ($self, $value) = @_; |
796 | |
797 | |
797 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
798 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
798 | $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]}); |
799 | $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]}); |
799 | }); |
800 | }); |
800 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
801 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
801 | |
802 | |
802 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
803 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fullscreen"); |
803 | $table->add_at (1, $row++, $FULLSCREEN_ENABLE = new DC::UI::CheckBox |
804 | $table->add_at (1, $row++, $FULLSCREEN_ENABLE = new DC::UI::CheckBox |
804 | state => $CFG->{fullscreen}, |
805 | state => $CFG->{fullscreen}, |
805 | tooltip => "Bring the client into fullscreen mode.", |
806 | tooltip => "Bring the client into fullscreen mode.", |
806 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
807 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
807 | ); |
808 | ); |
808 | |
809 | |
809 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); |
810 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Force OpenGL 1.1"); |
810 | $table->add_at (1, $row++, new DC::UI::CheckBox |
811 | $table->add_at (1, $row++, new DC::UI::CheckBox |
811 | state => $CFG->{force_opengl11}, |
812 | state => $CFG->{force_opengl11}, |
812 | tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " |
813 | tooltip => "Limit Deliantra to use OpenGL 1.1 features only. This will normally result in " |
813 | . "higher memory usage and slower performance. It will, however, help tremendously on " |
814 | . "higher memory usage and slower performance. It will, however, help tremendously on " |
814 | . "cards that claim to support a feature but fall back to software rendering. " |
815 | . "cards that claim to support a feature but fall back to software rendering. " |
815 | . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " |
816 | . "Nvidia Geforce FX cards are known to claim features the hardware doesn't support, " |
816 | . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " |
817 | . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " |
817 | . "experience extremely low framerates and your card should do better, try this option.</b>", |
818 | . "experience extremely low framerates and your card should do better, try this option.</b>", |
818 | on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 } |
819 | on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 } |
819 | ); |
820 | ); |
820 | |
821 | |
821 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Compress Textures"); |
822 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures"); |
822 | $table->add_at (1, $row++, new DC::UI::CheckBox |
823 | $table->add_at (1, $row++, new DC::UI::CheckBox |
823 | state => $CFG->{texture_compression}, |
824 | state => $CFG->{texture_compression}, |
824 | tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " |
825 | tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " |
825 | . "will save a lot of memory and increase performance. The compression algorithm " |
826 | . "will save a lot of memory and increase performance. The compression algorithm " |
826 | . "can differ form card to card, so your mileage may vary. This setting is ignored in " |
827 | . "can differ form card to card, so your mileage may vary. This setting is ignored in " |
827 | . "forced OpenGL 1.1 mode.", |
828 | . "forced OpenGL 1.1 mode.", |
828 | on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } |
829 | on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } |
829 | ); |
830 | ); |
830 | |
831 | |
831 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
832 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly"); |
832 | $table->add_at (1, $row++, new DC::UI::CheckBox |
833 | $table->add_at (1, $row++, new DC::UI::CheckBox |
833 | state => $CFG->{fast}, |
834 | state => $CFG->{fast}, |
834 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
835 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
835 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
836 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
836 | ); |
837 | ); |
837 | |
838 | |
838 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
839 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "GUI Fontsize"); |
839 | $table->add_at (1, $row++, new DC::UI::Slider |
840 | $table->add_at (1, $row++, new DC::UI::Slider |
840 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
841 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
841 | tooltip => "The base font size used by most GUI elements that do not have their own setting.", |
842 | tooltip => "The base font size used by most GUI elements that do not have their own setting.", |
842 | on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 }, |
843 | on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 }, |
843 | ); |
844 | ); |
844 | |
845 | |
845 | $table->add_at (1, $row++, new DC::UI::Button |
846 | $table->add_at (1, $row++, new DC::UI::Button |
846 | expand => 1, align => 0, text => "Apply", |
847 | expand => 1, text => "Apply", |
847 | tooltip => "Apply the video settings above.", |
848 | tooltip => "Apply the video settings above.", |
848 | on_activate => sub { |
849 | on_activate => sub { |
849 | video_shutdown (); |
850 | video_shutdown (); |
850 | video_init (); |
851 | video_init (); |
851 | 0 |
852 | 0 |
852 | } |
853 | } |
853 | ); |
854 | ); |
854 | |
855 | |
855 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Scale"); |
856 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale"); |
856 | $table->add_at (1, $row++, new DC::UI::Slider |
857 | $table->add_at (1, $row++, new DC::UI::Slider |
857 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
858 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
858 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
859 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
859 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
860 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
860 | ); |
861 | ); |
861 | |
862 | |
862 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Smoothing"); |
863 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Smoothing"); |
863 | $table->add_at (1, $row++, new DC::UI::CheckBox |
864 | $table->add_at (1, $row++, new DC::UI::CheckBox |
864 | state => $CFG->{map_smoothing}, |
865 | state => $CFG->{map_smoothing}, |
865 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
866 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
866 | . "This increases load on the graphics subsystem and works only with TRT servers. " |
867 | . "This increases load on the graphics subsystem and works only with TRT servers. " |
867 | . "Changes take effect at next login only.", |
868 | . "Changes take effect at next login only.", |
868 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } |
869 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } |
869 | ); |
870 | ); |
870 | |
871 | |
871 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fog of War"); |
872 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fog of War"); |
872 | $table->add_at (1, $row++, new DC::UI::CheckBox |
873 | $table->add_at (1, $row++, new DC::UI::CheckBox |
873 | state => $CFG->{fow_enable}, |
874 | state => $CFG->{fow_enable}, |
874 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
875 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
875 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } |
876 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } |
876 | ); |
877 | ); |
877 | |
878 | |
878 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
879 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity"); |
879 | $table->add_at (1, $row++, new DC::UI::Slider |
880 | $table->add_at (1, $row++, new DC::UI::Slider |
880 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
881 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
881 | tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", |
882 | tooltip => "<b>Fog of War Lightness.</b> The higher the intensity, the lighter the Fog-of-War color. Changes are instant.", |
882 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } |
883 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } |
883 | ); |
884 | ); |
884 | |
885 | |
885 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
886 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Fontsize"); |
886 | $table->add_at (1, $row++, new DC::UI::Slider |
887 | $table->add_at (1, $row++, new DC::UI::Slider |
887 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
888 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
888 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, " |
889 | tooltip => "The font size used by the <b>message/server log</b> window only. Changes are instant, " |
889 | . "but you still need to press apply to correctly re-layout the widget.", |
890 | . "but you still need to press apply to correctly re-layout the widget.", |
890 | on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
891 | on_changed => sub { $MESSAGE_DIST->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
891 | ); |
892 | ); |
892 | |
893 | |
893 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
894 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge fontsize"); |
894 | $table->add_at (1, $row++, new DC::UI::Slider |
895 | $table->add_at (1, $row++, new DC::UI::Slider |
895 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
896 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
896 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
897 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
897 | on_changed => sub { |
898 | on_changed => sub { |
898 | $CFG->{gauge_fontsize} = $_[1]; |
899 | $CFG->{gauge_fontsize} = $_[1]; |
899 | &set_gauge_window_fontsize; |
900 | &set_gauge_window_fontsize; |
900 | 0 |
901 | 0 |
901 | } |
902 | } |
902 | ); |
903 | ); |
903 | |
904 | |
904 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge size"); |
905 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge size"); |
905 | $table->add_at (1, $row++, new DC::UI::Slider |
906 | $table->add_at (1, $row++, new DC::UI::Slider |
906 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
907 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
907 | tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", |
908 | tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", |
908 | on_changed => sub { |
909 | on_changed => sub { |
909 | $CFG->{gauge_size} = $_[1]; |
910 | $CFG->{gauge_size} = $_[1]; |
… | |
… | |
943 | |
944 | |
944 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); |
945 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); |
945 | |
946 | |
946 | my $row = 0; |
947 | my $row = 0; |
947 | |
948 | |
948 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
949 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); |
949 | $table->add_at (1, $row++, new DC::UI::CheckBox |
950 | $table->add_at (1, $row++, new DC::UI::CheckBox |
950 | state => $CFG->{audio_enable}, |
951 | state => $CFG->{audio_enable}, |
951 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
952 | tooltip => "<b>Master Audio Enable.</b> If enabled, sound effects and music will be played. If disabled, no audio will be used and the soundcard will not be opened.", |
952 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } |
953 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } |
953 | ); |
954 | ); |
954 | |
955 | |
955 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Sound Effects"); |
956 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); |
956 | $table->add_at (1, $row, new DC::UI::CheckBox |
957 | $table->add_at (1, $row, new DC::UI::CheckBox |
957 | expand => 1, state => $CFG->{effects_enable}, |
958 | expand => 1, state => $CFG->{effects_enable}, |
958 | tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", |
959 | tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", |
959 | on_changed => sub { |
960 | on_changed => sub { |
960 | $CFG->{effects_enable} = $_[1]; |
961 | $CFG->{effects_enable} = $_[1]; |
… | |
… | |
967 | tooltip => "The relative volume of sound effects. Best audio quality is achieved if this " |
968 | tooltip => "The relative volume of sound effects. Best audio quality is achieved if this " |
968 | . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.", |
969 | . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.", |
969 | on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 } |
970 | on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 } |
970 | ); |
971 | ); |
971 | |
972 | |
972 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Background Music"); |
973 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); |
973 | $table->add_at (1, $row, new DC::UI::CheckBox |
974 | $table->add_at (1, $row, new DC::UI::CheckBox |
974 | expand => 1, state => $CFG->{bgm_enable}, |
975 | expand => 1, state => $CFG->{bgm_enable}, |
975 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
976 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
976 | on_changed => sub { |
977 | on_changed => sub { |
977 | $CFG->{bgm_enable} = $_[1]; |
978 | $CFG->{bgm_enable} = $_[1]; |
… | |
… | |
984 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
985 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
985 | tooltip => "The volume of the background music. Changes are instant.", |
986 | tooltip => "The volume of the background music. Changes are instant.", |
986 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } |
987 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } |
987 | ); |
988 | ); |
988 | |
989 | |
989 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Frequency"); |
990 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Frequency"); |
990 | $table->add_at (1, $row++, new DC::UI::Selector |
991 | $table->add_at (1, $row++, new DC::UI::Selector |
991 | c_colspan => 2, expand => 1, |
992 | c_colspan => 2, expand => 1, |
992 | value => $CFG->{audio_hw_frequency}, |
993 | value => $CFG->{audio_hw_frequency}, |
993 | options => [ |
994 | options => [ |
994 | [ 0, "default" , "Use System Default"], |
995 | [ 0, "default" , "Use System Default"], |
… | |
… | |
1003 | audio_tab_update; |
1004 | audio_tab_update; |
1004 | 1 |
1005 | 1 |
1005 | } |
1006 | } |
1006 | ); |
1007 | ); |
1007 | |
1008 | |
1008 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Channels"); |
1009 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Channels"); |
1009 | $table->add_at (1, $row++, new DC::UI::Selector |
1010 | $table->add_at (1, $row++, new DC::UI::Selector |
1010 | c_colspan => 2, expand => 1, |
1011 | c_colspan => 2, expand => 1, |
1011 | value => $CFG->{audio_hw_channels}, |
1012 | value => $CFG->{audio_hw_channels}, |
1012 | options => [ |
1013 | options => [ |
1013 | [0, "default" , "Use System Default"], |
1014 | [0, "default" , "Use System Default"], |
… | |
… | |
1022 | audio_tab_update; |
1023 | audio_tab_update; |
1023 | 1 |
1024 | 1 |
1024 | } |
1025 | } |
1025 | ); |
1026 | ); |
1026 | |
1027 | |
1027 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Latency"); |
1028 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Latency"); |
1028 | $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector |
1029 | $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector |
1029 | c_colspan => 2, expand => 1, |
1030 | c_colspan => 2, expand => 1, |
1030 | value => $CFG->{audio_hw_chunksize}, |
1031 | value => $CFG->{audio_hw_chunksize}, |
1031 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
1032 | tooltip => "The guarenteed latency. Lower is better, but also more cpu-intensive and might cause stuttering. If music playback " |
1032 | . "is stuttering, increase this value. Values of 50-100ms are optimal.", |
1033 | . "is stuttering, increase this value. Values of 50-100ms are optimal.", |
… | |
… | |
1036 | 1 |
1037 | 1 |
1037 | } |
1038 | } |
1038 | ); |
1039 | ); |
1039 | |
1040 | |
1040 | # should really be a slider |
1041 | # should really be a slider |
1041 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Mixer Voices"); |
1042 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Mixer Voices"); |
1042 | $table->add_at (1, $row++, new DC::UI::ValSlider |
1043 | $table->add_at (1, $row++, new DC::UI::ValSlider |
1043 | c_colspan => 2, expand => 1, |
1044 | c_colspan => 2, expand => 1, |
1044 | tooltip => "The number of simultaneous sound effects possible. Higher is better, but also more cpu-intensive and might cause stuttering.", |
1045 | tooltip => "The number of simultaneous sound effects possible. Higher is better, but also more cpu-intensive and might cause stuttering.", |
1045 | range => [$::CFG->{audio_mix_channels}, 4, 32, 0, 1], |
1046 | range => [$::CFG->{audio_mix_channels}, 4, 32, 0, 1], |
1046 | template => ">= 99", |
1047 | template => ">= 99", |
… | |
… | |
1052 | 1; |
1053 | 1; |
1053 | } |
1054 | } |
1054 | ); |
1055 | ); |
1055 | |
1056 | |
1056 | $table->add_at (1, $row++, new DC::UI::Button |
1057 | $table->add_at (1, $row++, new DC::UI::Button |
1057 | c_colspan => 2, expand => 1, align => 0, text => "Apply", |
1058 | c_colspan => 2, expand => 1, text => "Apply", |
1058 | tooltip => "Apply the audio settings", |
1059 | tooltip => "Apply the audio settings", |
1059 | on_activate => sub { |
1060 | on_activate => sub { |
1060 | audio_shutdown (); |
1061 | audio_shutdown (); |
1061 | audio_init (); |
1062 | audio_init (); |
1062 | 0 |
1063 | 0 |
… | |
… | |
1112 | $hb->add (my $hg = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health"); |
1113 | $hb->add (my $hg = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health"); |
1113 | $hb->add (my $mg = new DC::UI::Gauge type => 'mana', tooltip => "#stat_mana"); |
1114 | $hb->add (my $mg = new DC::UI::Gauge type => 'mana', tooltip => "#stat_mana"); |
1114 | $hb->add (my $gg = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace"); |
1115 | $hb->add (my $gg = new DC::UI::Gauge type => 'grace', tooltip => "#stat_grace"); |
1115 | $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food"); |
1116 | $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food"); |
1116 | |
1117 | |
1117 | $vbox->add (my $exp = new DC::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); |
1118 | $vbox->add (my $exp = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); |
1118 | $vbox->add (my $prg = new DC::UI::ExperienceProgress); |
1119 | $vbox->add (my $prg = new DC::UI::ExperienceProgress); |
1119 | $vbox->add (my $sklprg = new DC::UI::ExperienceProgress); |
1120 | $vbox->add (my $sklprg = new DC::UI::ExperienceProgress); |
1120 | $vbox->add (my $rng = new DC::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); |
1121 | $vbox->add (my $rng = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); |
1121 | |
1122 | |
1122 | $GAUGES = { |
1123 | $GAUGES = { |
1123 | exp => $exp, prg => $prg, sklprg => $sklprg, |
1124 | exp => $exp, prg => $prg, sklprg => $sklprg, |
1124 | win => $win, range => $rng, |
1125 | win => $win, range => $rng, |
1125 | hp => $hg, mana => $mg, grace => $gg, food => $fg, |
1126 | hp => $hg, mana => $mg, grace => $gg, food => $fg, |
… | |
… | |
1141 | $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
1142 | $table->add_at (1, 2, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 4; 0 }); |
1142 | $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); |
1143 | $table->add_at (0, 3, new DC::UI::Label text => "Suppress Tooltips"); |
1143 | $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
1144 | $table->add_at (1, 3, new DC::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); |
1144 | $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1145 | $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1145 | |
1146 | |
1146 | $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153");#d# |
1147 | $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# |
1147 | |
1148 | |
1148 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1149 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1149 | $t->add_at (0,0, new DC::UI::Label text => "a a a a", c_rowspan => 1, c_colspan => 2); |
1150 | $t->add_at (0,0, new DC::UI::Label text => "a a", c_rowspan => 1, c_colspan => 2); |
1150 | $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1); |
1151 | $t->add_at (2,0, new DC::UI::Label text => "b\nb", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); |
1151 | $t->add_at (1,2, new DC::UI::Label text => "c c c c", c_rowspan => 1, c_colspan => 2); |
1152 | $t->add_at (1,2, new DC::UI::Label text => "c c", c_rowspan => 1, c_colspan => 2); |
1152 | $t->add_at (0,1, new DC::UI::Label text => "d\nd", c_rowspan => 2, c_colspan => 1); |
1153 | $t->add_at (0,1, new DC::UI::Label text => "d\nd", c_rowspan => 2, c_colspan => 1, ellipsise => 0 ); |
1153 | $t->add_at (1,1, new DC::UI::Label text => "e"); |
1154 | $t->add_at (1,1, new DC::UI::Label text => "e"); |
1154 | |
1155 | |
1155 | $table->add_at (7, 6, my $c = new DC::UI::Canvas); |
1156 | $table->add_at (7, 6, my $c = new DC::UI::Canvas); |
1156 | |
1157 | |
1157 | $c->add_items ({ |
1158 | $c->add_items ({ |
… | |
… | |
1191 | $vb->add (new DC::UI::FancyFrame |
1192 | $vb->add (new DC::UI::FancyFrame |
1192 | label => "Player", |
1193 | label => "Player", |
1193 | child => (my $pi = new DC::UI::VBox), |
1194 | child => (my $pi = new DC::UI::VBox), |
1194 | ); |
1195 | ); |
1195 | |
1196 | |
1196 | $pi->add ($STATWIDS->{title} = new DC::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
1197 | $pi->add ($STATWIDS->{title} = new DC::UI::Label text => "Title:", expand => 1, align => 0, |
1197 | can_hover => 1, can_events => 1, |
1198 | can_hover => 1, can_events => 1, |
1198 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
1199 | tooltip => "Your name and title. You can change your title by using the <b>title</b> command, if supported by the server."); |
1199 | $pi->add ($STATWIDS->{map} = new DC::UI::Label valign => 0, align => -1, text => "Map:", expand => 1, |
1200 | $pi->add ($STATWIDS->{map} = new DC::UI::Label align => 0, text => "Map:", expand => 1, |
1200 | can_hover => 1, can_events => 1, |
1201 | can_hover => 1, can_events => 1, |
1201 | tooltip => "The map you are currently on (if supported by the server)."); |
1202 | tooltip => "The map you are currently on (if supported by the server)."); |
1202 | |
1203 | |
1203 | $pi->add (my $hb0 = new DC::UI::HBox); |
1204 | $pi->add (my $hb0 = new DC::UI::HBox); |
1204 | $hb0->add ($STATWIDS->{weight} = new DC::UI::Label valign => 0, align => -1, text => "Weight:", expand => 1, |
1205 | $hb0->add ($STATWIDS->{weight} = new DC::UI::Label text => "Weight:", expand => 1, align => 0, |
1205 | can_hover => 1, can_events => 1, |
1206 | can_hover => 1, can_events => 1, |
1206 | tooltip => "The weight of the player including all inventory items."); |
1207 | tooltip => "The weight of the player including all inventory items."); |
1207 | $hb0->add ($STATWIDS->{m_weight} = new DC::UI::Label valign => 0, align => -1, text => "Max weight:", expand => 1, |
1208 | $hb0->add ($STATWIDS->{m_weight} = new DC::UI::Label align => 0, text => "Max weight:", expand => 1, |
1208 | can_hover => 1, can_events => 1, |
1209 | can_hover => 1, can_events => 1, |
1209 | tooltip => "The weight limit: you cannot carry more than this."); |
1210 | tooltip => "The weight limit: you cannot carry more than this."); |
1210 | |
1211 | |
1211 | $vb->add (new DC::UI::FancyFrame |
1212 | $vb->add (new DC::UI::FancyFrame |
1212 | label => "Primary/Secondary Statistics", |
1213 | label => "Primary/Secondary Statistics", |
… | |
… | |
1233 | [2, 5, st_wspd => "WSp", 10.54], |
1234 | [2, 5, st_wspd => "WSp", 10.54], |
1234 | ) { |
1235 | ) { |
1235 | my ($col, $row, $id, $label, $template) = @$_; |
1236 | my ($col, $row, $id, $label, $template) = @$_; |
1236 | |
1237 | |
1237 | $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label |
1238 | $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label |
1238 | font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, |
1239 | font => $FONT_FIXED, can_hover => 1, can_events => 1, |
1239 | align => +1, template => $template, tooltip => "#stat_$label"); |
1240 | align => 1, template => $template, tooltip => "#stat_$label"); |
1240 | $tbl->add_at ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new DC::UI::Label |
1241 | $tbl->add_at ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new DC::UI::Label |
1241 | font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, valign => 0, |
1242 | font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, |
1242 | align => -1, text => $label, tooltip => "#stat_$label"); |
1243 | align => 0, text => $label, tooltip => "#stat_$label"); |
1243 | } |
1244 | } |
1244 | |
1245 | |
1245 | $vb->add (new DC::UI::FancyFrame |
1246 | $vb->add (new DC::UI::FancyFrame |
1246 | label => "Resistancies", |
1247 | label => "Resistancies", |
1247 | child => (my $tbl2 = new DC::UI::Table expand => 1), |
1248 | child => (my $tbl2 = new DC::UI::Table expand => 1, col_expand => [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0]), |
1248 | ); |
1249 | ); |
1249 | |
1250 | |
1250 | my $row = 0; |
1251 | my $row = 0; |
1251 | my $col = 0; |
1252 | my $col = 0; |
1252 | |
1253 | |
… | |
… | |
1291 | |
1292 | |
1292 | for (qw/slow holyw conf fire depl magic |
1293 | for (qw/slow holyw conf fire depl magic |
1293 | drain acid pois para deat phys |
1294 | drain acid pois para deat phys |
1294 | blind fear tund elec cold ghit/) |
1295 | blind fear tund elec cold ghit/) |
1295 | { |
1296 | { |
1296 | $tbl2->add_at ($col, $row, |
1297 | $tbl2->add_at ($col + 2, $row, |
1297 | $STATWIDS->{"res_$_"} = |
1298 | $STATWIDS->{"res_$_"} = |
1298 | new DC::UI::Label |
1299 | new DC::UI::Label |
1299 | font => $FONT_FIXED, |
1300 | font => $FONT_FIXED, |
1300 | template => "-100%", |
1301 | template => "-100%", |
1301 | align => +1, |
1302 | align => 1, |
1302 | valign => 0, |
|
|
1303 | can_events => 1, |
1303 | can_events => 1, |
1304 | can_hover => 1, |
1304 | can_hover => 1, |
1305 | tooltip => $resist_names{$_}->[1], |
1305 | tooltip => $resist_names{$_}->[1], |
1306 | ); |
1306 | ); |
1307 | $tbl2->add_at ($col + 1, $row, new DC::UI::Image |
1307 | $tbl2->add_at ($col + 1, $row, new DC::UI::Image |
… | |
… | |
1309 | can_hover => 1, |
1309 | can_hover => 1, |
1310 | can_events => 1, |
1310 | can_events => 1, |
1311 | path => "ui/resist/resist_$_.png", |
1311 | path => "ui/resist/resist_$_.png", |
1312 | tooltip => $resist_names{$_}->[1], |
1312 | tooltip => $resist_names{$_}->[1], |
1313 | ); |
1313 | ); |
1314 | $tbl2->add_at ($col + 2, $row, new DC::UI::Label |
1314 | $tbl2->add_at ($col + 0, $row, new DC::UI::Label |
1315 | text => $resist_names{$_}->[0], |
1315 | text => $resist_names{$_}->[0], |
1316 | font => $FONT_FIXED, |
1316 | font => $FONT_FIXED, |
|
|
1317 | align => 1, |
1317 | can_hover => 1, |
1318 | can_hover => 1, |
1318 | can_events => 1, |
1319 | can_events => 1, |
1319 | tooltip => $resist_names{$_}->[1], |
1320 | tooltip => $resist_names{$_}->[1], |
1320 | ); |
1321 | ); |
1321 | |
1322 | |
1322 | $row++; |
1323 | $row++; |
1323 | if ($row % 6 == 0) { |
1324 | if ($row % 6 == 0) { |
1324 | $col += 3; |
1325 | $col += 4; |
1325 | $row = 0; |
1326 | $row = 0; |
1326 | } |
1327 | } |
1327 | } |
1328 | } |
1328 | |
1329 | |
1329 | #update_stats_window ({}); |
1330 | #update_stats_window ({}); |
… | |
… | |
1375 | "The time this server has been running without being restarted.", |
1376 | "The time this server has been running without being restarted.", |
1376 | "Short information about this server provided by its admins.", |
1377 | "Short information about this server provided by its admins.", |
1377 | ); |
1378 | ); |
1378 | my @col = qw(#Users Host Uptime Version Description); |
1379 | my @col = qw(#Users Host Uptime Version Description); |
1379 | $table->add_at ($_, 0, new DC::UI::Label |
1380 | $table->add_at ($_, 0, new DC::UI::Label |
1380 | can_hover => 1, can_events => 1, |
1381 | can_hover => 1, can_events => 1, fg => [1, 1, 0], |
1381 | align => 0, fg => [1, 1, 0], |
|
|
1382 | text => $col[$_], tooltip => $tip[$_]) |
1382 | text => $col[$_], tooltip => $tip[$_]) |
1383 | for 0 .. $#col; |
1383 | for 0 .. $#col; |
1384 | |
1384 | |
1385 | my @align = qw(1 0 1 1 -1); |
1385 | my @align = qw(1 0.5 1 1 0); |
1386 | |
1386 | |
1387 | my $y = 0; |
1387 | my $y = 0; |
1388 | for my $m (@{ $msg->{servers} }) { |
1388 | for my $m (@{ $msg->{servers} }) { |
1389 | my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) = |
1389 | my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) = |
1390 | @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)}; |
1390 | @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)}; |
… | |
… | |
1471 | $vbox->add (new DC::UI::FancyFrame |
1471 | $vbox->add (new DC::UI::FancyFrame |
1472 | label => "Login Settings", |
1472 | label => "Login Settings", |
1473 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1473 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1474 | ); |
1474 | ); |
1475 | |
1475 | |
1476 | $table->add_at (0, 4, new DC::UI::Label valign => 0, align => 1, text => "Username"); |
1476 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1477 | $table->add_at (1, 4, new DC::UI::Entry |
1477 | $table->add_at (1, 4, new DC::UI::Entry |
1478 | text => $CFG->{profile}{default}{user}, |
1478 | text => $CFG->{profile}{default}{user}, |
1479 | tooltip => "The name of your character on the server.", |
1479 | tooltip => "The name of your character on the server.", |
1480 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1480 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1481 | ); |
1481 | ); |
1482 | |
1482 | |
1483 | $table->add_at (0, 5, new DC::UI::Label valign => 0, align => 1, text => "Password"); |
1483 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1484 | $table->add_at (1, 5, new DC::UI::Entry |
1484 | $table->add_at (1, 5, new DC::UI::Entry |
1485 | text => $CFG->{profile}{default}{password}, |
1485 | text => $CFG->{profile}{default}{password}, |
1486 | hidden => 1, |
1486 | hidden => 1, |
1487 | tooltip => "The password for your character.", |
1487 | tooltip => "The password for your character.", |
1488 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1488 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1489 | ); |
1489 | ); |
1490 | |
1490 | |
1491 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1491 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1492 | expand => 1, |
1492 | expand => 1, |
1493 | align => 0, |
|
|
1494 | text => "Login / Register", |
1493 | text => "Login / Register", |
1495 | tooltip => "This button will either login to the account configured above or register a new account.", |
1494 | tooltip => "This button will either login to the account configured above or register a new account.", |
1496 | on_activate => sub { |
1495 | on_activate => sub { |
1497 | $CONN ? stop_game |
1496 | $CONN ? stop_game |
1498 | : start_game; |
1497 | : start_game; |
… | |
… | |
1501 | ); |
1500 | ); |
1502 | |
1501 | |
1503 | $vbox->add (new DC::UI::FancyFrame |
1502 | $vbox->add (new DC::UI::FancyFrame |
1504 | label => "Registering", |
1503 | label => "Registering", |
1505 | min_h => 200, |
1504 | min_h => 200, |
1506 | child => (new DC::UI::Label valign => -1, ellipsise => 0, |
1505 | child => (new DC::UI::Label valign => 0, ellipsise => 0, |
1507 | markup => |
1506 | markup => |
1508 | "To register a new account, choose a username that hasn't been taken yet and " |
1507 | "To register a new account, choose a username that hasn't been taken yet and " |
1509 | . "try to log-in. Follow the instructions in the Log tab in the message window.", |
1508 | . "try to log-in. Follow the instructions in the Log tab in the message window.", |
1510 | ), |
1509 | ), |
1511 | ); |
1510 | ); |
… | |
… | |
1521 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1520 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1522 | ); |
1521 | ); |
1523 | |
1522 | |
1524 | my $row = 0; |
1523 | my $row = 0; |
1525 | |
1524 | |
1526 | $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Host:Port"); |
1525 | $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Host:Port"); |
1527 | { |
1526 | { |
1528 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1527 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1529 | |
1528 | |
1530 | $vbox->add ( |
1529 | $vbox->add ( |
1531 | $HOST_ENTRY = new DC::UI::Entry |
1530 | $HOST_ENTRY = new DC::UI::Entry |
… | |
… | |
1549 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, |
1548 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, |
1550 | ); |
1549 | ); |
1551 | }#d# |
1550 | }#d# |
1552 | } |
1551 | } |
1553 | |
1552 | |
1554 | $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Map Size"); |
1553 | $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Map Size"); |
1555 | $table->add_at (1, $row, new DC::UI::Slider |
1554 | $table->add_at (1, $row, new DC::UI::Slider |
1556 | force_w => 100, |
1555 | force_w => 100, |
1557 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1556 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1558 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1557 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1559 | . "If you set this to a high value you will be able to see further, " |
1558 | . "If you set this to a high value you will be able to see further, " |
1560 | . "but you also increase bandwidth requirements and latency. " |
1559 | . "but you also increase bandwidth requirements and latency. " |
1561 | . "This option is only used once at log-in.", |
1560 | . "This option is only used once at log-in.", |
1562 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, |
1561 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, |
1563 | ); |
1562 | ); |
1564 | |
1563 | |
1565 | $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Output-Rate"); |
1564 | $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate"); |
1566 | $table->add_at (1, $row, new DC::UI::Entry |
1565 | $table->add_at (1, $row, new DC::UI::Entry |
1567 | text => $CFG->{output_rate}, |
1566 | text => $CFG->{output_rate}, |
1568 | tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " |
1567 | tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " |
1569 | . "when sending data. When 0 or unset, the server " |
1568 | . "when sending data. When 0 or unset, the server " |
1570 | . "default will be used, which is usually around 100kb/s. Most servers will " |
1569 | . "default will be used, which is usually around 100kb/s. Most servers will " |
… | |
… | |
1583 | sub client_setup { |
1582 | sub client_setup { |
1584 | my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]; |
1583 | my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]; |
1585 | |
1584 | |
1586 | my $row = 0; |
1585 | my $row = 0; |
1587 | |
1586 | |
1588 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Tip of the day"); |
1587 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Tip of the day"); |
1589 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1588 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1590 | state => $CFG->{show_tips}, |
1589 | state => $CFG->{show_tips}, |
1591 | tooltip => "Show the <b>Tip of the day</b> window at startup?", |
1590 | tooltip => "Show the <b>Tip of the day</b> window at startup?", |
1592 | on_changed => sub { |
1591 | on_changed => sub { |
1593 | my ($self, $value) = @_; |
1592 | my ($self, $value) = @_; |
1594 | $CFG->{show_tips} = $value; |
1593 | $CFG->{show_tips} = $value; |
1595 | 0 |
1594 | 0 |
1596 | } |
1595 | } |
1597 | ); |
1596 | ); |
1598 | |
1597 | |
1599 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Messages Window Size"); |
1598 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Messages Window Size"); |
1600 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
1599 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
1601 | text => $CFG->{logview_max_par}, |
1600 | text => $CFG->{logview_max_par}, |
1602 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1601 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1603 | . "sends more messages than this number, older messages get removed to save memory and " |
1602 | . "sends more messages than this number, older messages get removed to save memory and " |
1604 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1603 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
1605 | on_changed => sub { |
1604 | on_changed => sub { |
1606 | my ($self, $value) = @_; |
1605 | my ($self, $value) = @_; |
1607 | $MESSAGE_WINDOW->set_max_para ($CFG->{logview_max_par} = $value*1); |
1606 | $MESSAGE_DIST->set_max_para ($CFG->{logview_max_par} = $value*1); |
1608 | 0 |
1607 | 0 |
1609 | }, |
1608 | }, |
1610 | ); |
1609 | ); |
1611 | |
1610 | |
1612 | $table |
1611 | $table |
… | |
… | |
1738 | |
1737 | |
1739 | sub inventory_widget { |
1738 | sub inventory_widget { |
1740 | my $hb = new DC::UI::HBox homogeneous => 1; |
1739 | my $hb = new DC::UI::HBox homogeneous => 1; |
1741 | |
1740 | |
1742 | $hb->add (my $vb1 = new DC::UI::VBox); |
1741 | $hb->add (my $vb1 = new DC::UI::VBox); |
1743 | $vb1->add (new DC::UI::Label align => 0, text => "Player"); |
1742 | $vb1->add (new DC::UI::Label text => "Player"); |
1744 | |
1743 | |
1745 | $vb1->add (my $hb1 = new DC::UI::HBox); |
1744 | $vb1->add (my $hb1 = new DC::UI::HBox); |
1746 | |
1745 | |
1747 | use sort 'stable'; |
1746 | use sort 'stable'; |
1748 | |
1747 | |
… | |
… | |
1758 | $INV->set_sort_order ($SORT_ORDER{$_[1]}); |
1757 | $INV->set_sort_order ($SORT_ORDER{$_[1]}); |
1759 | }, |
1758 | }, |
1760 | ); |
1759 | ); |
1761 | $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1); |
1760 | $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1); |
1762 | #TODO# update to weigh/maxweight |
1761 | #TODO# update to weigh/maxweight |
1763 | $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => -1); |
1762 | $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => 0); |
1764 | |
1763 | |
1765 | $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1764 | $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1766 | $sw1->add ($INV = new DC::UI::Inventory); |
1765 | $sw1->add ($INV = new DC::UI::Inventory); |
1767 | $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); |
1766 | $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); |
1768 | |
1767 | |
… | |
… | |
2172 | |
2171 | |
2173 | $MAPWIDGET = new DC::MapWidget; |
2172 | $MAPWIDGET = new DC::MapWidget; |
2174 | $MAPWIDGET->connect (activate_console => sub { |
2173 | $MAPWIDGET->connect (activate_console => sub { |
2175 | my ($mapwidget, $preset) = @_; |
2174 | my ($mapwidget, $preset) = @_; |
2176 | |
2175 | |
2177 | $MESSAGE_WINDOW->activate_console ($preset) |
2176 | $MESSAGE_DIST->activate_console ($preset) |
2178 | if $MESSAGE_WINDOW; |
2177 | if $MESSAGE_DIST; |
2179 | }); |
2178 | }); |
2180 | $MAPWIDGET->show; |
2179 | $MAPWIDGET->show; |
2181 | $MAPWIDGET->grab_focus; |
2180 | $MAPWIDGET->grab_focus; |
2182 | |
2181 | |
2183 | $COMPLETER = new DC::MapWidget::Command:: |
2182 | $COMPLETER = new DC::MapWidget::Command:: |
… | |
… | |
2195 | force_h => $::HEIGHT * 0.6, |
2194 | force_h => $::HEIGHT * 0.6, |
2196 | has_close_button => 1, |
2195 | has_close_button => 1, |
2197 | ; |
2196 | ; |
2198 | |
2197 | |
2199 | $METASERVER = metaserver_dialog; |
2198 | $METASERVER = metaserver_dialog; |
2200 | $MESSAGE_WINDOW = new DC::UI::MessageWindow; |
2199 | $MESSAGE_WINDOW = new DC::UI::Dockbar; |
|
|
2200 | $MESSAGE_DIST = new DC::MessageDistributor dockbar => $MESSAGE_WINDOW; |
2201 | |
2201 | |
2202 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, |
2202 | $SETUP_DIALOG->add ($SETUP_NOTEBOOK = new DC::UI::Notebook expand => 1, debug => 1, |
2203 | filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2203 | filter => new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
2204 | |
2204 | |
2205 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
2205 | $SETUP_NOTEBOOK->add_tab (Login => $SETUP_LOGIN = login_setup, |
… | |
… | |
2294 | $DC::UI::ROOT->draw; |
2294 | $DC::UI::ROOT->draw; |
2295 | DC::SDL_GL_SwapBuffers; |
2295 | DC::SDL_GL_SwapBuffers; |
2296 | $LAST_REFRESH = $NOW; |
2296 | $LAST_REFRESH = $NOW; |
2297 | } |
2297 | } |
2298 | |
2298 | |
2299 | my $want_refresh = EV::idle_ns \&force_refresh; |
2299 | my $want_refresh = EV::prepare_ns \&force_refresh; |
2300 | |
2300 | |
2301 | my $input = EV::periodic 0, 1/60, undef, sub { |
2301 | my $input = EV::periodic 0, 1 / $MAX_FPS, undef, sub { |
2302 | $NOW = time; |
2302 | $NOW = EV::now; |
2303 | |
2303 | |
2304 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2304 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2305 | for DC::poll_events; |
2305 | for DC::poll_events; |
2306 | |
2306 | |
2307 | if (%animate_object) { |
2307 | if (%animate_object) { |