/[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 125 by dpavlin, Sat Aug 4 15:09:44 2007 UTC revision 142 by dpavlin, Sun Aug 5 01:31:41 2007 UTC
# Line 12  use SDL::Constants; Line 12  use SDL::Constants;
12    
13  use Carp qw/confess/;  use Carp qw/confess/;
14  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
 use M6502 qw'@mem';  
15    
16  use Exporter 'import';  use Exporter 'import';
17  our @EXPORT = qw'$white $black';  our @EXPORT = qw'$white $black';
# Line 46  sub open_screen { Line 45  sub open_screen {
45                  -width  => 256 * $self->scale + ( $self->show_mem ? 256 : 0 ),                  -width  => 256 * $self->scale + ( $self->show_mem ? 256 : 0 ),
46                  -height => 256 * $self->scale,                  -height => 256 * $self->scale,
47                  -depth  => 16,                  -depth  => 16,
48                    -flags=>SDL_DOUBLEBUF | SDL_HWSURFACE | SDL_HWACCEL,
49          );          );
50          #$app->grab_input( SDL_GRAB_QUERY );          #$app->grab_input( SDL_GRAB_QUERY );
51          $app->grab_input( SDL_GRAB_OFF );          $app->grab_input( SDL_GRAB_OFF );
# Line 126  sub sync { Line 126  sub sync {
126    
127  Render one frame of video ram  Render one frame of video ram
128    
129    $self->render_vram( @video_memory );    $self->render_vram;
130    
131  =cut  =cut
132    
# Line 173  sub render_frame { Line 173  sub render_frame {
173    
174  =head2 render_mem  =head2 render_mem
175    
176    $self->render_mem( @ram );    $self->render_mem( @mem );
177    
178  =cut  =cut
179    
# Line 269  sub key_pressed { Line 269  sub key_pressed {
269    
270  =head2 loop  =head2 loop
271    
272  Implement SDL event loop  Implement CPU run for C<$run_run> cycles inside SDL event loop
273    
274      $self->loop( sub {
275            my $run_for = shift;
276            CPU::exec( $run_for );
277            $self->render_vram;
278      } );
279    
280  =cut  =cut
281    
282  sub loop {  sub loop {
283          my $self = shift;          my $self = shift;
284            my $exec = shift;
285    
286            confess "need coderef as argument" unless ref($exec) eq 'CODE';
287          my $event = SDL::Event->new();          my $event = SDL::Event->new();
288    
         MAIN_LOOP:  
289          while ( 1 ) {          while ( 1 ) {
290                  $self->key_pressed( 1 );                  $self->key_pressed( 1 );
291                  M6502::exec($run_for);                  $exec->($run_for);
                 $self->render_vram( @mem[ 0x6000 .. 0x7fff ] );  
292          }          }
293  }  }
294    

Legend:
Removed from v.125  
changed lines
  Added in v.142

  ViewVC Help
Powered by ViewVC 1.1.26