00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef TINYSDLGRAPHICSWINDOW_H
00016 #define TINYSDLGRAPHICSWINDOW_H
00017
00018 #include "pandabase.h"
00019
00020 #ifdef HAVE_SDL
00021
00022 #include "tinySDLGraphicsPipe.h"
00023 #include "graphicsWindow.h"
00024 #include "buttonHandle.h"
00025 #include "SDL.h"
00026 #include "zbuffer.h"
00027
00028
00029
00030
00031
00032 class EXPCL_TINYDISPLAY TinySDLGraphicsWindow : public GraphicsWindow {
00033 public:
00034 TinySDLGraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe,
00035 const string &name,
00036 const FrameBufferProperties &fb_prop,
00037 const WindowProperties &win_prop,
00038 int flags,
00039 GraphicsStateGuardian *gsg,
00040 GraphicsOutput *host);
00041 virtual ~TinySDLGraphicsWindow();
00042
00043 virtual bool begin_frame(FrameMode mode, Thread *current_thread);
00044 virtual void end_frame(FrameMode mode, Thread *current_thread);
00045 virtual void end_flip();
00046
00047 virtual void process_events();
00048 virtual void set_properties_now(WindowProperties &properties);
00049
00050 virtual bool supports_pixel_zoom() const;
00051
00052 protected:
00053 virtual void close_window();
00054 virtual bool open_window();
00055
00056 private:
00057 void create_frame_buffer();
00058 static ButtonHandle get_keyboard_button(SDLKey sym);
00059 static ButtonHandle get_mouse_button(Uint8 button);
00060
00061 private:
00062 SDL_Surface *_screen;
00063 ZBuffer *_frame_buffer;
00064 unsigned int _flags;
00065 unsigned int _pitch;
00066
00067 public:
00068 static TypeHandle get_class_type() {
00069 return _type_handle;
00070 }
00071 static void init_type() {
00072 GraphicsWindow::init_type();
00073 register_type(_type_handle, "TinySDLGraphicsWindow",
00074 GraphicsWindow::get_class_type());
00075 }
00076 virtual TypeHandle get_type() const {
00077 return get_class_type();
00078 }
00079 virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
00080
00081 private:
00082 static TypeHandle _type_handle;
00083 };
00084
00085 #include "tinySDLGraphicsWindow.I"
00086
00087 #endif // HAVE_SDL
00088
00089 #endif