00001 #ifndef graphicsqueueH
00002 #define graphicsqueueH
00003
00004 #include <list>
00005 #include <SDL.h>
00006 #include <sigc++/sigc++.h>
00007
00008 #include "../libs/loki/Functor.h"
00009
00010 class GraphicsQueueOperation {
00011 public:
00012 virtual void execute() = 0;
00013 virtual ~GraphicsQueueOperation() {};
00014 };
00015
00016 class UpdateRectOp : public GraphicsQueueOperation {
00017 SDL_Surface *screen;
00018 Sint32 x, y, w, h;
00019 public:
00020 UpdateRectOp( SDL_Surface *screen, Sint32 x, Sint32 y, Sint32 w, Sint32 h ) {
00021 this->x = x;
00022 this->y = y;
00023 this->w = w;
00024 this->h = h;
00025 this->screen = screen;
00026 };
00027
00028 void execute();
00029 };
00030
00031 class UpdateRectsOp : public GraphicsQueueOperation {
00032 SDL_Surface *screen;
00033 int numrects;
00034 SDL_Rect *rects;
00035 public:
00036 UpdateRectsOp( SDL_Surface *screen, int numrects, SDL_Rect *rects);
00037
00038 void execute();
00039 ~UpdateRectsOp();
00040 };
00041
00042 class MouseVisibility : public GraphicsQueueOperation {
00043 bool visible;
00044 public:
00045 MouseVisibility( bool visi ) : visible( visi ) { };
00046 void execute() { SDL_ShowCursor(visible); };
00047 };
00048
00049
00050
00051 class InitScreenOp : public GraphicsQueueOperation {
00052 int x,y,depth,flags;
00053 public:
00054 typedef Loki::Functor<void, TYPELIST_1(SDL_Surface*) > ScreenRegistrationFunctor;
00055 private:
00056 ScreenRegistrationFunctor srf;
00057 public:
00058
00059 InitScreenOp( int x, int y, int depth, int flags, ScreenRegistrationFunctor screenRegistrationFunctor )
00060 {
00061 this->x = x;
00062 this->y = y;
00063 this->depth = depth;
00064 this->flags = flags;
00065 srf = screenRegistrationFunctor;
00066 };
00067 void execute();
00068 };
00069
00070 extern void queueOperation( GraphicsQueueOperation* gqo, bool wait = false, bool forceAsync = false );
00071
00072 extern SigC::Signal1<void,const SDL_Surface*> postScreenUpdate;
00073
00074 #endif