SDL: add input support, use SDL mainloop in a thread
[vuplus_dvbapp] / lib / gdi / sdl.h
index 9f86cbb..6d016cf 100644 (file)
@@ -1,21 +1,35 @@
 #ifndef __lib_gdi_sdl_h
 #define __lib_gdi_sdl_h
 
-#include "fb.h"
-#include "gpixmap.h"
-#include "gmaindc.h"
+#include <lib/base/thread.h>
+#include <lib/gdi/gmaindc.h>
 
 #include <SDL.h>
 
-class gSDLDC: public gMainDC
+class gSDLDC: public gMainDC, public eThread, public Object
 {
+private:
        SDL_Surface *m_screen;
        void exec(const gOpcode *opcode);
 
-       void setPalette();
        gSurface m_surface;
+
+       eFixedMessagePump<SDL_Event> m_pump;
+       void keyEvent(const SDL_Event &event);
+       void pumpEvent(const SDL_Event &event);
+       virtual void thread();
+
+       enum event {
+               EV_SET_VIDEO_MODE,
+               EV_FLIP,
+               EV_QUIT,
+       };
+
+       void pushEvent(enum event code, void *data1 = 0, void *data2 = 0);
+       void evSetVideoMode(unsigned long xres, unsigned long yres);
+       void evFlip();
+
 public:
-       
        void setResolution(int xres, int yres);
        gSDLDC();
        virtual ~gSDLDC();