File: graphicsqueue.h

package info (click to toggle)
asc 2.1.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 59,052 kB
  • ctags: 25,676
  • sloc: cpp: 145,189; sh: 8,705; ansic: 5,564; makefile: 551; perl: 150
file content (74 lines) | stat: -rw-r--r-- 2,005 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef graphicsqueueH
#define graphicsqueueH

#include <list>
#include <SDL.h>
#include <sigc++/sigc++.h>

 #include "../libs/loki/Functor.h"

class GraphicsQueueOperation {
   public:
      virtual void execute() = 0;
      virtual ~GraphicsQueueOperation() {};
   };
   
   class UpdateRectOp : public GraphicsQueueOperation {
         SDL_Surface *screen;
         Sint32 x, y, w, h;
      public:
         UpdateRectOp( SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h ) {
               this->x = x;
               this->y = y;
               this->w = w;
               this->h = h;
               this->screen = screen;
          };
          
          void execute();
      };

   class UpdateRectsOp : public GraphicsQueueOperation {
         SDL_Surface *screen;
         int numrects;
         SDL_Rect *rects;
      public:
         UpdateRectsOp( SDL_Surface *screen, int numrects, SDL_Rect *rects);
          
          void execute();
          ~UpdateRectsOp();
      };
      
   class MouseVisibility : public GraphicsQueueOperation {
         bool visible;
      public:
         MouseVisibility( bool  visi )  : visible( visi ) { };
          void execute() { SDL_ShowCursor(visible); };
      };



   class InitScreenOp : public GraphicsQueueOperation {
         int x,y,depth,flags;
      public:
         typedef Loki::Functor<void, TYPELIST_1(SDL_Surface*) > ScreenRegistrationFunctor;
      private:
         ScreenRegistrationFunctor srf;
      public:

         InitScreenOp( int x, int y, int depth, int flags, ScreenRegistrationFunctor screenRegistrationFunctor ) 
         {
            this->x = x;
            this->y = y;
            this->depth = depth;
            this->flags = flags;
            srf = screenRegistrationFunctor;
         };
         void execute();
      };

 extern void queueOperation( GraphicsQueueOperation* gqo, bool wait = false, bool forceAsync = false );

 extern SigC::Signal1<void,const SDL_Surface*> postScreenUpdate;

#endif