- Your Widget Set For OpenGL
Main Page | Namespace List | Class Hierarchy | Class List | File List | Class Members | Related Pages

uxsdldriver.hpp

00001 /*************************************************************************** 00002 LibUFO - UI For OpenGL 00003 copyright : (C) 2001-2005 by Johannes Schmidt 00004 email : schmidtjf at users.sourceforge.net 00005 ------------------- 00006 00007 file : include/ufo/ux/uxsdldriver.hpp 00008 begin : Sun Aug 8 2004 00009 $Id: uxsdldriver.hpp,v 1.8 2005/10/17 16:39:54 schmidtjf Exp $ 00010 ***************************************************************************/ 00011 00012 /*************************************************************************** 00013 * This library is free software; you can redistribute it and/or * 00014 * modify it under the terms of the GNU Lesser General Public * 00015 * License as published by the Free Software Foundation; either * 00016 * version 2.1 of the License, or (at your option) any later version. * 00017 * * 00018 * This library is distributed in the hope that it will be useful, * 00019 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 00020 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * 00021 * Lesser General Public License for more details. * 00022 * * 00023 * You should have received a copy of the GNU Lesser General Public * 00024 * License along with this library; if not, write to the Free Software * 00025 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * 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: // Implements UVideoDriver 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: // sdl methods 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: // init 00075 void * getProcAddress(const char* proc); 00076 00077 public: // Public static methods 00081 static void pushSDLEvents(SDL_Event * events, int numEvents); 00083 static void pushSDLEvents(UXContext * uxcontext, SDL_Event * events, int numEvents); 00084 00085 public: // plugin methods 00086 static UPluginBase * createPlugin(); 00087 static void destroyPlugin(UPluginBase * plugin); 00088 00089 private: // Private attributes 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: // Implements UVideoDevice 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: // Private attributes 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 } // namespace ufo 00147 00148 #endif // UXSDLDRIVER_HPP

The libUFO Project - written by Johannes Schmidt