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.23 by elmex, Fri Apr 7 20:15:01 2006 UTC vs.
Revision 1.24 by root, Fri Apr 7 20:34:44 2006 UTC

22 22
23our $VERSION = '0.1'; 23our $VERSION = '0.1';
24 24
25our $CFG; 25our $CFG;
26our $CONN; 26our $CONN;
27
28our $GUIFONT;
27 29
28our $SDL_TIMER; 30our $SDL_TIMER;
29our $SDL_APP; 31our $SDL_APP;
30our $SDL_EV = new SDL::Event; 32our $SDL_EV = new SDL::Event;
31our %SDL_CB; 33our %SDL_CB;
55 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 57 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
56 glEnable GL_BLEND; 58 glEnable GL_BLEND;
57 59
58 glMatrixMode GL_PROJECTION; 60 glMatrixMode GL_PROJECTION;
59 glLoadIdentity; 61 glLoadIdentity;
60 glOrtho 0, $CFG->{width} / 32, $CFG->{height} / 32, 0, -100 , 100; 62 glOrtho 0, $CFG->{width}, $CFG->{height}, 0, -100 , 100;
61 63
62 glMatrixMode GL_MODELVIEW; 64 glMatrixMode GL_MODELVIEW;
63 65
64 $_->() for @GL_INIT; 66 $_->() for @GL_INIT;
65} 67}
68
69my $label;#d#
66 70
67sub start_game { 71sub start_game {
68 $SDL_TIMER = add Glib::Timeout 1000/20, sub { 72 $SDL_TIMER = add Glib::Timeout 1000/20, sub {
69 while ($SDL_EV->poll) { 73 while ($SDL_EV->poll) {
70 ($SDL_CB{$SDL_EV->type} || sub { warn "unhandled event ", $SDL_EV->type })->(); 74 ($SDL_CB{$SDL_EV->type} || sub { warn "unhandled event ", $SDL_EV->type })->();
72 76
73 1 77 1
74 }; 78 };
75 79
76 init_screen; 80 init_screen;
81
82# $label = new Crossfire::Client::Widget::Label "Testü[]";
83# $label->activate;
77 84
78 $CONN = new conn 85 $CONN = new conn
79 host => $CFG->{host}, 86 host => $CFG->{host},
80 port => $CFG->{port}; 87 port => $CFG->{port};
81} 88}
256} 263}
257 264
258 265
259############################################################################# 266#############################################################################
260 267
261SDL::Init(SDL_INIT_EVERYTHING()); 268SDL::Init SDL_INIT_EVERYTHING;
262 269
263my $mapwidget = Crossfire::Client::Widget::MapWidget->new; 270my $mapwidget = Crossfire::Client::Widget::MapWidget->new;
264
265find_rcfile "uifont.ttf";
266 271
267$mapwidget->activate; 272$mapwidget->activate;
268$mapwidget->focus_in; 273$mapwidget->focus_in;
269 274
270Crossfire::Client::read_cfg "$Crossfire::VARDIR/pclientrc"; 275Crossfire::Client::read_cfg "$Crossfire::VARDIR/pclientrc";
271
272$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {};
273 276
274$CFG ||= { 277$CFG ||= {
275 width => 640, 278 width => 640,
276 height => 480, 279 height => 480,
277 fullscreen => 0, 280 fullscreen => 0,
278 host => "crossfire.schmorp.de", 281 host => "crossfire.schmorp.de",
279 port => 13327, 282 port => 13327,
280}; 283};
281 284
285$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {};
286
287SDL::TTFInit;
288
289$GUIFONT = SDL::TTFOpenFont Crossfire::Client::find_rcfile "uifont.ttf", 12
290 or die "TTFOpenFont: $!";
291
282run_config_dialog 292run_config_dialog
283 login => sub { start_game }, 293 login => sub { start_game },
284 logout => sub { stop_game }; 294 logout => sub { stop_game };
285 295
286main Gtk2; 296main Gtk2;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines