--- deliantra/Deliantra-Client/bin/cfplus 2007/07/14 12:05:53 1.168 +++ deliantra/Deliantra-Client/bin/cfplus 2007/07/17 17:39:08 1.173 @@ -531,17 +531,25 @@ can_events => 1, tooltip => "" . (CFPlus::OpenGL::gl_extensions) . ""); + my $vidmode_tooltip = + "Video Mode. The video mode to use for fullscreen (and the window size for windowed operation). " + . "The format is width x height \@ depth-per-channel + alpha-channel."; + $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Video Mode"); $table->add (1, $row++, my $hbox = new CFPlus::UI::HBox); - $hbox->add (my $mode_slider = new CFPlus::UI::Slider force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1]); - $hbox->add (my $mode_label = new CFPlus::UI::Label align => 0, valign => 0, height => 0.8, template => "9999x9999"); + $hbox->add (my $mode_slider = new CFPlus::UI::Slider + force_w => $WIDTH * 0.1, expand => 1, range => [$CFG->{sdl_mode}, 0, $#SDL_MODES, 0, 1], + tooltip => $vidmode_tooltip); + $hbox->add (my $mode_label = new CFPlus::UI::Label + align => 0, valign => 0, height => 0.8, template => "9999x9999@9+9", + can_events => 1, tooltip => $vidmode_tooltip); $mode_slider->connect (changed => sub { my ($self, $value) = @_; $CFG->{sdl_mode} = $self->{range}[0] = $value = int $value; - $mode_label->set_text (sprintf "%dx%d", @{$SDL_MODES[$value]}); + $mode_label->set_text (sprintf '%dx%d@%d+%d', @{$SDL_MODES[$value]}); }); $mode_slider->emit (changed => $mode_slider->{range}[0]); @@ -583,7 +591,7 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{map_scale} = 2 ** $value; 0 } ); - $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Smoothing"); + $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "Map Smoothing"); $table->add (1, $row++, new CFPlus::UI::CheckBox state => $CFG->{map_smoothing}, tooltip => "Map Smoothing tries to make tile borders less square. " @@ -606,14 +614,13 @@ on_changed => sub { my ($self, $value) = @_; $CFG->{fow_intensity} = $value; 0 } ); - $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "FoW Smooth"); + $table->add (0, $row, new CFPlus::UI::Label valign => 0, align => 1, text => "FoW Smoothing"); $table->add (1, $row++, new CFPlus::UI::CheckBox state => $CFG->{fow_smooth}, tooltip => "Smooth the Fog-of-War a bit to make it more realistic. Changes are instant.", on_changed => sub { my ($self, $value) = @_; $CFG->{fow_smooth} = $value; - status "Fog of War smoothing requires OpenGL 1.2 or higher" if $CFPlus::OpenGL::GL_VERSION < 1.2; 0 } ); @@ -759,18 +766,6 @@ $table->add (1, 3, new CFPlus::UI::CheckBox on_changed => sub { $ENV{CFPLUS_DEBUG} ^= 8; 0 }); $table->add (0, 4, new CFPlus::UI::Button text => "die on click(tm)", on_activate => sub { &CFPlus::debug() } ); - my @default_smooth = (0.05, 0.13, 0.05, 0.13, 0.30, 0.13, 0.05, 0.13, 0.05); - - for my $x (0..2) { - for my $y (0 .. 2) { - $table->add ($x + 3, $y, - new CFPlus::UI::Entry - text => $default_smooth[$x * 3 + $y], - on_changed => sub { $MAP->{smooth_matrix}[$x * 3 + $y] = $_[1] if $MAP; 0 }, - ); - } - } - $table->add (0, 5, new CFPlus::UI::TextEdit text => "line1\0152\0153");#d# $table @@ -1282,7 +1277,14 @@ } sub autopickup_setup { - my $table = new CFPlus::UI::Table; + my $r = new CFPlus::UI::ScrolledWindow ( + expand => 1, + scroll_y => 1 + ); + $r->add (my $table = new CFPlus::UI::Table + row_expand => [0], + col_expand => [0, 1, 0, 1], + ); for ( ["General", 0, 0, @@ -1376,7 +1378,7 @@ 0 }); - $table + $r } my %SORT_ORDER = ( @@ -1720,17 +1722,15 @@ } sub video_init { - sdl_init; - $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} >= @SDL_MODES; my ($old_w, $old_h) = ($WIDTH, $HEIGHT); - ($WIDTH, $HEIGHT) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; + ($WIDTH, $HEIGHT, my ($rgb, $alpha)) = @{ $SDL_MODES[$CFG->{sdl_mode}] }; $FULLSCREEN = $CFG->{fullscreen}; $FAST = $CFG->{fast}; - CFPlus::SDL_SetVideoMode $WIDTH, $HEIGHT, $FULLSCREEN + CFPlus::SDL_SetVideoMode $WIDTH, $HEIGHT, $rgb, $alpha, $FULLSCREEN or die "SDL_SetVideoMode failed: " . (CFPlus::SDL_GetError) . "\n"; $SDL_ACTIVE = 1; @@ -2164,7 +2164,7 @@ $NOW = time; ($SDL_CB{$_->{type}} || sub { warn "unhandled event $_->{type}" })->($_) - for CFPlus::SDL_PollEvent; + for CFPlus::poll_events; if (%animate_object) { $_->animate ($LAST_REFRESH - $NOW) for values %animate_object; @@ -2208,7 +2208,8 @@ }, CFPlus::SDL_ACTIVEEVENT => sub { # not useful, as APPACTIVE include sonly iconified state, not unmapped -# printf "active %x %x\n", $_[0]{gain}, $_[0]{state};#d# +# printf "active %x %x %x\n", $_[0]{gain}, $_[0]{state}, CFPlus::SDL_GetAppState;#d# +# printf "a %x\n", CFPlus::SDL_GetAppState & CFPlus::SDL_APPACTIVE;#d# # printf "A\n" if $_[0]{state} & CFPlus::SDL_APPACTIVE; # printf "K\n" if $_[0]{state} & CFPlus::SDL_APPINPUTFOCUS; # printf "M\n" if $_[0]{state} & CFPlus::SDL_APPMOUSEFOCUS; @@ -2254,8 +2255,8 @@ fast => 0, map_scale => 1, fow_enable => 1, - fow_intensity => 0.45, - fow_smooth => 0, + fow_intensity => 0, + fow_smooth => 1, map_smoothing => 1, gui_fontsize => 1, log_fontsize => 0.7, @@ -2299,10 +2300,8 @@ sdl_init; - @SDL_MODES = reverse - grep $_->[0] >= 640 && $_->[1] >= 480, - CFPlus::SDL_ListModes; - + @SDL_MODES = CFPlus::SDL_ListModes 8, 8; + @SDL_MODES = CFPlus::SDL_ListModes 5, 0 unless @SDL_MODES; @SDL_MODES or CFPlus::fatal "Unable to find a usable video mode\n(hardware accelerated opengl fullscreen)"; $CFG->{sdl_mode} = 0 if $CFG->{sdl_mode} > @SDL_MODES;