--- Screen.pm 2007/09/30 19:31:14 183 +++ Screen.pm 2007/09/30 19:46:20 184 @@ -17,7 +17,7 @@ our @EXPORT = qw'$white $black @flip'; use base qw(Class::Accessor Prefs); -__PACKAGE__->mk_accessors(qw(app event screen_width screen_height)); +__PACKAGE__->mk_accessors(qw(app event screen_width screen_height window_width window_height)); =head1 NAME @@ -79,9 +79,18 @@ $self->screen_width( 256 ) unless defined $self->screen_width; $self->screen_height( 256 ) unless defined $self->screen_height; + my $w = $self->screen_width * $self->scale + ( $self->show_mem ? 256 : 0 ); + $self->window_width( $w ); + + my $h = $self->screen_height; + # expand screen size to show whole 64k 256*256 memory map + $h = 256 if $self->show_mem && $h < 256; + $h *= $self->scale; + $self->window_height( $h ); + $app = SDL::App->new( - -width => $self->screen_width * $self->scale + ( $self->show_mem ? 256 : 0 ), - -height => $self->screen_height * $self->scale, + -width => $w, + -height => $h, -depth => 16, -flags=>SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_HWACCEL, ); @@ -94,7 +103,8 @@ my $event = SDL::Event->new(); $self->event( $event ); - warn "# created SDL::App with screen ", $self->screen_width, "x", $self->screen_height, "\n"; + warn "# created SDL::App with screen ", $self->screen_width, "x", $self->screen_height, " in window ", + $self->window_width, "x", $self->window_height, "\n"; } our $white = SDL::Color->new( -r => 0xff, -g => 0xff, -b => 0xff ); @@ -192,8 +202,7 @@ my $scale = $self->scale || confess "no scale?"; - my $rect = SDL::Rect->new( -x => 0, -y => 0, -width => $self->screen_width * $scale, -height => $self->screen_height * $scale - ); + my $rect = SDL::Rect->new( -x => 0, -y => 0, -width => $self->screen_width * $scale, -height => $self->screen_height * $scale ); my $rect_screen = SDL::Rect->new( -x => 0, -y => 0, -width => $self->screen_width * $scale, -height => $self->screen_height * $scale ); if ( $scale > 1 ) { @@ -235,7 +244,7 @@ $vram->display_format; - my $rect = SDL::Rect->new( -x => 0, -y => 0, -width => $self->screen_width, -height => $self->screen_height ); + my $rect = SDL::Rect->new( -x => 0, -y => 0, -width => $self->screen_width, -height => $self->window_height ); my $rect_mem = SDL::Rect->new( -x => $self->screen_width * $self->scale, -y => 0, -width => 256, -height => 256 ); $vram->blit( $rect, $app, $rect_mem );