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