File: graphicsqueue.h

package info (click to toggle)
asc 2.6.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 81,592 kB
  • sloc: cpp: 158,704; sh: 11,544; ansic: 6,736; makefile: 606; perl: 138
file content (74 lines) | stat: -rw-r--r-- 2,026 bytes parent folder | download | duplicates (4)
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 "loki/Functor.h"
#include "loki/Typelist.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, LOKI_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::signal<void,const SDL_Surface*> postScreenUpdate;

#endif