--- deliantra/Deliantra-Client/bin/pclient 2006/04/14 14:55:28 1.104 +++ deliantra/Deliantra-Client/bin/pclient 2006/04/15 12:46:48 1.111 @@ -67,7 +67,7 @@ sub start_game { status "logging in..."; - my $mapsize = List::Util::min 64, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; + my $mapsize = List::Util::min 32, List::Util::max 11, int $WIDTH * $CFG->{mapsize} * 0.01 / 32; $MAP = new CFClient::Map $mapsize, $mapsize; @@ -89,7 +89,7 @@ undef $CONN; } -sub config_dialog { +sub client_setup { my $dialog = new CFClient::UI::FancyFrame child => (my $vbox = new CFClient::UI::VBox); $vbox->add (new CFClient::UI::Label align => 0, text => "Client Setup"); @@ -139,10 +139,23 @@ $CFG->{fow_smooth} = $value; }); + $table->add (0, 5, new CFClient::UI::Label align => 1, text => "Log Fontsize"); + $table->add (1, 5, new CFClient::UI::Slider range => [$CFG->{log_fontsize}, 8, 30, 1], connect_changed => sub { + my ($self, $value) = @_; + $LOGVIEW->set_fontsize ($CFG->{log_fontsize} = int $value); + }); + $table->add (1, 6, new CFClient::UI::Button expand => 1, align => 0, text => "Apply", connect_activate => sub { destroy_screen (); init_screen (); }); + + $dialog +} + +sub server_setup { + my $dialog = new CFClient::UI::FancyFrame + child => (my $vbox = new CFClient::UI::VBox); $vbox->add (new CFClient::UI::Label align => 0, text => "Server Setup"); $vbox->add (my $table = new CFClient::UI::Table expand => 1, col_expand => [0, 1]); @@ -191,23 +204,22 @@ start_game; }); - $vbox->add (my $hbox = new CFClient::UI::HBox); - - $hbox->add (new CFClient::UI::Button expand => 1, align => 0, text => "Save", connect_activate => sub { - CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; - status "Configuration Saved"; - }); - $dialog } -sub console_window { +sub message_window { my $window = new CFClient::UI::FancyFrame border_bg => [1, 1, 1, 0.5], bg => [0.3, 0.3, 0.3, 0.8], + user_w => $::WIDTH/4, + user_h => $::HEIGHT, child => (my $vbox = new CFClient::UI::VBox); - $vbox->add ($LOGVIEW = new CFClient::UI::TextView expand => 1); + $vbox->add ($LOGVIEW = new CFClient::UI::TextView + expand => 1, + fontsize => $::CFG->{log_fontsize}, + ); + $vbox->add (my $input = new CFClient::UI::LineEntry); $input->connect (activate => sub { my ($input, $text) = @_; @@ -235,6 +247,7 @@ } sub sdl_init { + #SDL::Init SDL_INIT_AUDIO | SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE SDL::Init SDL_INIT_AUDIO | SDL_INIT_VIDEO and die "SDL::Init failed!\n"; } @@ -281,21 +294,21 @@ ############################################################################# $DEBUG_STATUS = new CFClient::UI::Label padding => 0, z => 100; - $CFClient::UI::TOPLEVEL->add ($DEBUG_STATUS); + $CFClient::UI::ROOT->add ($DEBUG_STATUS); $STATUS_LINE = new CFClient::UI::Label padding => 0, y => $HEIGHT * 44 / 45 - $FONTSIZE; - $CFClient::UI::TOPLEVEL->add ($STATUS_LINE); + $CFClient::UI::ROOT->add ($STATUS_LINE); $ALT_ENTER_MESSAGE = new CFClient::UI::Label padding => 0, y => $HEIGHT * 44 / 45, height => $HEIGHT / 45, text => "Use Alt-Enter to toggle fullscreen mode"; - $CFClient::UI::TOPLEVEL->add ($ALT_ENTER_MESSAGE); + $CFClient::UI::ROOT->add ($ALT_ENTER_MESSAGE); - $CFClient::UI::TOPLEVEL->add ($MAPWIDGET = new CFClient::UI::MapWidget); + $CFClient::UI::ROOT->add ($MAPWIDGET = new CFClient::UI::MapWidget); $MAPWIDGET->focus_in; $MAPWIDGET->connect (activate_console => sub { my ($mapwidget, $preset) = @_; @@ -309,14 +322,22 @@ } }); - $CFClient::UI::TOPLEVEL->add ($BUTTONBAR = new CFClient::UI::HBox); + $CFClient::UI::ROOT->add ($BUTTONBAR = new CFClient::UI::HBox); + + $BUTTONBAR->add (new CFClient::UI::Flopper text => "Client Setup", other => client_setup); + $BUTTONBAR->add (new CFClient::UI::Flopper text => "Server Setup", other => server_setup); + $BUTTONBAR->add (new CFClient::UI::Flopper text => "Message Window", other => message_window); - $BUTTONBAR->add (my $setup = new CFClient::UI::Flopper x => 0, y => 0, text => "Setup", other => config_dialog, state => 1); - $BUTTONBAR->add (my $setup = new CFClient::UI::Flopper x => 0, y => 0, text => "Console", other => console_window); + $BUTTONBAR->add (new CFClient::UI::Button text => "Save Config", connect_activate => sub { + CFClient::write_cfg "$Crossfire::VARDIR/pclientrc"; + status "Configuration Saved"; + }); + + $BUTTONBAR->{children}[0]->emit ("activate"); } sub destroy_screen { - $CFClient::UI::TOPLEVEL->{children} = []; + $CFClient::UI::ROOT->{children} = []; undef $SDL_ACTIVE; undef $SDL_EV; SDL::Quit; @@ -337,17 +358,7 @@ $want_refresh = 0; $can_refresh = 0; - glViewport 0, 0, $WIDTH, $HEIGHT; - glClearColor +($CFG->{fow_intensity}) x 3, 1; - glClear GL_COLOR_BUFFER_BIT; - - glMatrixMode GL_PROJECTION; - glLoadIdentity; - glOrtho 0, $WIDTH, $HEIGHT, 0, -10000 , 10000; - glMatrixMode GL_MODELVIEW; - glLoadIdentity; - - $CFClient::UI::TOPLEVEL->draw; + $CFClient::UI::ROOT->draw; SDL::GLSwapBuffers; @@ -430,9 +441,11 @@ $FACECACHE->{"$face->{chksum},$face->{name}"} = $face->{image}; - my $tex = $face->{texture} = new_from_image CFClient::Texture delete $face->{image}; + my $tex = $face->{texture} = + new_from_image CFClient::Texture + delete $face->{image}, minify => 1; - $MAP->set_texture ($facenum, @$tex{qw(name w h s t)}); + $MAP->set_texture ($facenum, @$tex{qw(name w h s t)}, @{$tex->{minified}}); $MAPWIDGET->update; } @@ -506,14 +519,15 @@ CFClient::read_cfg "$Crossfire::VARDIR/pclientrc"; my %DEF_CFG = ( + sdl_mode => 0, width => 640, height => 480, + fullscreen => 0, fast => 0, fow_enable => 1, fow_intensity => 0.45, fow_smooth => 0, - fullscreen => 0, - sdl_mode => 0, + log_fontsize => 14, mapsize => 100, host => "crossfire.schmorp.de", port => 13327,