235 |
$app->sync; |
$app->sync; |
236 |
} |
} |
237 |
|
|
238 |
|
=head2 loop |
239 |
|
|
240 |
|
Implement SDL event loop |
241 |
|
|
242 |
|
=cut |
243 |
|
|
244 |
|
sub loop { |
245 |
|
my $self = shift; |
246 |
|
my $event = SDL::Event->new(); |
247 |
|
|
248 |
|
my $run_for = 2000; |
249 |
|
|
250 |
|
MAIN_LOOP: |
251 |
|
while ( 1 ) { |
252 |
|
while ($event->poll) { |
253 |
|
my $type = $event->type(); |
254 |
|
|
255 |
|
last MAIN_LOOP if ($type == SDL_QUIT); |
256 |
|
last MAIN_LOOP if ($type == SDL_KEYDOWN && $event->key_name() eq 'escape'); |
257 |
|
|
258 |
|
if ($type == SDL_KEYDOWN) { |
259 |
|
$run_for = $self->cli; |
260 |
|
} |
261 |
|
} |
262 |
|
M6502::exec($run_for); |
263 |
|
} |
264 |
|
} |
265 |
|
|
266 |
=head1 SEE ALSO |
=head1 SEE ALSO |
267 |
|
|
268 |
L<Orao> is sample implementation using this module |
L<Orao> is sample implementation using this module |