X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pages%2Fblog-0019.html-inc;h=64faf7628d2d7bc6c882021f0a476befd7f20b41;hb=6b580206fb43261fb235c1071cee5fea29fdac79;hp=0de3c832cedb93b3d65e9876f3ff91874c42d50a;hpb=65a973147068b3edbbb232aa50fd53a79d7daaef;p=sdlgit%2FSDL-Site.git diff --git a/pages/blog-0019.html-inc b/pages/blog-0019.html-inc index 0de3c83..64faf76 100644 --- a/pages/blog-0019.html-inc +++ b/pages/blog-0019.html-inc @@ -1,59 +1,23 @@

-Once in a while .... (set_event_filter) +Threaded XS callback finally gets solved.

-

-Once in a while
-Things just work!
+

+Dragged down from the lofty isles,
+into the guts and gore of the monster,
+a welcoming cringe in the gut approaches.



-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
+So I was planning staying silent until an exam I had was done. But new developers on IRC (j_king, felix and ruoso) pull me back in. Which is a good thing ... I suppose ... because we finally have threaded callbacks for timer and audiospec to work. ruoso++ for this major contribution. If you remember this was the problem we were having.

-
 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 +The new callbacks capability in audiospec allow you to procedurally generate sound now. If you would like a simple example take a look at t/core_audiospec.t. However a more fun example may be ruoso++'s tecla (a game for toddlers). Myself and Garu think it is a work of art but that is only because we are toddlers.
+
+On a side note some tickets on RT have also received some love ( after 3 or 4 years ... but nonetheless). TonyC++ sorry for the long time in response.
+
+More information on the CHANGELOG.
+
+Also a shout out to FROGGS for his new SON!!!. Congrats buddy! +


+

\ No newline at end of file