Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_RENDERCONTEXT_H__
00009 #define __SP_RENDERCONTEXT_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013 #include "Base/spDimension.hpp"
00014 #include "Base/spInputOutputString.hpp"
00015 #include "Platform/spSoftPixelDeviceFlags.hpp"
00016 #include "RenderSystem/spSharedRenderContext.hpp"
00017
00018
00019 namespace sp
00020 {
00021 namespace video
00022 {
00023
00024
00026 class SP_EXPORT RenderContext
00027 {
00028
00029 public:
00030
00031 virtual ~RenderContext();
00032
00033
00034
00047 virtual bool openGraphicsScreen(
00048 void* ParentWindow, const dim::size2di &Resolution, const io::stringc &Title,
00049 s32 ColorDepth, bool isFullscreen, const SDeviceFlags &Flags
00050 ) = 0;
00052 virtual void closeGraphicsScreen() = 0;
00053
00059 virtual void flipBuffers() = 0;
00060
00062 virtual bool activate() = 0;
00063
00065 virtual bool deactivate() = 0;
00066
00068 virtual void setWindowTitle(const io::stringc &Title);
00069
00071 virtual io::stringc getWindowTitle() const;
00072
00074 virtual void setWindowPosition(const dim::point2di &Position);
00075
00077 virtual dim::point2di getWindowPosition() const;
00078
00080 virtual dim::size2di getWindowSize() const;
00081
00083 virtual dim::size2di getWindowBorder() const;
00084
00086 virtual bool isWindowActive() const;
00087
00098 virtual void* getWindowObject() = 0;
00099
00107 virtual SharedRenderContext* createSharedContext();
00108
00110 virtual void deleteSharedContext(SharedRenderContext* SharedContext);
00111
00113 virtual void setFullscreen(bool Enable);
00114
00116 virtual void setVsync(bool isVsync);
00117
00122 virtual void setResolution(const dim::size2di &Resolution);
00123
00124
00125
00127 static RenderContext* getActiveRenderContext();
00128
00133 static void setActiveRenderContext(RenderContext* Context);
00134
00135
00136
00141 inline bool getFullscreen() const
00142 {
00143 return isFullscreen_;
00144 }
00146 inline s32 getColorDepth() const
00147 {
00148 return ColorDepth_;
00149 }
00151 inline dim::size2di getResolution() const
00152 {
00153 return Resolution_;
00154 }
00156 inline SDeviceFlags getFlags() const
00157 {
00158 return Flags_;
00159 }
00160
00168 inline bool getVsync() const
00169 {
00170 return Flags_.isVsync;
00171 }
00172
00173 protected:
00174
00175
00176
00177 RenderContext();
00178
00179 void resetConfig();
00180
00181
00182
00183 void* ParentWindow_;
00184
00185 dim::size2di Resolution_;
00186 s32 ColorDepth_;
00187 bool isFullscreen_;
00188 io::stringc Title_;
00189 SDeviceFlags Flags_;
00190
00191 std::list<SharedRenderContext*> SharedContextList_;
00192
00193 static RenderContext* ActiveRenderContext_;
00194
00195 };
00196
00197
00198 }
00199
00200 }
00201
00202
00203 #endif
00204
00205
00206
00207