ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/bin/pclient
(Generate patch)

Comparing deliantra/Deliantra-Client/bin/pclient (file contents):
Revision 1.19 by root, Fri Apr 7 19:33:42 2006 UTC vs.
Revision 1.22 by root, Fri Apr 7 20:13:13 2006 UTC

13 13
14use Crossfire; 14use Crossfire;
15use Crossfire::Client; 15use Crossfire::Client;
16use Crossfire::Protocol; 16use Crossfire::Protocol;
17 17
18use Client::Util; 18use Crossfire::Client::Util;
19use Client::Widget; 19use Crossfire::Client::Widget;
20 20
21our $FACECACHE; 21our $FACECACHE;
22 22
23our $VERSION = '0.1'; 23our $VERSION = '0.1';
24 24
88} 88}
89 89
90sub refresh { 90sub refresh {
91 glClear GL_COLOR_BUFFER_BIT; 91 glClear GL_COLOR_BUFFER_BIT;
92 92
93 for (values %Client::Widget::ACTIVE_WIDGETS) { 93 $_->draw for values %Crossfire::Client::Widget::ACTIVE_WIDGETS;
94 $_->draw
95 }
96 94
97 SDL::GLSwapBuffers; 95 SDL::GLSwapBuffers;
98} 96}
99 97
100%SDL_CB = ( 98%SDL_CB = (
101 SDL_QUIT() => sub { 99 SDL_QUIT() => sub {
102 warn "sdl quit\n";#d#
103 main_quit Gtk2; 100 main_quit Gtk2;
104 }, 101 },
105 SDL_VIDEORESIZE() => sub { 102 SDL_VIDEORESIZE() => sub {
106 }, 103 },
107 SDL_VIDEOEXPOSE() => sub { 104 SDL_VIDEOEXPOSE() => sub {
111 if ($SDL_EV->key_mod & KMOD_ALT && $SDL_EV->key_sym == SDLK_RETURN) { 108 if ($SDL_EV->key_mod & KMOD_ALT && $SDL_EV->key_sym == SDLK_RETURN) {
112 # alt-enter 109 # alt-enter
113 $CFG->{fullscreen} = !$CFG->{fullscreen}; 110 $CFG->{fullscreen} = !$CFG->{fullscreen};
114 init_screen; 111 init_screen;
115 } else { 112 } else {
116 Client::Widget::feed_sdl_key_down_event ($SDL_EV); 113 Crossfire::Client::Widget::feed_sdl_key_down_event ($SDL_EV);
117 } 114 }
118 }, 115 },
119 SDL_KEYUP() => sub { 116 SDL_KEYUP() => sub {
120 Client::Widget::feed_sdl_key_up_event ($SDL_EV); 117 Crossfire::Client::Widget::feed_sdl_key_up_event ($SDL_EV);
121 }, 118 },
122 SDL_MOUSEMOTION() => sub { 119 SDL_MOUSEMOTION() => sub {
123 warn "sdl motion\n";#d# 120 warn "sdl motion\n";#d#
124 }, 121 },
125 SDL_MOUSEBUTTONDOWN() => sub { 122 SDL_MOUSEBUTTONDOWN() => sub {
126 Client::Widget::feed_sdl_button_down_event ($SDL_EV); 123 Crossfire::Client::Widget::feed_sdl_button_down_event ($SDL_EV);
127 }, 124 },
128 SDL_MOUSEBUTTONUP() => sub { 125 SDL_MOUSEBUTTONUP() => sub {
129 Client::Widget::feed_sdl_button_up_event ($SDL_EV); 126 Crossfire::Client::Widget::feed_sdl_button_up_event ($SDL_EV);
130 }, 127 },
131 SDL_ACTIVEEVENT() => sub { 128 SDL_ACTIVEEVENT() => sub {
132 warn "active\n";#d# 129 warn "active\n";#d#
133 }, 130 },
134); 131);
167 $face->{texture} = new_from_image Crossfire::Client::Texture delete $face->{image}; 164 $face->{texture} = new_from_image Crossfire::Client::Texture delete $face->{image};
168} 165}
169 166
170############################################################################# 167#############################################################################
171 168
169SDL::Init(SDL_INIT_EVERYTHING());
170
172my $mapwidget = Client::MapWidget->new; 171my $mapwidget = Crossfire::Client::Widget::MapWidget->new;
172
173#find_rcfile "uifont.ttf";
173 174
174$mapwidget->activate; 175$mapwidget->activate;
175$mapwidget->focus_in; 176$mapwidget->focus_in;
176 177
177Client::Util::read_cfg "$Crossfire::VARDIR/pclientrc"; 178Crossfire::Client::read_cfg "$Crossfire::VARDIR/pclientrc";
178 179
179$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; 180$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {};
180 181
181$CFG ||= { 182$CFG ||= {
182 width => 640, 183 width => 640,
184 fullscreen => 0, 185 fullscreen => 0,
185 host => "crossfire.schmorp.de", 186 host => "crossfire.schmorp.de",
186 port => 13327, 187 port => 13327,
187}; 188};
188 189
189Client::Util::run_config_dialog 190Crossfire::Client::Util::run_config_dialog
190 login => sub { start_game }, 191 login => sub { start_game },
191 logout => sub { stop_game }; 192 logout => sub { stop_game };
192 193
193main Gtk2; 194main Gtk2;
194 195

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines