00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
#ifndef UXSDLDRIVER_HPP
00029
#define UXSDLDRIVER_HPP
00030
00031
#include "../uvideodriver.hpp"
00032
#include "../uvideodevice.hpp"
00033
00034
#include "../events/ukeysym.hpp"
00035
#include "SDL.h"
00036
#include "SDL_syswm.h"
00037
00038
namespace ufo {
00039
00040
class UXContext;
00041
class UVideoPlugin;
00042
class UPluginBase;
00043
class USharedLib;
00044
class UXSDLDevice;
00045
00051 class UFO_EXPORT UXSDLDriver :
public UVideoDriver {
00052 UFO_DECLARE_DYNAMIC_CLASS(UXSDLDriver)
00053
public:
00054 UXSDLDriver(
const char * sdlPath =
"");
00055
virtual ~UXSDLDriver();
00056
00057
public:
00058
virtual bool init();
00059
virtual bool isInitialized();
00060
virtual void quit();
00061
virtual std::string getName();
00062
00063
virtual void pumpEvents();
00064
00065
virtual UVideoDevice * createVideoDevice();
00066
00067
public:
00068
#define UFO_SDL_PROC(ret,func,params) ret (SDLCALL *func) params;
00069
#include "ux_sdl_prototypes.hpp"
00070
#undef UFO_SDL_PROC
00071
00072
bool isValid()
const;
00073
00074
public:
00075
void * getProcAddress(
const char* proc);
00076
00077
public:
00081
static void pushSDLEvents(SDL_Event * events,
int numEvents);
00083
static void pushSDLEvents(
UXContext * uxcontext, SDL_Event * events,
int numEvents);
00084
00085
public:
00086
static UPluginBase * createPlugin();
00087
static void destroyPlugin(
UPluginBase * plugin);
00088
00089
private:
00090
USharedLib * m_sdlLib;
00091
UXSDLDevice * m_device;
00092
bool m_isValid;
00093
bool m_isInit;
00094
bool m_createdGLDriver;
00095 };
00096
00097
00103
class UFO_EXPORT UXSDLDevice :
public UVideoDevice {
00104 UFO_DECLARE_ABSTRACT_CLASS(UXSDLDevice)
00105 public:
00106 UXSDLDevice(UXSDLDriver * driver);
00107 public:
00108 virtual
void setFrame(
UXFrame * frame);
00109
00110 virtual
void setSize(
int w,
int h);
00111 virtual
UDimension getSize() const;
00112
00113 virtual
void setLocation(
int x,
int y);
00114 virtual
UPoint getLocation() const;
00115
00116 virtual
void setTitle(const std::string & title);
00117 virtual std::string getTitle() const;
00118
00119 virtual
void setDepth(
int depth);
00120 virtual
int getDepth() const;
00121
00122 virtual
void swapBuffers();
00123 virtual
void makeContextCurrent();
00124
00125 virtual
bool show();
00126 virtual
void hide();
00127
00128 virtual
void setFrameStyle(uint32_t frameStyle);
00129 virtual uint32_t getFrameStyle() const;
00130
00131 virtual
void setInitialFrameState(uint32_t frameState);
00132 virtual uint32_t getFrameState() const;
00133
00134 virtual
void notify(uint32_t type,
int arg1,
int arg2,
int arg3,
int arg4);
00135 private:
00136 UXSDLDriver * m_sdldriver;
00137
UXFrame * m_frame;
00138
UDimension m_size;
00139
UPoint m_pos;
00140
bool m_isVisible;
00141 uint32_t m_frameStyle;
00142 uint32_t m_frameState;
00143
int m_depth;
00144 };
00145
00146 }
00147
00148 #endif