Anonymous user
Mouse position: Difference between revisions
no edit summary
Capra Hircus (talk | contribs) No edit summary |
No edit summary |
||
Line 410:
{Delay 250}
end</lang>
=={{header|Perl}}==
The following code will use the SDL module, a wrapper for the libSDL C-library. When you move the mouse over the created window, the mouse position get printed and the program terminates.
<lang Perl>use SDL;
use SDL::Events;
use SDLx::App;
my $app = SDLx::App->new;
$app->add_event_handler( sub {
my $event = shift;
if( $event->type == SDL_MOUSEMOTION ) {
printf( "x=%d y=%d\n", $event->motion_x, $event->motion_y );
$app->stop
}
} );
$app->run;
</lang>
Output:
<pre>x=15 y=304</pre>
=={{header|PicoLisp}}==
|