… | |
… | |
40 | our %SDL_CB; |
40 | our %SDL_CB; |
41 | |
41 | |
42 | our @GL_INIT; # hooks called on every gl init |
42 | our @GL_INIT; # hooks called on every gl init |
43 | |
43 | |
44 | our $ALT_ENTER_MESSAGE; |
44 | our $ALT_ENTER_MESSAGE; |
|
|
45 | our $STATUS_LINE; |
45 | |
46 | |
46 | our $TOPLEVEL; |
47 | our $TOPLEVEL; |
47 | |
48 | |
48 | our $tw; # Test widget #d# |
49 | our $tw; # Test widget #d# |
49 | |
50 | |
… | |
… | |
56 | -flags => SDL_ANYFORMAT | SDL_HWSURFACE, |
57 | -flags => SDL_ANYFORMAT | SDL_HWSURFACE, |
57 | -title => "Crossfire+ Client", |
58 | -title => "Crossfire+ Client", |
58 | -width => $WIDTH, |
59 | -width => $WIDTH, |
59 | -height => $HEIGHT, |
60 | -height => $HEIGHT, |
60 | -opengl => 1, |
61 | -opengl => 1, |
61 | -red_size => 8, |
62 | -red_size => 5, |
62 | -green_size => 8, |
63 | -green_size => 5, |
63 | -blue_size => 8, |
64 | -blue_size => 5, |
|
|
65 | -alpha_size => 0, |
64 | -double_buffer => 1, |
66 | -double_buffer => 1, |
65 | -fullscreen => $FULLSCREEN, |
67 | -fullscreen => $FULLSCREEN, |
66 | -resizeable => 0; |
68 | -resizeable => 0; |
67 | |
69 | |
68 | $last_refresh = SDL::GetTicks; |
70 | $last_refresh = SDL::GetTicks; |
… | |
… | |
72 | $GL_EXT{GL_ARB_texture_non_power_of_two} |
74 | $GL_EXT{GL_ARB_texture_non_power_of_two} |
73 | or warn "WARNING: non-power-of-two opengl extension required"; |
75 | or warn "WARNING: non-power-of-two opengl extension required"; |
74 | |
76 | |
75 | $FONTSIZE = int $HEIGHT / 50; |
77 | $FONTSIZE = int $HEIGHT / 50; |
76 | |
78 | |
|
|
79 | $STATUS_LINE = new Crossfire::Client::Widget::Label |
|
|
80 | 0, $HEIGHT * 59 / 60 - $FONTSIZE, 1, $FONTSIZE, |
|
|
81 | ""; |
|
|
82 | $TOPLEVEL->add ($STATUS_LINE); |
|
|
83 | |
77 | $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label |
84 | $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label |
78 | 0, $FONTSIZE, $HEIGHT - $FONTSIZE, $FONTSIZE, |
85 | 0, $HEIGHT * 59 / 60, 1, $HEIGHT / 60, |
79 | "Use <b>Alt-Enter</b> to toggle fullscreen mode"; |
86 | "Use <b>Alt-Enter</b> to toggle fullscreen mode"; |
80 | $ALT_ENTER_MESSAGE->move (0, $HEIGHT - ($ALT_ENTER_MESSAGE->size_request)[1]); |
|
|
81 | $TOPLEVEL->add ($ALT_ENTER_MESSAGE); |
87 | $TOPLEVEL->add ($ALT_ENTER_MESSAGE); |
82 | |
88 | |
83 | # Test code #d# |
89 | # Test code #d# |
84 | unless ($tw) { # haha... |
90 | unless ($tw) { # haha... |
85 | $tw = new Crossfire::Client::Widget::Animator; |
91 | $tw = new Crossfire::Client::Widget::Animator; |
… | |
… | |
146 | Crossfire::Client::lowdelay fileno $CONN->{fh}; |
152 | Crossfire::Client::lowdelay fileno $CONN->{fh}; |
147 | } |
153 | } |
148 | |
154 | |
149 | sub stop_game { |
155 | sub stop_game { |
150 | remove Glib::Source $SDL_TIMER; |
156 | remove Glib::Source $SDL_TIMER; |
151 | remove Glib::Source $refresh_handler; |
157 | remove Glib::Source $refresh_handler if $refresh_handler; |
152 | undef $refresh_handler; |
158 | undef $refresh_handler; |
153 | |
159 | |
154 | undef $SDL_APP; |
160 | undef $SDL_APP; |
155 | undef $CONN; |
161 | undef $CONN; |
156 | SDL::Quit; |
162 | SDL::Quit; |