Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_RENDERCONTEXT_DESKTOP_H__
00009 #define __SP_RENDERCONTEXT_DESKTOP_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #if defined(SP_PLATFORM_WINDOWS) || defined(SP_PLATFORM_LINUX)
00015
00016
00017 #include "RenderSystem/spRenderContext.hpp"
00018
00019 #if defined(SP_PLATFORM_WINDOWS)
00020 # include <windows.h>
00021 #elif defined(SP_PLATFORM_LINUX)
00022 # include <X11/X.h>
00023 # include <X11/Xlib.h>
00024 # include <X11/Xutil.h>
00025 # include <X11/extensions/xf86vmode.h>
00026 # include <GL/glx.h>
00027 #endif
00028
00029
00030 namespace sp
00031 {
00032
00033 #if defined(SP_PLATFORM_WINDOWS)
00034 class SoftPixelDeviceWin32;
00035 #elif defined(SP_PLATFORM_LINUX)
00036 class SoftPixelDeviceLinux;
00037 #endif
00038
00039 namespace video
00040 {
00041
00042
00044 class SP_EXPORT DesktopRenderContext : public RenderContext
00045 {
00046
00047 public:
00048
00049 DesktopRenderContext();
00050 virtual ~DesktopRenderContext();
00051
00052
00053
00054 virtual bool openGraphicsScreen(
00055 void* ParentWindow, const dim::size2di &Resolution, const io::stringc &Title,
00056 s32 ColorDepth, bool isFullscreen, const SDeviceFlags &Flags
00057 );
00058 virtual void closeGraphicsScreen();
00059
00060 virtual void flipBuffers();
00061
00062 virtual bool activate();
00063 virtual bool deactivate();
00064
00065 virtual void setWindowTitle(const io::stringc &Title);
00066 virtual io::stringc getWindowTitle() const;
00067
00068 virtual void setWindowPosition(const dim::point2di &Position);
00069 virtual dim::point2di getWindowPosition() const;
00070
00071 virtual dim::size2di getWindowSize() const;
00072 virtual dim::size2di getWindowBorder() const;
00073
00074 virtual bool isWindowActive() const;
00075
00076 virtual void* getWindowObject();
00077
00078 protected:
00079
00080 #ifdef SP_COMPILE_WITH_OPENGL
00081 friend class OpenGLSharedRenderContext;
00082 #endif
00083
00084 #if defined(SP_PLATFORM_WINDOWS)
00085
00086 friend class sp::SoftPixelDeviceWin32;
00087 static const c8* WINDOW_CLASSNAME;
00088
00089 #elif defined(SP_PLATFORM_LINUX)
00090
00091 friend class sp::SoftPixelDeviceLinux;
00092
00093 #endif
00094
00095
00096
00097 #if defined(SP_PLATFORM_WINDOWS)
00098
00099 void registerWindowClass();
00100 void unregisterWindowClass();
00101
00102 DWORD getWindowStyle() const;
00103 void getWindowDimension(dim::point2di &Position, dim::size2di &Size) const;
00104
00105 void updateWindowStyleAndDimension();
00106 void updateScreenOffset(bool isFullscreen);
00107
00108 bool createWindow(const io::stringc &Title);
00109 void deleteWindow();
00110 void showWindow();
00111
00112 #elif defined(SP_PLATFORM_LINUX)
00113
00114 bool openDisplay();
00115 bool chooseVisual();
00116 bool createWindow(const io::stringc &Title);
00117
00118 #endif
00119
00120
00121
00122 #if defined(SP_PLATFORM_WINDOWS)
00123
00124 HWND Window_;
00125 HDC DeviceContext_;
00126
00127 #elif defined(SP_PLATFORM_LINUX)
00128
00129 Display* Display_;
00130 Window Window_, DefaultWindow_;
00131 Colormap ColorMap_;
00132 s32 Screen_;
00133
00134 XVisualInfo* Visual_;
00135 XSetWindowAttributes WinAttribs_;
00136 XF86VidModeModeInfo DesktopVideoMode_;
00137
00138 #endif
00139
00140 };
00141
00142
00143 }
00144
00145 }
00146
00147
00148 #endif
00149
00150 #endif
00151
00152
00153
00154