… | |
… | |
48 | -blue_size => 8, |
48 | -blue_size => 8, |
49 | -double_buffer => 1, |
49 | -double_buffer => 1, |
50 | -fullscreen => $CFG->{fullscreen}, |
50 | -fullscreen => $CFG->{fullscreen}, |
51 | -resizeable => 0; |
51 | -resizeable => 0; |
52 | |
52 | |
|
|
53 | $UIFONT = SDL::TTFOpenFont Crossfire::Client::find_rcfile "uifont.ttf", $CFG->{height} / 40 |
|
|
54 | or die "TTFOpenFont: $!"; |
|
|
55 | |
53 | glClearColor 0, 0, 0, 0; |
56 | glClearColor 0, 0, 0, 0; |
54 | |
57 | |
55 | glEnable GL_TEXTURE_2D; |
58 | glEnable GL_TEXTURE_2D; |
56 | glShadeModel GL_FLAT; |
59 | glShadeModel GL_FLAT; |
57 | glDisable GL_DEPTH_TEST; |
60 | glDisable GL_DEPTH_TEST; |
… | |
… | |
82 | $label = new Crossfire::Client::Widget::Label 500, 10, 1, $UIFONT, "Testü[]"; |
85 | $label = new Crossfire::Client::Widget::Label 500, 10, 1, $UIFONT, "Testü[]"; |
83 | $label->activate; |
86 | $label->activate; |
84 | |
87 | |
85 | $CONN = new conn |
88 | $CONN = new conn |
86 | host => $CFG->{host}, |
89 | host => $CFG->{host}, |
87 | port => $CFG->{port}; |
90 | port => $CFG->{port}, |
|
|
91 | user => $CFG->{user}, |
|
|
92 | pass => $CFG->{password}; |
88 | } |
93 | } |
89 | |
94 | |
90 | sub stop_game { |
95 | sub stop_game { |
91 | remove Glib::Source $SDL_TIMER; |
96 | remove Glib::Source $SDL_TIMER; |
92 | |
97 | |
… | |
… | |
95 | } |
100 | } |
96 | |
101 | |
97 | sub refresh { |
102 | sub refresh { |
98 | glClear GL_COLOR_BUFFER_BIT; |
103 | glClear GL_COLOR_BUFFER_BIT; |
99 | |
104 | |
100 | $_->draw for values %Crossfire::Client::Widget::ACTIVE_WIDGETS; |
105 | $_->draw for @Crossfire::Client::Widget::ACTIVE_WIDGETS; |
101 | |
106 | |
102 | SDL::GLSwapBuffers; |
107 | SDL::GLSwapBuffers; |
103 | } |
108 | } |
104 | |
109 | |
105 | %SDL_CB = ( |
110 | %SDL_CB = ( |
… | |
… | |
264 | |
269 | |
265 | |
270 | |
266 | ############################################################################# |
271 | ############################################################################# |
267 | |
272 | |
268 | SDL::Init SDL_INIT_EVERYTHING; |
273 | SDL::Init SDL_INIT_EVERYTHING; |
|
|
274 | SDL::TTFInit; |
269 | |
275 | |
270 | my $mapwidget = Crossfire::Client::Widget::MapWidget->new; |
276 | my $mapwidget = Crossfire::Client::Widget::MapWidget->new; |
271 | |
277 | |
272 | $mapwidget->activate; |
278 | $mapwidget->activate; |
273 | $mapwidget->focus_in; |
279 | $mapwidget->focus_in; |
… | |
… | |
282 | port => 13327, |
288 | port => 13327, |
283 | }; |
289 | }; |
284 | |
290 | |
285 | $FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; |
291 | $FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; |
286 | |
292 | |
287 | SDL::TTFInit; |
|
|
288 | |
|
|
289 | $UIFONT = SDL::TTFOpenFont Crossfire::Client::find_rcfile "uifont.ttf", 24 |
|
|
290 | or die "TTFOpenFont: $!"; |
|
|
291 | |
|
|
292 | run_config_dialog |
293 | run_config_dialog |
293 | login => sub { start_game }, |
294 | login => sub { start_game }, |
294 | logout => sub { stop_game }; |
295 | logout => sub { stop_game }; |
295 | |
296 | |
296 | main Gtk2; |
297 | main Gtk2; |