--- deliantra/Deliantra-Client/bin/pclient 2006/04/09 00:06:10 1.38 +++ deliantra/Deliantra-Client/bin/pclient 2006/04/09 01:21:11 1.41 @@ -32,7 +32,7 @@ our $HEIGHT; our $FULLSCREEN; -our $UIFONT; +our $FONTSIZE; our $SDL_TIMER; our $SDL_APP; @@ -43,6 +43,8 @@ our $ALT_ENTER_MESSAGE; +our $TOPLEVEL; + our $tw; # Test widget #d# sub init_screen { @@ -64,19 +66,25 @@ $GL_EXT{GL_ARB_texture_non_power_of_two} or warn "WARNING: non-power-of-two opengl extension required"; - $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label 0, $HEIGHT - $HEIGHT / 40, 10, $UIFONT, "Alt-Enter toggles fullscreen mode"; + $FONTSIZE = int $HEIGHT / 50; + + $ALT_ENTER_MESSAGE = new Crossfire::Client::Widget::Label + 0, $FONTSIZE, $HEIGHT - $FONTSIZE, $FONTSIZE, + "Use Alt-Enter to toggle fullscreen mode"; $ALT_ENTER_MESSAGE->move (0, $HEIGHT - ($ALT_ENTER_MESSAGE->size_request)[1]); - $ALT_ENTER_MESSAGE->activate; + $TOPLEVEL->add ($ALT_ENTER_MESSAGE); # Test code #d# - my $frm = new Crossfire::Client::Widget::Frame; - $tw = new Crossfire::Client::Widget::Window; - $frm->add (new Crossfire::Client::Widget::Label 0, 0, 10, $UIFONT, "Foo in the garden!"); - $tw->add ($frm); - - $tw->move (0, $HEIGHT - 120); - $tw->activate; - # Test code end #d# + { + my $frm = new Crossfire::Client::Widget::Frame; + $tw = new Crossfire::Client::Widget::Window; + $frm->add (my $te = new Crossfire::Client::Widget::TextEntry 0, 0, 10, $FONTSIZE, "Foo in the garden!"); + $tw->add ($frm); + + $tw->move (0, $HEIGHT - 120); + $TOPLEVEL->add ($tw); +# $te->focus_in; + } glClearColor 0, 0, 0, 0; @@ -131,7 +139,7 @@ glClear GL_COLOR_BUFFER_BIT; - $_->draw for @Crossfire::Client::Widget::ACTIVE_WIDGETS; + $TOPLEVEL->draw; SDL::GLSwapBuffers; } @@ -317,9 +325,11 @@ SDL::Init SDL_INIT_EVERYTHING; +$TOPLEVEL = Crossfire::Client::Widget::Toplevel->new; + my $mapwidget = Crossfire::Client::Widget::MapWidget->new; -$mapwidget->activate; +$TOPLEVEL->add ($mapwidget); $mapwidget->focus_in; Crossfire::Client::read_cfg "$Crossfire::VARDIR/pclientrc"; @@ -332,6 +342,9 @@ port => 13327, }; +Crossfire::Client::add_font Crossfire::Client::find_rcfile "uifont.ttf"; +Crossfire::Client::set_font "[Bitstream Vera Sans Mono]"; + $FACECACHE = eval { Crossfire::load_ref "$Crossfire::VARDIR/pclient.faces" } || {}; run_config_dialog