X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2Fblog-0001.html-inc;h=317d824280cf826a66265ec0842be5fb27b9d59c;hb=1d5d4d44a3acf89f7820195b5016f4ebc4489250;hp=8db63a9e812bc0fba105ed4b0870b154a9afdf62;hpb=8d3f70f2a099e5c99545142b8dcb2368ab3f9b1f;p=sdlgit%2FSDL-Site.git diff --git a/pages/blog-0001.html-inc b/pages/blog-0001.html-inc index 8db63a9..317d824 100644 --- a/pages/blog-0001.html-inc +++ b/pages/blog-0001.html-inc @@ -1,6 +1,78 @@

-Once in a while .... (set_event_filter) +Grant Progess Reports 1-3: Sept - Nov

-

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 +As you know I have received a TPF grant to write a SDL Perl Manual.
+
+

+http://news.perlfoundation.org/2010/08/2010q3-grant-proposal-manual-f.html
+
+http://news.perlfoundation.org/2010/08/accepted-grants-for-2010q3.html
+
+I have been a bit busy with that and not been able to update my blog. Anyway here are some of the back dated Grant Updates. These updates where also posted on http://news.perlfoundation.org/
+
+
+
+
+
REPORT 1: Sept 2010

+Progress: 2.75 chapters / 11 chapters = approx 25%
+Kartik's work can be followed at:
+
+
+
REPORT 2: October 2010

+
Since last time:
+Chapters:
+Extra:
+Coments:
+Our work can be seen at:
+

+
REPORT 3: November 2010

+This is the progress so far:
+
+- SDL 2.523 Releases:
+        - Adds stability and better memory management for the game loop
+
+- 2 chapters have been completed
+        - Pong Chapter (Contributed by garu)
+        - Additional Modules
+- 1 extra chapter has been added
+        - Puzz(le) Chapter (Contributed by Blaizer)
+
+- 2 Chapters are in the Works
+        - Tetris Code has been mostly done (contributed by FROGGS)
+                - Needs to be fixed
+                - Needs write up
+        - Sound and Music Effects code is done
+                - Needs to be fixed
+                - Needs write up
+
+Our work can be seen at:
http://sdlperl.ath.cx/releases/SDL_Manual.pdf
http://sdlperl.ath.cx/releases/SDL_Manual.html
http://github.com/PerlGameDev/SDL_Manual

+Regards,
+YAPGH
+


+

\ No newline at end of file