Created
November 11, 2009 14:35
-
-
Save kthakore/231987 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use SDL; | |
use SDL::Events; | |
use SDL::Event; | |
use SDL::Video; | |
SDL::init(SDL_INIT_VIDEO); | |
my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE ); | |
my $event = SDL::Event->new(); | |
while(1) | |
{ | |
SDL::Events::pump_events(); | |
if(SDL::Events::poll_event($event) && $event->type == SDL_ACTIVEEVENT) | |
{ | |
print "Hello Mouse!!!\n" if ($event->active_gain && ($event->active_state == SDL_APPMOUSEFOCUS) ); | |
print "Bye Mouse!!!\n" if (!$event->active_gain && ($event->active_state == SDL_APPMOUSEFOCUS) ); | |
} | |
exit if($event->type == SDL_QUIT); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment