1 | #!/opt/bin/perl |
1 | #!/opt/bin/perl |
|
|
2 | |
2 | use strict; |
3 | use strict; |
|
|
4 | use utf8; |
3 | |
5 | |
4 | use Glib; |
6 | use Glib; |
5 | use Gtk2 -init; |
7 | use Gtk2 -init; |
6 | |
8 | |
7 | use SDL; |
9 | use SDL; |
… | |
… | |
23 | our $VERSION = '0.1'; |
25 | our $VERSION = '0.1'; |
24 | |
26 | |
25 | our $CFG; |
27 | our $CFG; |
26 | our $CONN; |
28 | our $CONN; |
27 | |
29 | |
28 | our $GUIFONT; |
30 | our $UIFONT; |
29 | |
31 | |
30 | our $SDL_TIMER; |
32 | our $SDL_TIMER; |
31 | our $SDL_APP; |
33 | our $SDL_APP; |
32 | our $SDL_EV = new SDL::Event; |
34 | our $SDL_EV = new SDL::Event; |
33 | our %SDL_CB; |
35 | our %SDL_CB; |
… | |
… | |
49 | -resizeable => 0; |
51 | -resizeable => 0; |
50 | |
52 | |
51 | glClearColor 0, 0, 0, 0; |
53 | glClearColor 0, 0, 0, 0; |
52 | |
54 | |
53 | glEnable GL_TEXTURE_2D; |
55 | glEnable GL_TEXTURE_2D; |
54 | glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE; |
|
|
55 | glShadeModel GL_FLAT; |
56 | glShadeModel GL_FLAT; |
56 | glDisable GL_DEPTH_TEST; |
57 | glDisable GL_DEPTH_TEST; |
57 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
58 | glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; |
58 | glEnable GL_BLEND; |
|
|
59 | |
59 | |
60 | glMatrixMode GL_PROJECTION; |
60 | glMatrixMode GL_PROJECTION; |
61 | glLoadIdentity; |
61 | glLoadIdentity; |
62 | glOrtho 0, $CFG->{width}, $CFG->{height}, 0, -100 , 100; |
62 | glOrtho 0, $CFG->{width}, $CFG->{height}, 0, -100 , 100; |
63 | |
63 | |
… | |
… | |
77 | 1 |
77 | 1 |
78 | }; |
78 | }; |
79 | |
79 | |
80 | init_screen; |
80 | init_screen; |
81 | |
81 | |
82 | # $label = new Crossfire::Client::Widget::Label "Testü[]"; |
82 | $label = new Crossfire::Client::Widget::Label 500, 10, 1, $UIFONT, "Testü[]"; |
83 | # $label->activate; |
83 | $label->activate; |
84 | |
84 | |
85 | $CONN = new conn |
85 | $CONN = new conn |
86 | host => $CFG->{host}, |
86 | host => $CFG->{host}, |
87 | port => $CFG->{port}; |
87 | port => $CFG->{port}; |
88 | } |
88 | } |
… | |
… | |
284 | |
284 | |
285 | $FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; |
285 | $FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; |
286 | |
286 | |
287 | SDL::TTFInit; |
287 | SDL::TTFInit; |
288 | |
288 | |
289 | $GUIFONT = SDL::TTFOpenFont Crossfire::Client::find_rcfile "uifont.ttf", 12 |
289 | $UIFONT = SDL::TTFOpenFont Crossfire::Client::find_rcfile "uifont.ttf", 24 |
290 | or die "TTFOpenFont: $!"; |
290 | or die "TTFOpenFont: $!"; |
291 | |
291 | |
292 | run_config_dialog |
292 | run_config_dialog |
293 | login => sub { start_game }, |
293 | login => sub { start_game }, |
294 | logout => sub { stop_game }; |
294 | logout => sub { stop_game }; |