… | |
… | |
122 | $EV::DIED = sub { |
122 | $EV::DIED = sub { |
123 | DC::fatal Carp::longmess $@; |
123 | DC::fatal Carp::longmess $@; |
124 | }; |
124 | }; |
125 | |
125 | |
126 | my $MAX_FPS = 60; |
126 | my $MAX_FPS = 60; |
127 | my $MIN_FPS = 5; # unused as of yet |
|
|
128 | |
127 | |
129 | our $META_SERVER = "http://metaserver.schmorp.de/current.json"; |
128 | our $META_SERVER = "http://metaserver.schmorp.de/current.json"; |
130 | |
129 | |
131 | our $LAST_REFRESH; |
130 | our $LAST_REFRESH; |
132 | our $NOW; |
131 | our $NOW; |
… | |
… | |
654 | [Cha => CS_STAT_CHA], |
653 | [Cha => CS_STAT_CHA], |
655 | ) { |
654 | ) { |
656 | my ($name, $id) = @$_; |
655 | my ($name, $id) = @$_; |
657 | $hbox->add (new DC::UI::Label |
656 | $hbox->add (new DC::UI::Label |
658 | markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>", |
657 | markup => "$conn->{stat}{$id} <span foreground='yellow'>$name</span>", |
659 | align => 0, |
|
|
660 | expand => 1, |
658 | expand => 1, |
661 | can_events => 1, |
659 | can_events => 1, |
662 | can_hover => 1, |
660 | can_hover => 1, |
663 | tooltip => "#stat_$name", |
661 | tooltip => "#stat_$name", |
664 | ); |
662 | ); |
… | |
… | |
770 | |
768 | |
771 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]); |
769 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]); |
772 | |
770 | |
773 | my $row = 0; |
771 | my $row = 0; |
774 | |
772 | |
775 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "OpenGL Info"); |
773 | $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, |
774 | $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, |
775 | can_events => 1, |
778 | tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>"); |
776 | tooltip => "<tt><span size='8192'>" . (DC::OpenGL::gl_extensions) . "</span></tt>"); |
779 | |
777 | |
780 | my $vidmode_tooltip = |
778 | my $vidmode_tooltip = |
781 | "<b>Video Mode.</b> The video mode to use for fullscreen (and the window size for windowed operation). " |
779 | "<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>."; |
780 | . "The format is <i>width</i> x <i>height</i> \@ <i>depth-per-channel</i> + <i>alpha-channel</i>."; |
783 | |
781 | |
784 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Video Mode"); |
782 | $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); |
783 | $table->add_at (1, $row++, my $hbox = new DC::UI::HBox); |
786 | |
784 | |
787 | $hbox->add (my $mode_slider = new DC::UI::Slider |
785 | $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], |
786 | force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1], |
789 | tooltip => $vidmode_tooltip); |
787 | tooltip => $vidmode_tooltip); |
790 | $hbox->add (my $mode_label = new DC::UI::Label |
788 | $hbox->add (my $mode_label = new DC::UI::Label |
791 | align => 0, valign => 0, height => 0.8, template => "9999x9999@9+9", |
789 | height => 0.8, template => "9999x9999@9+9", |
792 | can_events => 1, tooltip => $vidmode_tooltip); |
790 | can_events => 1, tooltip => $vidmode_tooltip); |
793 | |
791 | |
794 | $mode_slider->connect (changed => sub { |
792 | $mode_slider->connect (changed => sub { |
795 | my ($self, $value) = @_; |
793 | my ($self, $value) = @_; |
796 | |
794 | |
797 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
795 | $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; |
798 | $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]}); |
796 | $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]}); |
799 | }); |
797 | }); |
800 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
798 | $mode_slider->emit (changed => $mode_slider->{range}[0]); |
801 | |
799 | |
802 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fullscreen"); |
800 | $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 |
801 | $table->add_at (1, $row++, $FULLSCREEN_ENABLE = new DC::UI::CheckBox |
804 | state => $CFG->{fullscreen}, |
802 | state => $CFG->{fullscreen}, |
805 | tooltip => "Bring the client into fullscreen mode.", |
803 | tooltip => "Bring the client into fullscreen mode.", |
806 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
804 | on_changed => sub { my ($self, $value) = @_; $CFG->{fullscreen} = $value; 0 } |
807 | ); |
805 | ); |
808 | |
806 | |
809 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Force OpenGL 1.1"); |
807 | $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 |
808 | $table->add_at (1, $row++, new DC::UI::CheckBox |
811 | state => $CFG->{force_opengl11}, |
809 | state => $CFG->{force_opengl11}, |
812 | tooltip => "Limit CFPlus to use OpenGL 1.1 features only. This will normally result in " |
810 | tooltip => "Limit CFPlus 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 " |
811 | . "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. " |
812 | . "cards that claim to support a feature but fall back to software rendering. " |
… | |
… | |
816 | . "but cards and drivers from other vendors (ATI) are often just as bad. <b>If you " |
814 | . "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>", |
815 | . "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 } |
816 | on_changed => sub { my ($self, $value) = @_; $CFG->{force_opengl11} = $value; 0 } |
819 | ); |
817 | ); |
820 | |
818 | |
821 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Compress Textures"); |
819 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Compress Textures"); |
822 | $table->add_at (1, $row++, new DC::UI::CheckBox |
820 | $table->add_at (1, $row++, new DC::UI::CheckBox |
823 | state => $CFG->{texture_compression}, |
821 | state => $CFG->{texture_compression}, |
824 | tooltip => "Use texture compression. Normally this will not reduce visual quality noticable but " |
822 | 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 " |
823 | . "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 " |
824 | . "can differ form card to card, so your mileage may vary. This setting is ignored in " |
827 | . "forced OpenGL 1.1 mode.", |
825 | . "forced OpenGL 1.1 mode.", |
828 | on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } |
826 | on_changed => sub { my ($self, $value) = @_; $CFG->{texture_compression} = $value; 0 } |
829 | ); |
827 | ); |
830 | |
828 | |
831 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fast & Ugly"); |
829 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Fast & Ugly"); |
832 | $table->add_at (1, $row++, new DC::UI::CheckBox |
830 | $table->add_at (1, $row++, new DC::UI::CheckBox |
833 | state => $CFG->{fast}, |
831 | state => $CFG->{fast}, |
834 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
832 | tooltip => "Lower the visual quality considerably to speed up rendering.", |
835 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
833 | on_changed => sub { my ($self, $value) = @_; $CFG->{fast} = $value; 0 } |
836 | ); |
834 | ); |
837 | |
835 | |
838 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "GUI Fontsize"); |
836 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "GUI Fontsize"); |
839 | $table->add_at (1, $row++, new DC::UI::Slider |
837 | $table->add_at (1, $row++, new DC::UI::Slider |
840 | range => [$CFG->{gui_fontsize}, 0.5, 2, 0, 0.1], |
838 | 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.", |
839 | 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 }, |
840 | on_changed => sub { $CFG->{gui_fontsize} = $_[1]; 0 }, |
843 | ); |
841 | ); |
844 | |
842 | |
845 | $table->add_at (1, $row++, new DC::UI::Button |
843 | $table->add_at (1, $row++, new DC::UI::Button |
846 | expand => 1, align => 0, text => "Apply", |
844 | expand => 1, text => "Apply", |
847 | tooltip => "Apply the video settings above.", |
845 | tooltip => "Apply the video settings above.", |
848 | on_activate => sub { |
846 | on_activate => sub { |
849 | video_shutdown (); |
847 | video_shutdown (); |
850 | video_init (); |
848 | video_init (); |
851 | 0 |
849 | 0 |
852 | } |
850 | } |
853 | ); |
851 | ); |
854 | |
852 | |
855 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Scale"); |
853 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Scale"); |
856 | $table->add_at (1, $row++, new DC::UI::Slider |
854 | $table->add_at (1, $row++, new DC::UI::Slider |
857 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
855 | range => [(log $CFG->{map_scale}) / (log 2), -3, 1, 0, 1], |
858 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
856 | tooltip => "Enlarge or shrink the displayed map. Changes are instant.", |
859 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
857 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } |
860 | ); |
858 | ); |
861 | |
859 | |
862 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Map Smoothing"); |
860 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Map Smoothing"); |
863 | $table->add_at (1, $row++, new DC::UI::CheckBox |
861 | $table->add_at (1, $row++, new DC::UI::CheckBox |
864 | state => $CFG->{map_smoothing}, |
862 | state => $CFG->{map_smoothing}, |
865 | tooltip => "<b>Map Smoothing</b> tries to make tile borders less square. " |
863 | 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. " |
864 | . "This increases load on the graphics subsystem and works only with TRT servers. " |
867 | . "Changes take effect at next login only.", |
865 | . "Changes take effect at next login only.", |
868 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } |
866 | on_changed => sub { my ($self, $value) = @_; $CFG->{map_smoothing} = $value; 0 } |
869 | ); |
867 | ); |
870 | |
868 | |
871 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Fog of War"); |
869 | $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 |
870 | $table->add_at (1, $row++, new DC::UI::CheckBox |
873 | state => $CFG->{fow_enable}, |
871 | state => $CFG->{fow_enable}, |
874 | tooltip => "<b>Fog-of-War</b> marks areas that cannot be seen by the player. Changes are instant.", |
872 | 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 } |
873 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_enable} = $value; 0 } |
876 | ); |
874 | ); |
877 | |
875 | |
878 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "FoW Intensity"); |
876 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "FoW Intensity"); |
879 | $table->add_at (1, $row++, new DC::UI::Slider |
877 | $table->add_at (1, $row++, new DC::UI::Slider |
880 | range => [$CFG->{fow_intensity}, 0, 1, 0, 1 / 256], |
878 | 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.", |
879 | 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 } |
880 | on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } |
883 | ); |
881 | ); |
884 | |
882 | |
885 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Message Fontsize"); |
883 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Message Fontsize"); |
886 | $table->add_at (1, $row++, new DC::UI::Slider |
884 | $table->add_at (1, $row++, new DC::UI::Slider |
887 | range => [$CFG->{log_fontsize}, 0.5, 2, 0, 0.1], |
885 | 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, " |
886 | 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.", |
887 | . "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 }, |
888 | on_changed => sub { $MESSAGE_WINDOW->set_fontsize ($CFG->{log_fontsize} = $_[1]); 0 }, |
891 | ); |
889 | ); |
892 | |
890 | |
893 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge fontsize"); |
891 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge fontsize"); |
894 | $table->add_at (1, $row++, new DC::UI::Slider |
892 | $table->add_at (1, $row++, new DC::UI::Slider |
895 | range => [$CFG->{gauge_fontsize}, 0.5, 2, 0, 0.1], |
893 | 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.", |
894 | tooltip => "Adjusts the fontsize of the gauges at the bottom right. Changes are instant.", |
897 | on_changed => sub { |
895 | on_changed => sub { |
898 | $CFG->{gauge_fontsize} = $_[1]; |
896 | $CFG->{gauge_fontsize} = $_[1]; |
899 | &set_gauge_window_fontsize; |
897 | &set_gauge_window_fontsize; |
900 | 0 |
898 | 0 |
901 | } |
899 | } |
902 | ); |
900 | ); |
903 | |
901 | |
904 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Gauge size"); |
902 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Gauge size"); |
905 | $table->add_at (1, $row++, new DC::UI::Slider |
903 | $table->add_at (1, $row++, new DC::UI::Slider |
906 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
904 | range => [$CFG->{gauge_size}, 0.2, 0.8], |
907 | tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", |
905 | tooltip => "Adjust the size of the stats gauges at the bottom right. Changes are instant.", |
908 | on_changed => sub { |
906 | on_changed => sub { |
909 | $CFG->{gauge_size} = $_[1]; |
907 | $CFG->{gauge_size} = $_[1]; |
… | |
… | |
943 | |
941 | |
944 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); |
942 | $vbox->add (my $table = new DC::UI::Table expand => 1, col_expand => [0, 0, 1]); |
945 | |
943 | |
946 | my $row = 0; |
944 | my $row = 0; |
947 | |
945 | |
948 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Audio Enable"); |
946 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Audio Enable"); |
949 | $table->add_at (1, $row++, new DC::UI::CheckBox |
947 | $table->add_at (1, $row++, new DC::UI::CheckBox |
950 | state => $CFG->{audio_enable}, |
948 | 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.", |
949 | 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 } |
950 | on_changed => sub { $CFG->{audio_enable} = $_[1]; 1 } |
953 | ); |
951 | ); |
954 | |
952 | |
955 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Sound Effects"); |
953 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Sound Effects"); |
956 | $table->add_at (1, $row, new DC::UI::CheckBox |
954 | $table->add_at (1, $row, new DC::UI::CheckBox |
957 | expand => 1, state => $CFG->{effects_enable}, |
955 | expand => 1, state => $CFG->{effects_enable}, |
958 | tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", |
956 | tooltip => "If enabled, sound effects are enabled. If disabled, no sound effects will be played.", |
959 | on_changed => sub { |
957 | on_changed => sub { |
960 | $CFG->{effects_enable} = $_[1]; |
958 | $CFG->{effects_enable} = $_[1]; |
… | |
… | |
967 | tooltip => "The relative volume of sound effects. Best audio quality is achieved if this " |
965 | 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.", |
966 | . "is set highest (rightmost) and you use your operating system volume setting. Changes are instant.", |
969 | on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 } |
967 | on_changed => sub { $CFG->{effects_volume} = $_[1]; 1 } |
970 | ); |
968 | ); |
971 | |
969 | |
972 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Background Music"); |
970 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Background Music"); |
973 | $table->add_at (1, $row, new DC::UI::CheckBox |
971 | $table->add_at (1, $row, new DC::UI::CheckBox |
974 | expand => 1, state => $CFG->{bgm_enable}, |
972 | expand => 1, state => $CFG->{bgm_enable}, |
975 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
973 | tooltip => "If enabled, playing of background music is enabled. If disabled, no background music will be played.", |
976 | on_changed => sub { |
974 | on_changed => sub { |
977 | $CFG->{bgm_enable} = $_[1]; |
975 | $CFG->{bgm_enable} = $_[1]; |
… | |
… | |
984 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
982 | expand => 1, range => [$CFG->{bgm_volume}, 0, 1, 0, 1/128], |
985 | tooltip => "The volume of the background music. Changes are instant.", |
983 | tooltip => "The volume of the background music. Changes are instant.", |
986 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } |
984 | on_changed => sub { $CFG->{bgm_volume} = $_[1]; audio_music_update_volume; 0 } |
987 | ); |
985 | ); |
988 | |
986 | |
989 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Frequency"); |
987 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Frequency"); |
990 | $table->add_at (1, $row++, new DC::UI::Selector |
988 | $table->add_at (1, $row++, new DC::UI::Selector |
991 | c_colspan => 2, expand => 1, |
989 | c_colspan => 2, expand => 1, |
992 | value => $CFG->{audio_hw_frequency}, |
990 | value => $CFG->{audio_hw_frequency}, |
993 | options => [ |
991 | options => [ |
994 | [ 0, "default" , "Use System Default"], |
992 | [ 0, "default" , "Use System Default"], |
… | |
… | |
1003 | audio_tab_update; |
1001 | audio_tab_update; |
1004 | 1 |
1002 | 1 |
1005 | } |
1003 | } |
1006 | ); |
1004 | ); |
1007 | |
1005 | |
1008 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Channels"); |
1006 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Channels"); |
1009 | $table->add_at (1, $row++, new DC::UI::Selector |
1007 | $table->add_at (1, $row++, new DC::UI::Selector |
1010 | c_colspan => 2, expand => 1, |
1008 | c_colspan => 2, expand => 1, |
1011 | value => $CFG->{audio_hw_channels}, |
1009 | value => $CFG->{audio_hw_channels}, |
1012 | options => [ |
1010 | options => [ |
1013 | [0, "default" , "Use System Default"], |
1011 | [0, "default" , "Use System Default"], |
… | |
… | |
1022 | audio_tab_update; |
1020 | audio_tab_update; |
1023 | 1 |
1021 | 1 |
1024 | } |
1022 | } |
1025 | ); |
1023 | ); |
1026 | |
1024 | |
1027 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Latency"); |
1025 | $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 |
1026 | $table->add_at (1, $row++, $AUDIO_HW_CHUNKSIZE = new DC::UI::Selector |
1029 | c_colspan => 2, expand => 1, |
1027 | c_colspan => 2, expand => 1, |
1030 | value => $CFG->{audio_hw_chunksize}, |
1028 | 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 " |
1029 | 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.", |
1030 | . "is stuttering, increase this value. Values of 50-100ms are optimal.", |
… | |
… | |
1036 | 1 |
1034 | 1 |
1037 | } |
1035 | } |
1038 | ); |
1036 | ); |
1039 | |
1037 | |
1040 | # should really be a slider |
1038 | # should really be a slider |
1041 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Mixer Voices"); |
1039 | $table->add_at (0, $row, new DC::UI::Label align => 1, text => "Mixer Voices"); |
1042 | $table->add_at (1, $row++, new DC::UI::ValSlider |
1040 | $table->add_at (1, $row++, new DC::UI::ValSlider |
1043 | c_colspan => 2, expand => 1, |
1041 | 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.", |
1042 | 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], |
1043 | range => [$::CFG->{audio_mix_channels}, 4, 32, 0, 1], |
1046 | template => ">= 99", |
1044 | template => ">= 99", |
… | |
… | |
1052 | 1; |
1050 | 1; |
1053 | } |
1051 | } |
1054 | ); |
1052 | ); |
1055 | |
1053 | |
1056 | $table->add_at (1, $row++, new DC::UI::Button |
1054 | $table->add_at (1, $row++, new DC::UI::Button |
1057 | c_colspan => 2, expand => 1, align => 0, text => "Apply", |
1055 | c_colspan => 2, expand => 1, text => "Apply", |
1058 | tooltip => "Apply the audio settings", |
1056 | tooltip => "Apply the audio settings", |
1059 | on_activate => sub { |
1057 | on_activate => sub { |
1060 | audio_shutdown (); |
1058 | audio_shutdown (); |
1061 | audio_init (); |
1059 | audio_init (); |
1062 | 0 |
1060 | 0 |
… | |
… | |
1112 | $hb->add (my $hg = new DC::UI::Gauge type => 'hp', tooltip => "#stat_health"); |
1110 | $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"); |
1111 | $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"); |
1112 | $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"); |
1113 | $hb->add (my $fg = new DC::UI::Gauge type => 'food', tooltip => "#stat_food"); |
1116 | |
1114 | |
1117 | $vbox->add (my $exp = new DC::UI::Label valign => 0, align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_exp"); |
1115 | $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); |
1116 | $vbox->add (my $prg = new DC::UI::ExperienceProgress); |
1119 | $vbox->add (my $sklprg = new DC::UI::ExperienceProgress); |
1117 | $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"); |
1118 | $vbox->add (my $rng = new DC::UI::Label align => 1, can_hover => 1, can_events => 1, tooltip => "#stat_ranged"); |
1121 | |
1119 | |
1122 | $GAUGES = { |
1120 | $GAUGES = { |
1123 | exp => $exp, prg => $prg, sklprg => $sklprg, |
1121 | exp => $exp, prg => $prg, sklprg => $sklprg, |
1124 | win => $win, range => $rng, |
1122 | win => $win, range => $rng, |
1125 | hp => $hg, mana => $mg, grace => $gg, food => $fg, |
1123 | 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 }); |
1139 | $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"); |
1140 | $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 }); |
1141 | $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() } ); |
1142 | $table->add_at (0, 4, new DC::UI::Button text => "die on click(tm)", on_activate => sub { &DC::debug() } ); |
1145 | |
1143 | |
1146 | $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153");#d# |
1144 | $table->add_at (0, 5, new DC::UI::TextEdit text => "line1\0152\0153\nµikachu\nづx゙つ゛");#d# |
1147 | |
1145 | |
1148 | $table->add_at (7,7, my $t = new DC::UI::Table expand => 0); |
1146 | $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); |
1147 | $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); |
1148 | $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); |
1149 | $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); |
1150 | $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"); |
1151 | $t->add_at (1,1, new DC::UI::Label text => "e"); |
1154 | |
1152 | |
1155 | $table->add_at (7, 6, my $c = new DC::UI::Canvas); |
1153 | $table->add_at (7, 6, my $c = new DC::UI::Canvas); |
1156 | |
1154 | |
1157 | $c->add_items ({ |
1155 | $c->add_items ({ |
… | |
… | |
1191 | $vb->add (new DC::UI::FancyFrame |
1189 | $vb->add (new DC::UI::FancyFrame |
1192 | label => "Player", |
1190 | label => "Player", |
1193 | child => (my $pi = new DC::UI::VBox), |
1191 | child => (my $pi = new DC::UI::VBox), |
1194 | ); |
1192 | ); |
1195 | |
1193 | |
1196 | $pi->add ($STATWIDS->{title} = new DC::UI::Label valign => 0, align => -1, text => "Title:", expand => 1, |
1194 | $pi->add ($STATWIDS->{title} = new DC::UI::Label text => "Title:", expand => 1, align => 0, |
1197 | can_hover => 1, can_events => 1, |
1195 | 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."); |
1196 | 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, |
1197 | $pi->add ($STATWIDS->{map} = new DC::UI::Label align => 0, text => "Map:", expand => 1, |
1200 | can_hover => 1, can_events => 1, |
1198 | can_hover => 1, can_events => 1, |
1201 | tooltip => "The map you are currently on (if supported by the server)."); |
1199 | tooltip => "The map you are currently on (if supported by the server)."); |
1202 | |
1200 | |
1203 | $pi->add (my $hb0 = new DC::UI::HBox); |
1201 | $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, |
1202 | $hb0->add ($STATWIDS->{weight} = new DC::UI::Label text => "Weight:", expand => 1, align => 0, |
1205 | can_hover => 1, can_events => 1, |
1203 | can_hover => 1, can_events => 1, |
1206 | tooltip => "The weight of the player including all inventory items."); |
1204 | 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, |
1205 | $hb0->add ($STATWIDS->{m_weight} = new DC::UI::Label align => 0, text => "Max weight:", expand => 1, |
1208 | can_hover => 1, can_events => 1, |
1206 | can_hover => 1, can_events => 1, |
1209 | tooltip => "The weight limit: you cannot carry more than this."); |
1207 | tooltip => "The weight limit: you cannot carry more than this."); |
1210 | |
1208 | |
1211 | $vb->add (new DC::UI::FancyFrame |
1209 | $vb->add (new DC::UI::FancyFrame |
1212 | label => "Primary/Secondary Statistics", |
1210 | label => "Primary/Secondary Statistics", |
… | |
… | |
1233 | [2, 5, st_wspd => "WSp", 10.54], |
1231 | [2, 5, st_wspd => "WSp", 10.54], |
1234 | ) { |
1232 | ) { |
1235 | my ($col, $row, $id, $label, $template) = @$_; |
1233 | my ($col, $row, $id, $label, $template) = @$_; |
1236 | |
1234 | |
1237 | $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label |
1235 | $tbl->add_at ($col , $row, $STATWIDS->{$id} = new DC::UI::Label |
1238 | font => $FONT_FIXED, can_hover => 1, can_events => 1, valign => 0, |
1236 | font => $FONT_FIXED, can_hover => 1, can_events => 1, |
1239 | align => +1, template => $template, tooltip => "#stat_$label"); |
1237 | align => 1, template => $template, tooltip => "#stat_$label"); |
1240 | $tbl->add_at ($col + 1, $row, $STATWIDS->{"$id\_lbl"} = new DC::UI::Label |
1238 | $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, |
1239 | font => $FONT_FIXED, can_hover => 1, can_events => 1, fg => $color2, |
1242 | align => -1, text => $label, tooltip => "#stat_$label"); |
1240 | align => 0, text => $label, tooltip => "#stat_$label"); |
1243 | } |
1241 | } |
1244 | |
1242 | |
1245 | $vb->add (new DC::UI::FancyFrame |
1243 | $vb->add (new DC::UI::FancyFrame |
1246 | label => "Resistancies", |
1244 | label => "Resistancies", |
1247 | child => (my $tbl2 = new DC::UI::Table expand => 1), |
1245 | child => (my $tbl2 = new DC::UI::Table expand => 1, col_expand => [1, 1, 0, 1, 1, 1, 0, 1, 1, 1, 0]), |
1248 | ); |
1246 | ); |
1249 | |
1247 | |
1250 | my $row = 0; |
1248 | my $row = 0; |
1251 | my $col = 0; |
1249 | my $col = 0; |
1252 | |
1250 | |
… | |
… | |
1291 | |
1289 | |
1292 | for (qw/slow holyw conf fire depl magic |
1290 | for (qw/slow holyw conf fire depl magic |
1293 | drain acid pois para deat phys |
1291 | drain acid pois para deat phys |
1294 | blind fear tund elec cold ghit/) |
1292 | blind fear tund elec cold ghit/) |
1295 | { |
1293 | { |
1296 | $tbl2->add_at ($col, $row, |
1294 | $tbl2->add_at ($col + 2, $row, |
1297 | $STATWIDS->{"res_$_"} = |
1295 | $STATWIDS->{"res_$_"} = |
1298 | new DC::UI::Label |
1296 | new DC::UI::Label |
1299 | font => $FONT_FIXED, |
1297 | font => $FONT_FIXED, |
1300 | template => "-100%", |
1298 | template => "-100%", |
1301 | align => +1, |
1299 | align => 1, |
1302 | valign => 0, |
|
|
1303 | can_events => 1, |
1300 | can_events => 1, |
1304 | can_hover => 1, |
1301 | can_hover => 1, |
1305 | tooltip => $resist_names{$_}->[1], |
1302 | tooltip => $resist_names{$_}->[1], |
1306 | ); |
1303 | ); |
1307 | $tbl2->add_at ($col + 1, $row, new DC::UI::Image |
1304 | $tbl2->add_at ($col + 1, $row, new DC::UI::Image |
… | |
… | |
1309 | can_hover => 1, |
1306 | can_hover => 1, |
1310 | can_events => 1, |
1307 | can_events => 1, |
1311 | path => "ui/resist/resist_$_.png", |
1308 | path => "ui/resist/resist_$_.png", |
1312 | tooltip => $resist_names{$_}->[1], |
1309 | tooltip => $resist_names{$_}->[1], |
1313 | ); |
1310 | ); |
1314 | $tbl2->add_at ($col + 2, $row, new DC::UI::Label |
1311 | $tbl2->add_at ($col + 0, $row, new DC::UI::Label |
1315 | text => $resist_names{$_}->[0], |
1312 | text => $resist_names{$_}->[0], |
1316 | font => $FONT_FIXED, |
1313 | font => $FONT_FIXED, |
|
|
1314 | align => 1, |
1317 | can_hover => 1, |
1315 | can_hover => 1, |
1318 | can_events => 1, |
1316 | can_events => 1, |
1319 | tooltip => $resist_names{$_}->[1], |
1317 | tooltip => $resist_names{$_}->[1], |
1320 | ); |
1318 | ); |
1321 | |
1319 | |
1322 | $row++; |
1320 | $row++; |
1323 | if ($row % 6 == 0) { |
1321 | if ($row % 6 == 0) { |
1324 | $col += 3; |
1322 | $col += 4; |
1325 | $row = 0; |
1323 | $row = 0; |
1326 | } |
1324 | } |
1327 | } |
1325 | } |
1328 | |
1326 | |
1329 | #update_stats_window ({}); |
1327 | #update_stats_window ({}); |
… | |
… | |
1375 | "The time this server has been running without being restarted.", |
1373 | "The time this server has been running without being restarted.", |
1376 | "Short information about this server provided by its admins.", |
1374 | "Short information about this server provided by its admins.", |
1377 | ); |
1375 | ); |
1378 | my @col = qw(#Users Host Uptime Version Description); |
1376 | my @col = qw(#Users Host Uptime Version Description); |
1379 | $table->add_at ($_, 0, new DC::UI::Label |
1377 | $table->add_at ($_, 0, new DC::UI::Label |
1380 | can_hover => 1, can_events => 1, |
1378 | can_hover => 1, can_events => 1, fg => [1, 1, 0], |
1381 | align => 0, fg => [1, 1, 0], |
|
|
1382 | text => $col[$_], tooltip => $tip[$_]) |
1379 | text => $col[$_], tooltip => $tip[$_]) |
1383 | for 0 .. $#col; |
1380 | for 0 .. $#col; |
1384 | |
1381 | |
1385 | my @align = qw(1 0 1 1 -1); |
1382 | my @align = qw(1 0.5 1 1 0); |
1386 | |
1383 | |
1387 | my $y = 0; |
1384 | my $y = 0; |
1388 | for my $m (@{ $msg->{servers} }) { |
1385 | for my $m (@{ $msg->{servers} }) { |
1389 | my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) = |
1386 | my ($ip, $last, $host, $users, $version, $desc, $ibytes, $obytes, $uptime, $highlight) = |
1390 | @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)}; |
1387 | @$m{qw(ip age hostname users version description ibytes obytes uptime highlight)}; |
… | |
… | |
1471 | $vbox->add (new DC::UI::FancyFrame |
1468 | $vbox->add (new DC::UI::FancyFrame |
1472 | label => "Login Settings", |
1469 | label => "Login Settings", |
1473 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1470 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1474 | ); |
1471 | ); |
1475 | |
1472 | |
1476 | $table->add_at (0, 4, new DC::UI::Label valign => 0, align => 1, text => "Username"); |
1473 | $table->add_at (0, 4, new DC::UI::Label align => 1, text => "Username"); |
1477 | $table->add_at (1, 4, new DC::UI::Entry |
1474 | $table->add_at (1, 4, new DC::UI::Entry |
1478 | text => $CFG->{profile}{default}{user}, |
1475 | text => $CFG->{profile}{default}{user}, |
1479 | tooltip => "The name of your character on the server.", |
1476 | tooltip => "The name of your character on the server.", |
1480 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1477 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{user} = $value; 1 } |
1481 | ); |
1478 | ); |
1482 | |
1479 | |
1483 | $table->add_at (0, 5, new DC::UI::Label valign => 0, align => 1, text => "Password"); |
1480 | $table->add_at (0, 5, new DC::UI::Label align => 1, text => "Password"); |
1484 | $table->add_at (1, 5, new DC::UI::Entry |
1481 | $table->add_at (1, 5, new DC::UI::Entry |
1485 | text => $CFG->{profile}{default}{password}, |
1482 | text => $CFG->{profile}{default}{password}, |
1486 | hidden => 1, |
1483 | hidden => 1, |
1487 | tooltip => "The password for your character.", |
1484 | tooltip => "The password for your character.", |
1488 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1485 | on_changed => sub { my ($self, $value) = @_; $CFG->{profile}{default}{password} = $value; 1 } |
1489 | ); |
1486 | ); |
1490 | |
1487 | |
1491 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1488 | $table->add_at (1, 11, $LOGIN_BUTTON = new DC::UI::Button |
1492 | expand => 1, |
1489 | expand => 1, |
1493 | align => 0, |
|
|
1494 | text => "Login / Register", |
1490 | text => "Login / Register", |
1495 | tooltip => "This button will either login to the account configured above or register a new account.", |
1491 | tooltip => "This button will either login to the account configured above or register a new account.", |
1496 | on_activate => sub { |
1492 | on_activate => sub { |
1497 | $CONN ? stop_game |
1493 | $CONN ? stop_game |
1498 | : start_game; |
1494 | : start_game; |
… | |
… | |
1501 | ); |
1497 | ); |
1502 | |
1498 | |
1503 | $vbox->add (new DC::UI::FancyFrame |
1499 | $vbox->add (new DC::UI::FancyFrame |
1504 | label => "Registering", |
1500 | label => "Registering", |
1505 | min_h => 200, |
1501 | min_h => 200, |
1506 | child => (new DC::UI::Label valign => -1, ellipsise => 0, |
1502 | child => (new DC::UI::Label valign => 0, ellipsise => 0, |
1507 | markup => |
1503 | markup => |
1508 | "To register a new account, choose a username that hasn't been taken yet and " |
1504 | "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.", |
1505 | . "try to log-in. Follow the instructions in the Log tab in the message window.", |
1510 | ), |
1506 | ), |
1511 | ); |
1507 | ); |
… | |
… | |
1521 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1517 | child => (my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]), |
1522 | ); |
1518 | ); |
1523 | |
1519 | |
1524 | my $row = 0; |
1520 | my $row = 0; |
1525 | |
1521 | |
1526 | $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Host:Port"); |
1522 | $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Host:Port"); |
1527 | { |
1523 | { |
1528 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1524 | $table->add_at (1, $row, my $vbox = new DC::UI::VBox); |
1529 | |
1525 | |
1530 | $vbox->add ( |
1526 | $vbox->add ( |
1531 | $HOST_ENTRY = new DC::UI::Entry |
1527 | $HOST_ENTRY = new DC::UI::Entry |
… | |
… | |
1549 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, |
1545 | on_visibility_change => sub { $METASERVER->hide unless $_[1]; 1 }, |
1550 | ); |
1546 | ); |
1551 | }#d# |
1547 | }#d# |
1552 | } |
1548 | } |
1553 | |
1549 | |
1554 | $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Map Size"); |
1550 | $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Map Size"); |
1555 | $table->add_at (1, $row, new DC::UI::Slider |
1551 | $table->add_at (1, $row, new DC::UI::Slider |
1556 | force_w => 100, |
1552 | force_w => 100, |
1557 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1553 | range => [$CFG->{mapsize}, 10, 100, 0, 1], |
1558 | tooltip => "This is the size of the portion of the map update the server sends you. " |
1554 | 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, " |
1555 | . "If you set this to a high value you will be able to see further, " |
1560 | . "but you also increase bandwidth requirements and latency. " |
1556 | . "but you also increase bandwidth requirements and latency. " |
1561 | . "This option is only used once at log-in.", |
1557 | . "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 }, |
1558 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 1 }, |
1563 | ); |
1559 | ); |
1564 | |
1560 | |
1565 | $table->add_at (0, ++$row, new DC::UI::Label valign => 0, align => 1, text => "Output-Rate"); |
1561 | $table->add_at (0, ++$row, new DC::UI::Label align => 1, text => "Output-Rate"); |
1566 | $table->add_at (1, $row, new DC::UI::Entry |
1562 | $table->add_at (1, $row, new DC::UI::Entry |
1567 | text => $CFG->{output_rate}, |
1563 | text => $CFG->{output_rate}, |
1568 | tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " |
1564 | tooltip => "The maximum bandwidth in bytes per second that the server should not exceed " |
1569 | . "when sending data. When 0 or unset, the server " |
1565 | . "when sending data. When 0 or unset, the server " |
1570 | . "default will be used, which is usually around 100kb/s. Most servers will " |
1566 | . "default will be used, which is usually around 100kb/s. Most servers will " |
… | |
… | |
1583 | sub client_setup { |
1579 | sub client_setup { |
1584 | my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]; |
1580 | my $table = new DC::UI::Table expand => 1, col_expand => [0, 1]; |
1585 | |
1581 | |
1586 | my $row = 0; |
1582 | my $row = 0; |
1587 | |
1583 | |
1588 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Tip of the day"); |
1584 | $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 |
1585 | $table->add_at (1, $row++, new DC::UI::CheckBox |
1590 | state => $CFG->{show_tips}, |
1586 | state => $CFG->{show_tips}, |
1591 | tooltip => "Show the <b>Tip of the day</b> window at startup?", |
1587 | tooltip => "Show the <b>Tip of the day</b> window at startup?", |
1592 | on_changed => sub { |
1588 | on_changed => sub { |
1593 | my ($self, $value) = @_; |
1589 | my ($self, $value) = @_; |
1594 | $CFG->{show_tips} = $value; |
1590 | $CFG->{show_tips} = $value; |
1595 | 0 |
1591 | 0 |
1596 | } |
1592 | } |
1597 | ); |
1593 | ); |
1598 | |
1594 | |
1599 | $table->add_at (0, $row, new DC::UI::Label valign => 0, align => 1, text => "Messages Window Size"); |
1595 | $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 |
1596 | $table->add_at (1, $row++, my $saycmd = new DC::UI::Entry |
1601 | text => $CFG->{logview_max_par}, |
1597 | text => $CFG->{logview_max_par}, |
1602 | tooltip => "This is maximum number of messages remembered in the <b>Messages</b> window. If the server " |
1598 | 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 " |
1599 | . "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.", |
1600 | . "computing time. A value of <b>0</b> disables this feature, but that is not recommended.", |
… | |
… | |
1738 | |
1734 | |
1739 | sub inventory_widget { |
1735 | sub inventory_widget { |
1740 | my $hb = new DC::UI::HBox homogeneous => 1; |
1736 | my $hb = new DC::UI::HBox homogeneous => 1; |
1741 | |
1737 | |
1742 | $hb->add (my $vb1 = new DC::UI::VBox); |
1738 | $hb->add (my $vb1 = new DC::UI::VBox); |
1743 | $vb1->add (new DC::UI::Label align => 0, text => "Player"); |
1739 | $vb1->add (new DC::UI::Label text => "Player"); |
1744 | |
1740 | |
1745 | $vb1->add (my $hb1 = new DC::UI::HBox); |
1741 | $vb1->add (my $hb1 = new DC::UI::HBox); |
1746 | |
1742 | |
1747 | use sort 'stable'; |
1743 | use sort 'stable'; |
1748 | |
1744 | |
… | |
… | |
1758 | $INV->set_sort_order ($SORT_ORDER{$_[1]}); |
1754 | $INV->set_sort_order ($SORT_ORDER{$_[1]}); |
1759 | }, |
1755 | }, |
1760 | ); |
1756 | ); |
1761 | $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1); |
1757 | $hb1->add (new DC::UI::Label text => "Weight: ", align => 1, expand => 1); |
1762 | #TODO# update to weigh/maxweight |
1758 | #TODO# update to weigh/maxweight |
1763 | $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => -1); |
1759 | $hb1->add ($STATWIDS->{i_weight} = new DC::UI::Label align => 0); |
1764 | |
1760 | |
1765 | $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1761 | $vb1->add (my $sw1 = new DC::UI::ScrolledWindow expand => 1, scroll_y => 1); |
1766 | $sw1->add ($INV = new DC::UI::Inventory); |
1762 | $sw1->add ($INV = new DC::UI::Inventory); |
1767 | $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); |
1763 | $INV->set_sort_order ($SORT_ORDER{$::CFG->{inv_sort}}); |
1768 | |
1764 | |
… | |
… | |
2294 | $DC::UI::ROOT->draw; |
2290 | $DC::UI::ROOT->draw; |
2295 | DC::SDL_GL_SwapBuffers; |
2291 | DC::SDL_GL_SwapBuffers; |
2296 | $LAST_REFRESH = $NOW; |
2292 | $LAST_REFRESH = $NOW; |
2297 | } |
2293 | } |
2298 | |
2294 | |
2299 | my $want_refresh = EV::idle_ns \&force_refresh; |
2295 | my $want_refresh = EV::prepare_ns \&force_refresh; |
2300 | |
2296 | |
2301 | my $input = EV::periodic 0, 1/60, undef, sub { |
2297 | my $input = EV::periodic 0, 1 / $MAX_FPS, undef, sub { |
2302 | $NOW = time; |
2298 | $NOW = EV::now; |
2303 | |
2299 | |
2304 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2300 | ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) |
2305 | for DC::poll_events; |
2301 | for DC::poll_events; |
2306 | |
2302 | |
2307 | if (%animate_object) { |
2303 | if (%animate_object) { |