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.35 by root, Sat Apr 8 18:48:35 2006 UTC vs.
Revision 1.40 by root, Sun Apr 9 01:19:16 2006 UTC

30 30
31our $WIDTH; 31our $WIDTH;
32our $HEIGHT; 32our $HEIGHT;
33our $FULLSCREEN; 33our $FULLSCREEN;
34 34
35our $UIFONT; 35our $FONTSIZE;
36 36
37our $SDL_TIMER; 37our $SDL_TIMER;
38our $SDL_APP; 38our $SDL_APP;
39our $SDL_EV = new SDL::Event; 39our $SDL_EV = new SDL::Event;
40our %SDL_CB; 40our %SDL_CB;
62 %GL_EXT = map +($_ => 1), split /\s+/, Crossfire::Client::gl_extensions; 62 %GL_EXT = map +($_ => 1), split /\s+/, Crossfire::Client::gl_extensions;
63 63
64 $GL_EXT{GL_ARB_texture_non_power_of_two} 64 $GL_EXT{GL_ARB_texture_non_power_of_two}
65 or warn "WARNING: non-power-of-two opengl extension required"; 65 or warn "WARNING: non-power-of-two opengl extension required";
66 66
67 $UIFONT = SDL::TTFOpenFont Crossfire::Client::find_rcfile "uifont.ttf", $HEIGHT / 40 67 $FONTSIZE = int $HEIGHT / 50;
68 or die "TTFOpenFont: $!";
69 68
70 $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label 0, $HEIGHT - $HEIGHT / 40, 10, $UIFONT, "Alt-Enter toggles fullscreen mode"; 69 $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label
70 0, $FONTSIZE, $HEIGHT - $FONTSIZE, $FONTSIZE,
71 "Use <b>Alt-Enter</b> to toggle fullscreen mode";
71 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - ($ALT_ENTER_MESSAGE->size_request)[1]); 72 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - ($ALT_ENTER_MESSAGE->size_request)[1]);
72 $ALT_ENTER_MESSAGE->activate; 73 $ALT_ENTER_MESSAGE->activate;
73 74
74 # Test code #d# 75 # Test code #d#
76 {
77 my $frm = new Crossfire::Client::Widget::Frame;
75 $tw = new Crossfire::Client::Widget::Window; 78 $tw = new Crossfire::Client::Widget::Window;
76 $tw->add (my $lbl = new Crossfire::Client::Widget::Label 0, 0, 10, $UIFONT, "Foo in the garden!"); 79 $frm->add (new Crossfire::Client::Widget::Label 0, 0, 10, $FONTSIZE, "Foo in the garden!");
77# $tw = new Crossfire::Client::Widget::Label 0, $HEIGHT - $HEIGHT / 40, 10, $UIFONT, "Foo in the garden!"; 80 $tw->add ($frm);
78 81
79 $tw->move (0, 0); 82 $tw->move (0, $HEIGHT - 120);
80 $tw->activate; 83 $tw->activate;
81 # Test code end #d# 84 }
82 85
83 glClearColor 0, 0, 0, 0; 86 glClearColor 0, 0, 0, 0;
84 87
85 glEnable GL_TEXTURE_2D; 88 glEnable GL_TEXTURE_2D;
89 glEnable GL_COLOR_MATERIAL;
86 glShadeModel GL_FLAT; 90 glShadeModel GL_FLAT;
87 glDisable GL_DEPTH_TEST; 91 glDisable GL_DEPTH_TEST;
88 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 92 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA;
89 93
90 $_->() for @GL_INIT; 94 $_->() for @GL_INIT;
106 110
107 $CONN = new conn 111 $CONN = new conn
108 host => $CFG->{host}, 112 host => $CFG->{host},
109 port => $CFG->{port}, 113 port => $CFG->{port},
110 user => $CFG->{user}, 114 user => $CFG->{user},
111 pass => $CFG->{password}; 115 pass => $CFG->{password},
116 mapw => 50,
117 maph => 37,
118 ;
112} 119}
113 120
114sub stop_game { 121sub stop_game {
115 remove Glib::Source $SDL_TIMER; 122 remove Glib::Source $SDL_TIMER;
116 123
312 319
313 320
314############################################################################# 321#############################################################################
315 322
316SDL::Init SDL_INIT_EVERYTHING; 323SDL::Init SDL_INIT_EVERYTHING;
317SDL::TTFInit;
318 324
319my $mapwidget = Crossfire::Client::Widget::MapWidget->new; 325my $mapwidget = Crossfire::Client::Widget::MapWidget->new;
320 326
321$mapwidget->activate; 327$mapwidget->activate;
322$mapwidget->focus_in; 328$mapwidget->focus_in;
329 fullscreen => 0, 335 fullscreen => 0,
330 host => "crossfire.schmorp.de", 336 host => "crossfire.schmorp.de",
331 port => 13327, 337 port => 13327,
332}; 338};
333 339
340Crossfire::Client::add_font Crossfire::Client::find_rcfile "uifont.ttf";
341Crossfire::Client::set_font "[Bitstream Vera Sans Mono]";
342
334$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; 343$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {};
335 344
336run_config_dialog 345run_config_dialog
337 login => sub { start_game }, 346 login => sub { start_game },
338 logout => sub { stop_game }; 347 logout => sub { stop_game };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines