Skip to content

Commit

Permalink
added print screen function
Browse files Browse the repository at this point in the history
  • Loading branch information
Tobias Leich committed Aug 31, 2010
1 parent f945a0a commit 755f15a
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion solitaire.pl
Expand Up @@ -129,7 +129,14 @@ sub event_loop
}
}
elsif ($type == SDL_KEYDOWN) {
$handler->{on_quit}->() if $event->key_sym == SDLK_ESCAPE;
if($event->key_sym == SDLK_PRINT) {
my $screen_shot_index = 1;
map{$screen_shot_index = $1 + 1 if $_ =~ /Shot(\d+)\.bmp/ && $1 >= $screen_shot_index} <Shot*\.bmp>;
SDL::Video::save_BMP($display, sprintf("Shot%04d.bmp", $screen_shot_index ));
}
elsif($event->key_sym == SDLK_ESCAPE) {
$handler->{on_quit}->();
}
$handler->{on_keydown}->();
}
elsif ($type == SDL_QUIT) {
Expand Down

0 comments on commit 755f15a

Please sign in to comment.