… | |
… | |
1121 | . "but you also increase bandwidth requirements and latency. " |
1121 | . "but you also increase bandwidth requirements and latency. " |
1122 | . "This option is only used once at log-in.", |
1122 | . "This option is only used once at log-in.", |
1123 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 0 }, |
1123 | on_changed => sub { my ($self, $value) = @_; $CFG->{mapsize} = $self->{range}[0] = $value = int $value; 0 }, |
1124 | ); |
1124 | ); |
1125 | |
1125 | |
1126 | $table->add_at (0, 8, new CFPlus::UI::Label valign => 0, align => 1, text => "Face Prefetch"); |
|
|
1127 | $table->add_at (1, 8, new CFPlus::UI::CheckBox |
|
|
1128 | state => $CFG->{face_prefetch}, |
|
|
1129 | tooltip => "<b>Background Image Prefetch</b>\n\n" |
|
|
1130 | . "If enabled, the client automatically pre-fetches images from the server. " |
|
|
1131 | . "This might increase or create lag, but increases the chances " |
|
|
1132 | . "of faces being ready for display when you encounter them. " |
|
|
1133 | . "It also uses up server bandwidth on every connect, " |
|
|
1134 | . "so only set it if you really need to prefetch images. " |
|
|
1135 | . "This option can be set and unset any time.", |
|
|
1136 | on_changed => sub { $CFG->{face_prefetch} = $_[1]; 0 }, |
|
|
1137 | ); |
|
|
1138 | |
|
|
1139 | $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate"); |
1126 | $table->add_at (0, 8, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Rate"); |
1140 | $table->add_at (1, 9, new CFPlus::UI::Entry |
1127 | $table->add_at (1, 8, new CFPlus::UI::Entry |
1141 | text => $CFG->{output_rate}, |
1128 | text => $CFG->{output_rate}, |
1142 | tooltip => "The approximate bandwidth in bytes per second that the server should not exceed " |
1129 | tooltip => "The approximate bandwidth in bytes per second that the server should not exceed " |
1143 | . "when sending images, to ensure interactiveness. When 0 or unset, the server " |
1130 | . "when sending images, to ensure interactiveness. When 0 or unset, the server " |
1144 | . "default will be used, which is usually around 100kb/s.", |
1131 | . "default will be used, which is usually around 100kb/s.", |
1145 | on_changed => sub { $CFG->{output_rate} = $_[1]; 0 }, |
1132 | on_changed => sub { $CFG->{output_rate} = $_[1]; 0 }, |
1146 | ); |
1133 | ); |
1147 | |
1134 | |
1148 | $table->add_at (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1135 | $table->add_at (0, 9, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Count"); |
1149 | $table->add_at (1, 10, new CFPlus::UI::Entry |
1136 | $table->add_at (1, 9, new CFPlus::UI::Entry |
1150 | text => $CFG->{output_count}, |
1137 | text => $CFG->{output_count}, |
1151 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1138 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1152 | on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, |
1139 | on_changed => sub { $CFG->{output_count} = $_[1]; 0 }, |
1153 | ); |
1140 | ); |
1154 | |
1141 | |
1155 | $table->add_at (0, 11, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1142 | $table->add_at (0, 10, new CFPlus::UI::Label valign => 0, align => 1, text => "Output-Sync"); |
1156 | $table->add_at (1, 11, new CFPlus::UI::Entry |
1143 | $table->add_at (1, 10, new CFPlus::UI::Entry |
1157 | text => $CFG->{output_sync}, |
1144 | text => $CFG->{output_sync}, |
1158 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1145 | tooltip => "Should be set to 1 unless you know what you are doing. This option is only used once at log-in.", |
1159 | on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, |
1146 | on_changed => sub { $CFG->{output_sync} = $_[1]; 0 }, |
1160 | ); |
1147 | ); |
1161 | |
1148 | |
1162 | $table->add_at (1, 12, $LOGIN_BUTTON = new CFPlus::UI::Button |
1149 | $table->add_at (1, 11, $LOGIN_BUTTON = new CFPlus::UI::Button |
1163 | expand => 1, |
1150 | expand => 1, |
1164 | align => 0, |
1151 | align => 0, |
1165 | text => "Login", |
1152 | text => "Login", |
1166 | on_activate => sub { |
1153 | on_activate => sub { |
1167 | $CONN ? stop_game |
1154 | $CONN ? stop_game |
… | |
… | |
1992 | |
1979 | |
1993 | sub animation_stop { |
1980 | sub animation_stop { |
1994 | my ($widget) = @_; |
1981 | my ($widget) = @_; |
1995 | delete $animate_object{$widget}; |
1982 | delete $animate_object{$widget}; |
1996 | } |
1983 | } |
1997 | |
|
|
1998 | # check once/second for faces that need to be prefetched |
|
|
1999 | # this should, of course, only run on demand, but |
|
|
2000 | # SDL forces worse things on us.... |
|
|
2001 | |
|
|
2002 | Event->timer (after => 1, interval => 0.25, cb => sub { |
|
|
2003 | $CONN->face_prefetch |
|
|
2004 | if $CONN; |
|
|
2005 | }); |
|
|
2006 | |
1984 | |
2007 | %SDL_CB = ( |
1985 | %SDL_CB = ( |
2008 | CFPlus::SDL_QUIT => sub { |
1986 | CFPlus::SDL_QUIT => sub { |
2009 | exit; |
1987 | exit; |
2010 | }, |
1988 | }, |
… | |
… | |
2071 | stat_fontsize => 0.7, |
2049 | stat_fontsize => 0.7, |
2072 | mapsize => 100, |
2050 | mapsize => 100, |
2073 | audio_enable => 1, |
2051 | audio_enable => 1, |
2074 | bgm_enable => 1, |
2052 | bgm_enable => 1, |
2075 | bgm_volume => 0.25, |
2053 | bgm_volume => 0.25, |
2076 | face_prefetch => 0, |
|
|
2077 | output_sync => 1, |
2054 | output_sync => 1, |
2078 | output_count => 1, |
2055 | output_count => 1, |
2079 | output_rate => "", |
2056 | output_rate => "", |
2080 | pickup => 0, |
2057 | pickup => 0, |
2081 | inv_sort => "mtime", |
2058 | inv_sort => "mtime", |