… | |
… | |
12 | use SDL::Surface; |
12 | use SDL::Surface; |
13 | use SDL::OpenGL; |
13 | use SDL::OpenGL; |
14 | use SDL::OpenGL::Constants; |
14 | use SDL::OpenGL::Constants; |
15 | |
15 | |
16 | use Crossfire; |
16 | use Crossfire; |
17 | use Crossfire::Client; |
|
|
18 | use Crossfire::Protocol; |
17 | use Crossfire::Protocol; |
19 | |
18 | |
20 | use Crossfire::Client::Widget; |
19 | use CFClient; |
|
|
20 | use CFClient::UI; |
|
|
21 | |
|
|
22 | our $VERSION = '0.1'; |
|
|
23 | |
|
|
24 | my $MAX_FPS = 30; |
|
|
25 | my $TICKS_PER_FRAME = int 1000 / $MAX_FPS - 1; # min ticks per frame |
21 | |
26 | |
22 | our $FACECACHE; |
27 | our $FACECACHE; |
23 | |
|
|
24 | our $VERSION = '0.1'; |
|
|
25 | |
|
|
26 | our %GL_EXT; |
|
|
27 | |
28 | |
28 | our $CFG; |
29 | our $CFG; |
29 | our $CONN; |
30 | our $CONN; |
30 | |
31 | |
31 | our $WIDTH; |
32 | our $WIDTH; |
32 | our $HEIGHT; |
33 | our $HEIGHT; |
33 | our $FULLSCREEN; |
34 | our $FULLSCREEN; |
34 | |
35 | |
|
|
36 | our $NOW; |
|
|
37 | |
|
|
38 | our $MAPWIDGET; |
35 | our $FONTSIZE; |
39 | our $FONTSIZE; |
36 | |
40 | |
37 | our $SDL_TIMER; |
41 | our $SDL_TIMER; |
38 | our $SDL_APP; |
42 | our $SDL_APP; |
39 | our $SDL_EV = new SDL::Event; |
43 | our $SDL_EV; |
40 | our %SDL_CB; |
44 | our %SDL_CB; |
41 | |
45 | |
42 | our @GL_INIT; # hooks called on every gl init |
|
|
43 | |
|
|
44 | our $ALT_ENTER_MESSAGE; |
46 | our $ALT_ENTER_MESSAGE; |
45 | |
47 | our $STATUS_LINE; |
46 | our $TOPLEVEL; |
48 | our $DEBUG_STATUS; |
47 | |
|
|
48 | our $tw; # Test widget #d# |
|
|
49 | |
49 | |
50 | my $last_refresh; |
50 | my $last_refresh; |
|
|
51 | my %ANIMATE; |
|
|
52 | my $refresh_handler; |
|
|
53 | |
|
|
54 | our ($tw, $te); # Test widget #d# |
51 | |
55 | |
52 | sub init_screen { |
56 | sub init_screen { |
53 | $SDL_APP = new SDL::App |
57 | $SDL_APP = new SDL::App |
54 | -flags => SDL_ANYFORMAT | SDL_HWSURFACE, |
58 | -flags => SDL_ANYFORMAT | SDL_HWSURFACE, |
55 | -title => "Crossfire+ Client", |
59 | -title => "Crossfire+ Client", |
56 | -width => $WIDTH, |
60 | -width => $WIDTH, |
57 | -height => $HEIGHT, |
61 | -height => $HEIGHT, |
58 | -opengl => 1, |
62 | -opengl => 1, |
59 | -red_size => 8, |
63 | -red_size => 5, |
60 | -green_size => 8, |
64 | -green_size => 5, |
61 | -blue_size => 8, |
65 | -blue_size => 5, |
|
|
66 | -alpha_size => 0, |
62 | -double_buffer => 1, |
67 | -double_buffer => 1, |
63 | -fullscreen => $FULLSCREEN, |
68 | -fullscreen => $FULLSCREEN, |
64 | -resizeable => 0; |
69 | -resizeable => 0; |
65 | |
70 | |
|
|
71 | $SDL_EV = new SDL::Event; |
|
|
72 | $SDL_EV->set_unicode (1); |
|
|
73 | |
|
|
74 | $SDL_TIMER = add Glib::Timeout 1000/50, sub { |
|
|
75 | ($SDL_CB{$SDL_EV->type} || sub { warn "unhandled event ", $SDL_EV->type })->() |
|
|
76 | while $SDL_EV->poll; |
|
|
77 | |
|
|
78 | 1 |
|
|
79 | }; |
|
|
80 | |
66 | $last_refresh = SDL::GetTicks; |
81 | $last_refresh = SDL::GetTicks; |
67 | |
82 | |
68 | %GL_EXT = map +($_ => 1), split /\s+/, Crossfire::Client::gl_extensions; |
83 | CFClient::gl_init; |
69 | |
|
|
70 | $GL_EXT{GL_ARB_texture_non_power_of_two} |
|
|
71 | or warn "WARNING: non-power-of-two opengl extension required"; |
|
|
72 | |
84 | |
73 | $FONTSIZE = int $HEIGHT / 50; |
85 | $FONTSIZE = int $HEIGHT / 50; |
74 | |
86 | |
75 | $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label |
87 | ############################################################################# |
76 | 0, $FONTSIZE, $HEIGHT - $FONTSIZE, $FONTSIZE, |
|
|
77 | "Use <b>Alt-Enter</b> to toggle fullscreen mode"; |
|
|
78 | $ALT_ENTER_MESSAGE->move (0, $HEIGHT - ($ALT_ENTER_MESSAGE->size_request)[1]); |
|
|
79 | $TOPLEVEL->add ($ALT_ENTER_MESSAGE); |
|
|
80 | |
88 | |
81 | # Test code #d# |
|
|
82 | unless ($tw) { # haha... |
|
|
83 | $tw = new Crossfire::Client::Widget::Animator; |
|
|
84 | my $lbl1 = new Crossfire::Client::Widget::Label |
|
|
85 | 0, 0, 10, $FONTSIZE, "<i>This</i> is a\n<u>TEST</u>!\nOf a themed\nFrame!"; |
|
|
86 | my $lbl2 = new Crossfire::Client::Widget::Label |
|
|
87 | 0, 0, 10, $FONTSIZE, "LBL2"; |
|
|
88 | |
|
|
89 | my $vb = new Crossfire::Client::Widget::VBox; |
|
|
90 | my $f = new Crossfire::Client::Widget::FancyFrame; |
|
|
91 | my $f2 = new Crossfire::Client::Widget::FancyFrame; |
|
|
92 | $f->add ($lbl1); |
|
|
93 | $f2->add ($lbl2); |
|
|
94 | $vb->add ($f); |
|
|
95 | $vb->add ($f2, 1); |
|
|
96 | |
|
|
97 | $tw->add ($vb); |
|
|
98 | $tw->w (400); |
|
|
99 | $tw->h (300); |
|
|
100 | $tw->move ($WIDTH - 200, 0); |
|
|
101 | $tw->moveto (0, 0); |
|
|
102 | $TOPLEVEL->add ($tw); |
|
|
103 | |
|
|
104 | # $f->move ($WIDTH - 200, 0); |
|
|
105 | # $TOPLEVEL->add ($f); |
|
|
106 | } |
|
|
107 | |
|
|
108 | glClearColor 0, 0, 0, 0; |
89 | glClearColor 0.45, 0.45, 0.45, 1; |
109 | |
90 | |
110 | glEnable GL_TEXTURE_2D; |
91 | glEnable GL_TEXTURE_2D; |
111 | glEnable GL_COLOR_MATERIAL; |
92 | glEnable GL_COLOR_MATERIAL; |
112 | glShadeModel GL_FLAT; |
93 | glShadeModel GL_FLAT; |
113 | glDisable GL_DEPTH_TEST; |
94 | glDisable GL_DEPTH_TEST; |
114 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
95 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
115 | |
96 | |
116 | $_->() for @GL_INIT; |
97 | ############################################################################# |
|
|
98 | |
|
|
99 | $DEBUG_STATUS = new CFClient::UI::Label; |
|
|
100 | $CFClient::UI::TOPLEVEL->add ($DEBUG_STATUS); |
|
|
101 | |
|
|
102 | $STATUS_LINE = new CFClient::UI::Label |
|
|
103 | y => $HEIGHT * 59 / 60 - $FONTSIZE; |
|
|
104 | $CFClient::UI::TOPLEVEL->add ($STATUS_LINE); |
|
|
105 | |
|
|
106 | $ALT_ENTER_MESSAGE = new CFClient::UI::Label |
|
|
107 | y => $HEIGHT * 59 / 60, |
|
|
108 | height => $HEIGHT / 60, |
|
|
109 | text => "Use <b>Alt-Enter</b> to toggle fullscreen mode"; |
|
|
110 | $CFClient::UI::TOPLEVEL->add ($ALT_ENTER_MESSAGE); |
|
|
111 | |
|
|
112 | $MAPWIDGET = new CFClient::UI::MapWidget; |
|
|
113 | $CFClient::UI::TOPLEVEL->add ($MAPWIDGET); |
|
|
114 | $MAPWIDGET->focus_in; |
|
|
115 | } |
|
|
116 | |
|
|
117 | sub destroy_screen { |
|
|
118 | remove Glib::Source $SDL_TIMER; |
|
|
119 | undef $SDL_APP; |
|
|
120 | undef $SDL_EV; |
|
|
121 | SDL::Quit; |
|
|
122 | } |
|
|
123 | |
|
|
124 | sub config_dialog { |
|
|
125 | my $dialog = new CFClient::UI::FancyFrame x => 300, y => 100, |
|
|
126 | child => (my $vbox = new CFClient::UI::VBox); |
|
|
127 | $vbox->add (new CFClient::UI::Label align => 0, text => "Setup"); |
|
|
128 | $vbox->add (my $table = new CFClient::UI::Table); |
|
|
129 | |
|
|
130 | $table->add (0, 0, new CFClient::UI::Label text => "Video Mode"); |
|
|
131 | $table->add (0, 1, new CFClient::UI::Label text => "Host"); |
|
|
132 | $table->add (0, 2, new CFClient::UI::Label text => "Port"); |
|
|
133 | $table->add (0, 3, new CFClient::UI::Label text => "Username"); |
|
|
134 | $table->add (0, 4, new CFClient::UI::Label text => "Password", hidden => 1); |
|
|
135 | $table->add (0, 5, new CFClient::UI::Label text => "Server Map Size"); |
|
|
136 | |
|
|
137 | $CFClient::UI::TOPLEVEL->add ($dialog); |
117 | } |
138 | } |
118 | |
139 | |
119 | sub start_game { |
140 | sub start_game { |
120 | $SDL_TIMER = add Glib::Timeout 1000/100, sub { |
|
|
121 | ($SDL_CB{$SDL_EV->type} || sub { warn "unhandled event ", $SDL_EV->type })->() |
|
|
122 | while $SDL_EV->poll; |
|
|
123 | |
|
|
124 | 1 |
|
|
125 | }; |
|
|
126 | |
|
|
127 | $WIDTH = $CFG->{width}; |
141 | $WIDTH = $CFG->{width}; |
128 | $HEIGHT = $CFG->{height}; |
142 | $HEIGHT = $CFG->{height}; |
129 | $FULLSCREEN = 0; |
143 | $FULLSCREEN = 0; |
130 | |
144 | |
131 | init_screen; |
145 | init_screen; |
|
|
146 | |
|
|
147 | config_dialog; |
|
|
148 | |
|
|
149 | my $mapsize = List::Util::min 64, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; |
132 | |
150 | |
133 | $CONN = new conn |
151 | $CONN = new conn |
134 | host => $CFG->{host}, |
152 | host => $CFG->{host}, |
135 | port => $CFG->{port}, |
153 | port => $CFG->{port}, |
136 | user => $CFG->{user}, |
154 | user => $CFG->{user}, |
137 | pass => $CFG->{password}, |
155 | pass => $CFG->{password}, |
138 | mapw => 50, |
156 | mapw => $mapsize, |
139 | maph => 37, |
157 | maph => $mapsize, |
140 | ; |
158 | ; |
141 | |
159 | |
142 | Crossfire::Client::lowdelay fileno $CONN->{fh}; |
160 | CFClient::lowdelay fileno $CONN->{fh}; |
143 | } |
161 | } |
144 | |
162 | |
145 | sub stop_game { |
163 | sub stop_game { |
146 | remove Glib::Source $SDL_TIMER; |
164 | remove Glib::Source $refresh_handler if $refresh_handler; |
|
|
165 | undef $refresh_handler; |
147 | |
166 | |
148 | undef $SDL_APP; |
167 | undef $CONN; |
149 | SDL::Quit; |
168 | destroy_screen; |
150 | } |
169 | } |
151 | |
|
|
152 | |
170 | |
153 | sub force_refresh { |
171 | sub force_refresh { |
154 | glViewport 0, 0, $WIDTH, $HEIGHT; |
172 | glViewport 0, 0, $WIDTH, $HEIGHT; |
155 | |
173 | |
156 | glMatrixMode GL_PROJECTION; |
174 | glMatrixMode GL_PROJECTION; |
157 | glLoadIdentity; |
175 | glLoadIdentity; |
158 | glOrtho 0, $WIDTH, $HEIGHT, 0, -6000 , 6000; |
176 | glOrtho 0, $WIDTH, $HEIGHT, 0, -10000 , 10000; |
159 | glMatrixMode GL_MODELVIEW; |
177 | glMatrixMode GL_MODELVIEW; |
|
|
178 | glLoadIdentity; |
160 | |
179 | |
161 | glClear GL_COLOR_BUFFER_BIT; |
180 | glClear GL_COLOR_BUFFER_BIT; |
162 | |
181 | |
163 | $TOPLEVEL->draw; |
182 | $CFClient::UI::TOPLEVEL->draw; |
164 | |
183 | |
165 | SDL::GLSwapBuffers; |
184 | SDL::GLSwapBuffers; |
166 | } |
185 | } |
167 | |
186 | |
168 | my %ANIMATE; |
187 | sub debug { |
|
|
188 | $DEBUG_STATUS->set_text ($_[0]); |
|
|
189 | $DEBUG_STATUS->size_allocate ($DEBUG_STATUS->size_request); |
|
|
190 | $DEBUG_STATUS->move ($WIDTH - $DEBUG_STATUS->{w}, 0); |
|
|
191 | } |
169 | |
192 | |
170 | my $refresh_handler; |
193 | my $FPS; |
171 | |
194 | |
172 | sub refresh { |
195 | sub refresh { |
173 | $refresh_handler ||= add Glib::Idle sub { |
196 | $refresh_handler ||= add Glib::Idle sub { |
174 | my $next_refresh = SDL::GetTicks; |
197 | if ($SDL_APP) { |
|
|
198 | $NOW = SDL::GetTicks; |
|
|
199 | |
|
|
200 | if ($NOW - $last_refresh < $TICKS_PER_FRAME) { |
|
|
201 | SDL::Delay $TICKS_PER_FRAME - ($NOW - $last_refresh); |
|
|
202 | $NOW = SDL::GetTicks; |
|
|
203 | } |
|
|
204 | |
175 | my $interval = ($next_refresh - $last_refresh) * 0.001; |
205 | my $interval = ($NOW - $last_refresh) * 0.001; |
176 | $last_refresh = $next_refresh; |
206 | $last_refresh = $NOW; |
177 | |
207 | |
|
|
208 | if ($interval) { |
|
|
209 | $FPS ||= 1 / $interval; |
|
|
210 | $FPS = $FPS * 0.96 + (1 / $interval) * 0.04; |
|
|
211 | debug sprintf "%5.02f", $FPS; |
|
|
212 | } |
|
|
213 | |
178 | force_refresh; |
214 | force_refresh; |
179 | $_->animate ($interval) for grep $_, values %ANIMATE; |
215 | $_->animate ($interval) for grep $_, values %ANIMATE; |
180 | |
216 | |
181 | if (%ANIMATE) { |
217 | if (%ANIMATE) { |
|
|
218 | 1 |
|
|
219 | } else { |
|
|
220 | undef $refresh_handler; |
|
|
221 | 0 |
182 | 1 |
222 | } |
183 | } else { |
223 | } else { |
184 | undef $refresh_handler; |
224 | undef $refresh_handler; |
185 | 0 |
225 | 0 |
186 | } |
226 | } |
187 | }; |
227 | }; |
… | |
… | |
213 | if ($SDL_EV->key_mod & KMOD_ALT && $SDL_EV->key_sym == SDLK_RETURN) { |
253 | if ($SDL_EV->key_mod & KMOD_ALT && $SDL_EV->key_sym == SDLK_RETURN) { |
214 | # alt-enter |
254 | # alt-enter |
215 | $FULLSCREEN = !$FULLSCREEN; |
255 | $FULLSCREEN = !$FULLSCREEN; |
216 | init_screen; |
256 | init_screen; |
217 | } else { |
257 | } else { |
218 | Crossfire::Client::Widget::feed_sdl_key_down_event ($SDL_EV); |
258 | CFClient::UI::feed_sdl_key_down_event ($SDL_EV); |
219 | } |
259 | } |
220 | }, |
260 | }, |
221 | SDL_KEYUP() => sub { |
261 | SDL_KEYUP() => sub { |
222 | Crossfire::Client::Widget::feed_sdl_key_up_event ($SDL_EV); |
262 | CFClient::UI::feed_sdl_key_up_event ($SDL_EV); |
223 | }, |
263 | }, |
224 | SDL_MOUSEMOTION() => sub { |
264 | SDL_MOUSEMOTION() => sub { |
225 | warn "sdl motion\n";#d# |
265 | CFClient::UI::feed_sdl_motion_event ($SDL_EV); |
226 | }, |
266 | }, |
227 | SDL_MOUSEBUTTONDOWN() => sub { |
267 | SDL_MOUSEBUTTONDOWN() => sub { |
228 | Crossfire::Client::Widget::feed_sdl_button_down_event ($SDL_EV); |
268 | CFClient::UI::feed_sdl_button_down_event ($SDL_EV); |
229 | }, |
269 | }, |
230 | SDL_MOUSEBUTTONUP() => sub { |
270 | SDL_MOUSEBUTTONUP() => sub { |
231 | Crossfire::Client::Widget::feed_sdl_button_up_event ($SDL_EV); |
271 | CFClient::UI::feed_sdl_button_up_event ($SDL_EV); |
232 | }, |
272 | }, |
233 | SDL_ACTIVEEVENT() => sub { |
273 | SDL_ACTIVEEVENT() => sub { |
234 | warn "active\n";#d# |
274 | # printf "active %x %x\n", $SDL_EV->active_gain, $SDL_EV->active_state;#d# |
235 | }, |
275 | }, |
236 | ); |
276 | ); |
237 | |
277 | |
238 | @conn::ISA = Crossfire::Protocol::; |
278 | @conn::ISA = Crossfire::Protocol::; |
239 | |
279 | |
240 | sub conn::map_update { |
280 | sub conn::map_update { |
241 | my ($self, $dirty) = @_; |
281 | my ($self, $dirty) = @_; |
242 | |
282 | |
243 | refresh; |
283 | $MAPWIDGET->update; |
244 | } |
284 | } |
245 | |
285 | |
246 | sub conn::map_scroll { |
286 | sub conn::map_scroll { |
247 | my ($self, $dx, $dy) = @_; |
287 | my ($self, $dx, $dy) = @_; |
248 | |
288 | |
… | |
… | |
264 | sub conn::face_update { |
304 | sub conn::face_update { |
265 | my ($self, $face) = @_; |
305 | my ($self, $face) = @_; |
266 | |
306 | |
267 | $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image}; |
307 | $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image}; |
268 | |
308 | |
269 | $face->{texture} = new_from_image Crossfire::Client::Texture delete $face->{image}; |
309 | $face->{texture} = new_from_image CFClient::Texture delete $face->{image}; |
270 | } |
310 | } |
271 | |
311 | |
272 | sub conn::query { |
312 | sub conn::query { |
273 | my ($self, $flags, $prompt) = @_; |
313 | my ($self, $flags, $prompt) = @_; |
274 | |
314 | |
… | |
… | |
286 | } |
326 | } |
287 | $ent->set_text ($value); |
327 | $ent->set_text ($value); |
288 | $ent->signal_connect (changed => sub { |
328 | $ent->signal_connect (changed => sub { |
289 | my ($ent) = @_; |
329 | my ($ent) = @_; |
290 | $cfg->{$key} = $ent->get_text; |
330 | $cfg->{$key} = $ent->get_text; |
|
|
331 | # TODO: Mapsize should be a slider in the game gui |
291 | if ($key eq 'mapsize' and $cfg->{$key} > 100) { |
332 | if ($key eq 'mapsize' and $cfg->{$key} > 100) { |
292 | $cfg->{$key} = 100; |
333 | $cfg->{$key} = 100; |
293 | $ent->set_text ('100'); |
|
|
294 | } elsif ($key eq 'mapsize' and $cfg->{$key} < 0) { |
334 | } elsif ($key eq 'mapsize' and $cfg->{$key} < 50) { |
295 | $cfg->{$key} = 0; |
335 | $cfg->{$key} = 50; |
296 | $ent->set_text ('0'); |
|
|
297 | } |
336 | } |
298 | }); |
337 | }); |
299 | } |
338 | } |
300 | |
339 | |
301 | sub run_config_dialog { |
340 | sub run_config_dialog { |
… | |
… | |
348 | $cb->signal_connect (clicked => sub { |
387 | $cb->signal_connect (clicked => sub { |
349 | for (keys %$cfg) { |
388 | for (keys %$cfg) { |
350 | $::CFG->{$_} = $cfg->{$_} |
389 | $::CFG->{$_} = $cfg->{$_} |
351 | if $_ ne '_i'; |
390 | if $_ ne '_i'; |
352 | } |
391 | } |
353 | Crossfire::Client::write_cfg "$Crossfire::VARDIR/pclientrc"; |
392 | CFClient::write_cfg "$CFrossfire::VARDIR/pclientrc"; |
354 | }); |
393 | }); |
355 | $hb->pack_start (my $cb = Gtk2::Button->new ("login"), 1, 1, 5); |
394 | $hb->pack_start (my $cb = Gtk2::Button->new ("login"), 1, 1, 5); |
356 | $cb->signal_connect (clicked => sub { |
395 | $cb->signal_connect (clicked => sub { |
357 | for (keys %$cfg) { |
396 | for (keys %$cfg) { |
358 | $::CFG->{$_} = $cfg->{$_} |
397 | $::CFG->{$_} = $cfg->{$_} |
… | |
… | |
361 | my $cb = $events{login} || sub {}; |
400 | my $cb = $events{login} || sub {}; |
362 | $cb->($::CFG->{user}, $::CFG->{password}); |
401 | $cb->($::CFG->{user}, $::CFG->{password}); |
363 | }); |
402 | }); |
364 | $hb->pack_start (my $cb = Gtk2::Button->new ("logout"), 1, 1, 5); |
403 | $hb->pack_start (my $cb = Gtk2::Button->new ("logout"), 1, 1, 5); |
365 | $cb->signal_connect (clicked => sub { |
404 | $cb->signal_connect (clicked => sub { |
366 | my $cb = $events{login} || sub {}; |
405 | my $cb = $events{logout} || sub {}; |
367 | $cb->(); |
406 | $cb->(); |
368 | }); |
407 | }); |
369 | $hb->pack_start (my $cb = Gtk2::Button->new ("quit"), 1, 1, 5); |
408 | $hb->pack_start (my $cb = Gtk2::Button->new ("quit"), 1, 1, 5); |
370 | $cb->signal_connect (clicked => sub { $w->destroy }); |
409 | $cb->signal_connect (clicked => sub { $w->destroy }); |
371 | |
410 | |
… | |
… | |
377 | |
416 | |
378 | ############################################################################# |
417 | ############################################################################# |
379 | |
418 | |
380 | SDL::Init SDL_INIT_EVERYTHING; |
419 | SDL::Init SDL_INIT_EVERYTHING; |
381 | |
420 | |
382 | $TOPLEVEL = Crossfire::Client::Widget::Toplevel->new; |
|
|
383 | |
|
|
384 | my $mapwidget = Crossfire::Client::Widget::MapWidget->new; |
|
|
385 | |
|
|
386 | $TOPLEVEL->add ($mapwidget); |
|
|
387 | $mapwidget->focus_in; |
|
|
388 | |
|
|
389 | Crossfire::Client::read_cfg "$Crossfire::VARDIR/pclientrc"; |
421 | CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; |
390 | |
422 | |
391 | $CFG ||= { |
423 | $CFG ||= { |
392 | width => 640, |
424 | width => 640, |
393 | height => 480, |
425 | height => 480, |
394 | mapsize => 100, |
426 | mapsize => 100, |
395 | fullscreen => 0, |
427 | fullscreen => 0, |
396 | host => "crossfire.schmorp.de", |
428 | host => "crossfire.schmorp.de", |
397 | port => 13327, |
429 | port => 13327, |
398 | }; |
430 | }; |
399 | |
431 | |
400 | Crossfire::Client::set_font Crossfire::Client::find_rcfile "uifont.ttf"; |
432 | { |
|
|
433 | my @fonts = map CFClient::find_rcfile $_, qw(uifont.ttf uifontb.ttf uifonti.ttf uifontbi.ttf); |
|
|
434 | |
|
|
435 | CFClient::add_font $_ for @fonts; |
|
|
436 | CFClient::set_font $fonts[0]; |
|
|
437 | } |
401 | |
438 | |
402 | $FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; |
439 | $FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; |
403 | |
440 | |
404 | run_config_dialog |
441 | run_config_dialog |
405 | login => sub { start_game }, |
442 | login => sub { start_game }, |