/[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 110 by dpavlin, Fri Aug 3 12:21:47 2007 UTC revision 121 by dpavlin, Sat Aug 4 13:18:39 2007 UTC
# Line 62  my $red                = SDL::Color->new( -r => 0xff, Line 62  my $red                = SDL::Color->new( -r => 0xff,
62  my $green       = SDL::Color->new( -r => 0x00, -g => 0xff, -b => 0x00 );  my $green       = SDL::Color->new( -r => 0x00, -g => 0xff, -b => 0x00 );
63  my $blue        = SDL::Color->new( -r => 0x00, -g => 0x00, -b => 0xff );  my $blue        = SDL::Color->new( -r => 0x00, -g => 0x00, -b => 0xff );
64    
 my $rect_screen = SDL::Rect->new( -x => 0, -y => 0, -width => 256, -height => 256 );  
65  my $rect_mem = SDL::Rect->new( -x => 256, -y => 0, -width => 256, -height => 256 );  my $rect_mem = SDL::Rect->new( -x => 256, -y => 0, -width => 256, -height => 256 );
66    
67  =head2 p  =head2 p
# Line 175  sub render_vram { Line 174  sub render_vram {
174    
175          return unless $self->booted;          return unless $self->booted;
176    
         die "this function isn't supported if scale isn't 1" unless $self->scale == 1;  
   
177          confess "no data?" unless (@_);          confess "no data?" unless (@_);
178          confess "screen size not 256*256/8 but ",($#_+1) unless (($#_+1) == (256*256/8));          confess "screen size not 256*256/8 but ",($#_+1) unless (($#_+1) == (256*256/8));
179    
   
180          my $pixels = pack("C*", map { $flip[$_] } @_);          my $pixels = pack("C*", map { $flip[$_] } @_);
181    
182          my $vram = SDL::Surface->new(          my $vram = SDL::Surface->new(
# Line 193  sub render_vram { Line 189  sub render_vram {
189          $vram->set_colors( 0, $black, $white, $red );          $vram->set_colors( 0, $black, $white, $red );
190          $vram->display_format;          $vram->display_format;
191    
192          my $rect = SDL::Rect->new( -x => 0, -y => 0, -width => 256, -height => 256 );          my $scale = $self->scale;
193          $vram->blit( $rect, $app, $rect_screen );  
194            my $rect                = SDL::Rect->new( -x => 0, -y => 0, -width => 256 * $scale, -height => 256 * $scale );
195            my $rect_screen = SDL::Rect->new( -x => 0, -y => 0, -width => 256 * $scale, -height => 256 * $scale );
196    
197            if ( $scale > 1 ) {
198                    use SDL::Tool::Graphic;
199                    # last parametar is anti-alias
200                    my $zoomed = SDL::Tool::Graphic->zoom( $vram, $self->scale, $self->scale, 1 );
201                    $zoomed->blit( $rect, $app, $rect_screen );
202            } else {
203                    $vram->blit( $rect, $app, $rect_screen );
204            }
205    
206          $app->sync;          $app->sync;
207  }  }

Legend:
Removed from v.110  
changed lines
  Added in v.121

  ViewVC Help
Powered by ViewVC 1.1.26