/[VRac]/Screen.pm
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /Screen.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 183 by dpavlin, Sun Sep 30 19:31:14 2007 UTC revision 184 by dpavlin, Sun Sep 30 19:46:20 2007 UTC
# Line 17  use Exporter 'import'; Line 17  use Exporter 'import';
17  our @EXPORT = qw'$white $black @flip';  our @EXPORT = qw'$white $black @flip';
18    
19  use base qw(Class::Accessor Prefs);  use base qw(Class::Accessor Prefs);
20  __PACKAGE__->mk_accessors(qw(app event screen_width screen_height));  __PACKAGE__->mk_accessors(qw(app event screen_width screen_height window_width window_height));
21    
22  =head1 NAME  =head1 NAME
23    
# Line 79  sub open_screen { Line 79  sub open_screen {
79          $self->screen_width( 256 ) unless defined $self->screen_width;          $self->screen_width( 256 ) unless defined $self->screen_width;
80          $self->screen_height( 256 ) unless defined $self->screen_height;          $self->screen_height( 256 ) unless defined $self->screen_height;
81    
82            my $w = $self->screen_width * $self->scale + ( $self->show_mem ? 256 : 0 );
83            $self->window_width( $w );
84    
85            my $h = $self->screen_height;
86            # expand screen size to show whole 64k 256*256 memory map
87            $h = 256 if $self->show_mem && $h < 256;
88            $h *= $self->scale;
89            $self->window_height( $h );
90    
91          $app = SDL::App->new(          $app = SDL::App->new(
92                  -width  => $self->screen_width * $self->scale + ( $self->show_mem ? 256 : 0 ),                  -width  => $w,
93                  -height => $self->screen_height * $self->scale,                  -height => $h,
94                  -depth  => 16,                  -depth  => 16,
95                  -flags=>SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_HWACCEL,                  -flags=>SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_HWACCEL,
96          );          );
# Line 94  sub open_screen { Line 103  sub open_screen {
103          my $event = SDL::Event->new();          my $event = SDL::Event->new();
104          $self->event( $event );          $self->event( $event );
105    
106          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 ",
107                    $self->window_width, "x", $self->window_height, "\n";
108  }  }
109    
110  our $white      = SDL::Color->new( -r => 0xff, -g => 0xff, -b => 0xff );  our $white      = SDL::Color->new( -r => 0xff, -g => 0xff, -b => 0xff );
# Line 192  sub render_frame { Line 202  sub render_frame {
202    
203          my $scale = $self->scale || confess "no scale?";          my $scale = $self->scale || confess "no scale?";
204    
205          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 );
         );  
206          my $rect_screen = 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 );
207    
208          if ( $scale > 1 ) {          if ( $scale > 1 ) {
# Line 235  sub render_mem { Line 244  sub render_mem {
244    
245          $vram->display_format;          $vram->display_format;
246    
247          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 );
248          my $rect_mem = SDL::Rect->new( -x => $self->screen_width * $self->scale, -y => 0, -width => 256, -height => 256 );          my $rect_mem = SDL::Rect->new( -x => $self->screen_width * $self->scale, -y => 0, -width => 256, -height => 256 );
249    
250          $vram->blit( $rect, $app, $rect_mem );          $vram->blit( $rect, $app, $rect_mem );

Legend:
Removed from v.183  
changed lines
  Added in v.184

  ViewVC Help
Powered by ViewVC 1.1.26