Browse files

added print screen function

  • Loading branch information...
1 parent f945a0a commit 755f15aa66fa5cd541d75f17d7b392ea2c2604e8 Tobias Leich committed Aug 31, 2010
Showing with 8 additions and 1 deletion.
  1. +8 −1 solitaire.pl
View
9 solitaire.pl
@@ -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) {

0 comments on commit 755f15a

Please sign in to comment.