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 |
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( |
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 |
} |
} |