12 |
use Carp qw/confess/; |
use Carp qw/confess/; |
13 |
|
|
14 |
use base qw(Class::Accessor); |
use base qw(Class::Accessor); |
15 |
__PACKAGE__->mk_accessors(qw(debug scale show_mem mem_dump trace app)); |
#__PACKAGE__->mk_accessors(qw(debug scale show_mem trace app)); |
16 |
|
|
17 |
|
=head1 NAME |
18 |
|
|
19 |
|
Screen - simulated 256*256 pixels monochrome screen using SDL |
20 |
|
|
21 |
=head2 open_screen |
=head2 open_screen |
22 |
|
|
111 |
my $mask = 1; |
my $mask = 1; |
112 |
my $scale = $self->scale; |
my $scale = $self->scale; |
113 |
|
|
114 |
# printf "## vram %04x %02x*%02x %02x\n", $offset, $x, $y, $byte if $self->trace; |
printf "## vram %04x %02x*%02x %02x\n", $offset, $x, $y, $byte if $self->trace; |
115 |
|
|
116 |
foreach ( 0 .. 7 ) { |
foreach ( 0 .. 7 ) { |
117 |
my $on = $byte & $mask; |
my $on = $byte & $mask; |
142 |
return unless $self->show_mem && $self->app; |
return unless $self->show_mem && $self->app; |
143 |
|
|
144 |
my ( $x, $y ) = $self->mem_xy( $addr ); |
my ( $x, $y ) = $self->mem_xy( $addr ); |
145 |
warn sprintf "## mem %04x %02x %02x %02d*%02d\n", $addr, $r, $g, $x, $y if $self->trace; |
warn sprintf "## mem %04x %02x %02x %02d*%02d\n", $addr, $r, $g, $x, $y if $self->debug; |
146 |
|
|
147 |
my $col = SDL::Color->new( -r => $r, -g => $g, -b => $b ); |
my $col = SDL::Color->new( -r => $r, -g => $g, -b => $b ); |
148 |
$self->app->pixel( $x, $y, $col ); |
$self->app->pixel( $x, $y, $col ); |
164 |
$app->sync; |
$app->sync; |
165 |
} |
} |
166 |
|
|
167 |
|
=head1 SEE ALSO |
168 |
|
|
169 |
|
L<Orao> is sample implementation using this module |
170 |
|
|
171 |
|
=head1 AUTHOR |
172 |
|
|
173 |
|
Dobrica Pavlinusic, C<< <dpavlin@rot13.org> >> |
174 |
|
|
175 |
|
=head1 COPYRIGHT & LICENSE |
176 |
|
|
177 |
|
Copyright 2007 Dobrica Pavlinusic, All Rights Reserved. |
178 |
|
|
179 |
|
This program is free software; you can redistribute it and/or modify it |
180 |
|
under the same terms as Perl itself. |
181 |
|
|
182 |
|
=cut |
183 |
1; |
1; |