X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2Findex.html-inc;h=fa7bf74cae76dd5195bbb16f20a9ff57df20586d;hb=a97e4e5b047e7e48f97c4cc45e2b6e0f82b7a7b6;hp=e7261d589af5973aa85ca44bb68ab007fccff09b;hpb=60038c89a1f2087fd8dd3daa1c0706f674bd7b03;p=sdlgit%2FSDL-Site.git diff --git a/pages/index.html-inc b/pages/index.html-inc index e7261d5..fa7bf74 100644 --- a/pages/index.html-inc +++ b/pages/index.html-inc @@ -1,6 +1,93 @@ -
-

-Once in a while .... (set_event_filter) -

-
-

Once in a while
Things just work!



So I have been hacking for a while on SDL::Events::set_event_filter. The code below is an example usage. The magic behind this is here

 1 #!/usr/bin/perl -w
2
use strict;
3 use warnings;
4 use SDL v2.3; #Require the redesign branch
5
use SDL::Video;
6 use SDL::Event;
7 use SDL::Events;
8
9 SDL::init(SDL_INIT_VIDEO);
10 my $display = SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE );
11 my $event = SDL::Event->new();
12
13 #This filters out all ActiveEvents
14
my $filter = sub {
15 my ($e, $type) = ($_[0], $_[0]->type);
16 if($type == SDL_ACTIVEEVENT){ return 0 }
17 elsif($type == SDL_MOUSEBUTTONDOWN && $e->button_button == 1){ return 0 }
18 else { return 1; }
19 };
20
21 SDL::Events::set_event_filter($filter);
22
23 while(1)
24 {
25
26 SDL::Events::pump_events();
27 if(SDL::Events::poll_event($event))
28 {
29
30 if( $event->type == SDL_ACTIVEEVENT)
31 {
32 print "Hello Mouse!!!\n" if ($event->active_gain && ($event->active_state == SDL_APPMOUSEFOCUS) );
33 print "Bye Mouse!!!\n" if (!$event->active_gain && ($event->active_state == SDL_APPMOUSEFOCUS) );
34 }
35 if( $event->type == SDL_MOUSEBUTTONDOWN)
36 {
37 my ($x, $y, $but ) = ($event->button_x, $event->button_y, $event->button_button);
38 warn "$but CLICK!!! at $x and $y \n";
39 }
40
41 last if($event->type == SDL_QUIT);
42 }
43 }
44 SDL::quit()
 
 
Tinker with $filter and look at perldoc lib/SDL/pods/Event.pod. 
 
Have fun,
--yapgh
\ No newline at end of file +
+ +

Index

+ +
+ + +

Simple DirectMedia Library Bindings for Perl

Top

+
+ +
+

Welcome

+
+

SDL Perl are a set of bindings to the Simple DirectMedia Layer (SDL).

+

'Simple DirectMedia Layer is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, +3D hardware via OpenGL, and 2D video framebuffer. It is used by MPEG playback software, emulators, and many popular games, including the +award winning Linux port of "Civilization: Call To Power."' --www.libsdl.org

+

SDL Perl is an active and exciting project with many facets. Explore this website to learn more.

+ +
+

Getting Started

+
+

A new SDL::Manual is being prepared for new users. In the mean time take a look at the documentation, ask for help on the mailing lists or irc channel, and see the examples in the source code.

+ +
+

Contribute

+
+
+
IRC
+
+

Talk to us on channel #sdl .

+
+
Mailing List
+
+

Send us an email at mailing list.

+

Our archives are located at mail-archive and nntp.perl.

+

We also have a rssfeed.

+

For help send an empty email to sdl-devel-help@perl.org.

+

To subscribe to the mailing lists send an empty email to sdl-devel-subscribe@perl.org.

+

To unsubscribe send an empty email to sdl-devel-unsubscribe@perl.org.

+
+
Testing and Development
+
+

Join us on the github site to get started on making and grabbing tickets.

+

To begin testing read the wiki page on testing.

+
+
+ +
+

Latest News

Top

+
+ +
+

December 26th 2010

+
+ +
+

CPAN Release SDL 2.524

+
+

SDL 2.524 is on CPAN! The new API has many changes and much more improvements. So check it out.

+

SDL Perl at v2.2.6 on CPAN is the last of its kind which will have the old API.

+ +
+

SDL Manual: Writing Games with SDL Perl

+
+

The grant proposal has been accepted by The Perl Foundation. SDL_Manual is in continous development on github.

+

More up to date versions of the books are also available in HTML and PDF formats.

+ +
+

Active Development

+
+

SDL Perl is being actively developed to v3.0. We are adding many new SDLx::* modules to provide a more Perly interface to SDL. Please review, request or even hack the code. Talk to us on the irc channel or mailing lists.

+ +
+
\ No newline at end of file