… | |
… | |
25 | |
25 | |
26 | our $SDL_TIMER; |
26 | our $SDL_TIMER; |
27 | our $SDL_APP; |
27 | our $SDL_APP; |
28 | our $SDL_EV = new SDL::Event; |
28 | our $SDL_EV = new SDL::Event; |
29 | our %SDL_CB; |
29 | our %SDL_CB; |
30 | our @GL_INIT; |
30 | |
|
|
31 | our @GL_INIT; # hooks called on every gl init |
31 | |
32 | |
32 | sub init_screen { |
33 | sub init_screen { |
33 | $SDL_APP = new SDL::App |
34 | $SDL_APP = new SDL::App |
34 | -flags => SDL_ANYFORMAT | SDL_HWSURFACE, |
35 | -flags => SDL_ANYFORMAT | SDL_HWSURFACE, |
35 | -title => "Crossfire+ Client", |
36 | -title => "Crossfire+ Client", |
… | |
… | |
100 | }, |
101 | }, |
101 | SDL_VIDEOEXPOSE() => sub { |
102 | SDL_VIDEOEXPOSE() => sub { |
102 | refresh; |
103 | refresh; |
103 | }, |
104 | }, |
104 | SDL_KEYDOWN() => sub { |
105 | SDL_KEYDOWN() => sub { |
|
|
106 | if ($SDL_EV->key_mod & KMOD_ALT && $SDL_EV->key_sym == SDLK_RETURN) { |
|
|
107 | # alt-enter |
|
|
108 | $CFG->{fullscreen} = !$CFG->{fullscreen}; |
|
|
109 | init_screen; |
|
|
110 | } else { |
105 | Client::Widget::feed_sdl_key_down_event ($SDL_EV); |
111 | Client::Widget::feed_sdl_key_down_event ($SDL_EV); |
|
|
112 | } |
106 | }, |
113 | }, |
107 | SDL_KEYUP() => sub { |
114 | SDL_KEYUP() => sub { |
108 | Client::Widget::feed_sdl_key_up_event ($SDL_EV); |
115 | Client::Widget::feed_sdl_key_up_event ($SDL_EV); |
109 | }, |
116 | }, |
110 | SDL_MOUSEMOTION() => sub { |
117 | SDL_MOUSEMOTION() => sub { |
… | |
… | |
142 | } |
149 | } |
143 | |
150 | |
144 | sub conn::face_update { |
151 | sub conn::face_update { |
145 | my ($self, $num, $face) = @_; |
152 | my ($self, $num, $face) = @_; |
146 | |
153 | |
|
|
154 | $face->{texture} = new_from_image Crossfire::Client::Texture delete $face->{image}; |
147 | } |
155 | } |
148 | |
156 | |
149 | ############################################################################# |
157 | ############################################################################# |
150 | |
158 | |
151 | my $mapwidget = Client::MapWidget->new; |
159 | my $mapwidget = Client::MapWidget->new; |