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.38 by root, Sun Apr 9 00:06:10 2006 UTC vs.
Revision 1.41 by elmex, Sun Apr 9 01:21:11 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;
41 41
42our @GL_INIT; # hooks called on every gl init 42our @GL_INIT; # hooks called on every gl init
43 43
44our $ALT_ENTER_MESSAGE; 44our $ALT_ENTER_MESSAGE;
45
46our $TOPLEVEL;
45 47
46our $tw; # Test widget #d# 48our $tw; # Test widget #d#
47 49
48sub init_screen { 50sub init_screen {
49 $SDL_APP = new SDL::App 51 $SDL_APP = new SDL::App
62 %GL_EXT = map +($_ => 1), split /\s+/, Crossfire::Client::gl_extensions; 64 %GL_EXT = map +($_ => 1), split /\s+/, Crossfire::Client::gl_extensions;
63 65
64 $GL_EXT{GL_ARB_texture_non_power_of_two} 66 $GL_EXT{GL_ARB_texture_non_power_of_two}
65 or warn "WARNING: non-power-of-two opengl extension required"; 67 or warn "WARNING: non-power-of-two opengl extension required";
66 68
67 $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label 0, $HEIGHT - $HEIGHT / 40, 10, $UIFONT, "Alt-Enter toggles fullscreen mode"; 69 $FONTSIZE = int $HEIGHT / 50;
70
71 $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label
72 0, $FONTSIZE, $HEIGHT - $FONTSIZE, $FONTSIZE,
73 "Use <b>Alt-Enter</b> to toggle fullscreen mode";
68 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - ($ALT_ENTER_MESSAGE->size_request)[1]); 74 $ALT_ENTER_MESSAGE->move (0, $HEIGHT - ($ALT_ENTER_MESSAGE->size_request)[1]);
69 $ALT_ENTER_MESSAGE->activate; 75 $TOPLEVEL->add ($ALT_ENTER_MESSAGE);
70 76
71 # Test code #d# 77 # Test code #d#
78 {
72 my $frm = new Crossfire::Client::Widget::Frame; 79 my $frm = new Crossfire::Client::Widget::Frame;
73 $tw = new Crossfire::Client::Widget::Window; 80 $tw = new Crossfire::Client::Widget::Window;
74 $frm->add (new Crossfire::Client::Widget::Label 0, 0, 10, $UIFONT, "Foo in the garden!"); 81 $frm->add (my $te = new Crossfire::Client::Widget::TextEntry 0, 0, 10, $FONTSIZE, "Foo in the garden!");
75 $tw->add ($frm); 82 $tw->add ($frm);
76 83
77 $tw->move (0, $HEIGHT - 120); 84 $tw->move (0, $HEIGHT - 120);
78 $tw->activate; 85 $TOPLEVEL->add ($tw);
79 # Test code end #d# 86# $te->focus_in;
87 }
80 88
81 glClearColor 0, 0, 0, 0; 89 glClearColor 0, 0, 0, 0;
82 90
83 glEnable GL_TEXTURE_2D; 91 glEnable GL_TEXTURE_2D;
84 glEnable GL_COLOR_MATERIAL; 92 glEnable GL_COLOR_MATERIAL;
129 glOrtho 0, $WIDTH, $HEIGHT, 0, -100 , 100; 137 glOrtho 0, $WIDTH, $HEIGHT, 0, -100 , 100;
130 glMatrixMode GL_MODELVIEW; 138 glMatrixMode GL_MODELVIEW;
131 139
132 glClear GL_COLOR_BUFFER_BIT; 140 glClear GL_COLOR_BUFFER_BIT;
133 141
134 $_->draw for @Crossfire::Client::Widget::ACTIVE_WIDGETS; 142 $TOPLEVEL->draw;
135 143
136 SDL::GLSwapBuffers; 144 SDL::GLSwapBuffers;
137} 145}
138 146
139my $refresh_handler; 147my $refresh_handler;
315 323
316############################################################################# 324#############################################################################
317 325
318SDL::Init SDL_INIT_EVERYTHING; 326SDL::Init SDL_INIT_EVERYTHING;
319 327
328$TOPLEVEL = Crossfire::Client::Widget::Toplevel->new;
329
320my $mapwidget = Crossfire::Client::Widget::MapWidget->new; 330my $mapwidget = Crossfire::Client::Widget::MapWidget->new;
321 331
322$mapwidget->activate; 332$TOPLEVEL->add ($mapwidget);
323$mapwidget->focus_in; 333$mapwidget->focus_in;
324 334
325Crossfire::Client::read_cfg "$Crossfire::VARDIR/pclientrc"; 335Crossfire::Client::read_cfg "$Crossfire::VARDIR/pclientrc";
326 336
327$CFG ||= { 337$CFG ||= {
330 fullscreen => 0, 340 fullscreen => 0,
331 host => "crossfire.schmorp.de", 341 host => "crossfire.schmorp.de",
332 port => 13327, 342 port => 13327,
333}; 343};
334 344
345Crossfire::Client::add_font Crossfire::Client::find_rcfile "uifont.ttf";
346Crossfire::Client::set_font "[Bitstream Vera Sans Mono]";
347
335$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; 348$FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {};
336 349
337run_config_dialog 350run_config_dialog
338 login => sub { start_game }, 351 login => sub { start_game },
339 logout => sub { stop_game }; 352 logout => sub { stop_game };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines