OpenMW
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
sdlgraphicswindow.hpp
Go to the documentation of this file.
1 #ifndef OPENMW_COMPONENTS_SDLUTIL_SDLGRAPHICSWINDOW_H
2 #define OPENMW_COMPONENTS_SDLUTIL_SDLGRAPHICSWINDOW_H
3 
4 #include <SDL_video.h>
5 
6 #include <osgViewer/GraphicsWindow>
7 
8 namespace SDLUtil
9 {
10 
11 class GraphicsWindowSDL2 : public osgViewer::GraphicsWindow
12 {
13  SDL_Window* mWindow;
14  SDL_GLContext mContext;
15 
16  bool mValid;
17  bool mRealized;
19 
20  void init();
21 
22  virtual ~GraphicsWindowSDL2();
23 
24 public:
25  GraphicsWindowSDL2(osg::GraphicsContext::Traits *traits);
26 
27  virtual bool isSameKindAs(const Object* object) const { return dynamic_cast<const GraphicsWindowSDL2*>(object)!=0; }
28  virtual const char* libraryName() const { return "osgViewer"; }
29  virtual const char* className() const { return "GraphicsWindowSDL2"; }
30 
31  virtual bool valid() const { return mValid; }
32 
34  virtual bool realizeImplementation();
35 
37  virtual bool isRealizedImplementation() const { return mRealized; }
38 
40  virtual void closeImplementation();
41 
43  virtual bool makeCurrentImplementation();
44 
46  virtual bool releaseContextImplementation();
47 
49  virtual void swapBuffersImplementation();
50 
52  virtual void setSyncToVBlank(bool on);
53 
55  virtual bool setWindowDecorationImplementation(bool flag);
56 
58  virtual void raiseWindow();
59 
61  virtual bool setWindowRectangleImplementation(int x, int y, int width, int height);
62 
64  virtual void setWindowName(const std::string &name);
65 
67  virtual void setCursor(MouseCursor cursor);
68 
70  virtual void grabFocus() {}
71 
73  virtual void grabFocusIfPointerInWindow() {}
74 
76  struct WindowData : public osg::Referenced
77  {
78  WindowData(SDL_Window *window) : mWindow(window)
79  { }
80 
81  SDL_Window *mWindow;
82  };
83 };
84 
85 }
86 
87 #endif /* OSGGRAPHICSWINDOW_H */
virtual ~GraphicsWindowSDL2()
Definition: sdlgraphicswindow.cpp:8
virtual void grabFocusIfPointerInWindow()
Definition: sdlgraphicswindow.hpp:73
bool mValid
Definition: sdlgraphicswindow.hpp:16
virtual void setWindowName(const std::string &name)
Definition: sdlgraphicswindow.cpp:58
virtual const char * className() const
Definition: sdlgraphicswindow.hpp:29
bool mRealized
Definition: sdlgraphicswindow.hpp:17
bool mOwnsWindow
Definition: sdlgraphicswindow.hpp:18
virtual const char * libraryName() const
Definition: sdlgraphicswindow.hpp:28
void init()
Definition: sdlgraphicswindow.cpp:72
virtual bool setWindowRectangleImplementation(int x, int y, int width, int height)
Definition: sdlgraphicswindow.cpp:49
virtual void raiseWindow()
Definition: sdlgraphicswindow.cpp:193
GraphicsWindowSDL2(osg::GraphicsContext::Traits *traits)
Definition: sdlgraphicswindow.cpp:13
virtual bool valid() const
Definition: sdlgraphicswindow.hpp:31
virtual bool isSameKindAs(const Object *object) const
Definition: sdlgraphicswindow.hpp:27
Definition: sdlgraphicswindow.hpp:11
virtual void grabFocus()
Definition: sdlgraphicswindow.hpp:70
virtual void closeImplementation()
Definition: sdlgraphicswindow.cpp:160
virtual void swapBuffersImplementation()
Definition: sdlgraphicswindow.cpp:174
virtual bool setWindowDecorationImplementation(bool flag)
Definition: sdlgraphicswindow.cpp:41
virtual bool makeCurrentImplementation()
Definition: sdlgraphicswindow.cpp:137
virtual bool realizeImplementation()
Definition: sdlgraphicswindow.cpp:117
SDL_Window * mWindow
Definition: sdlgraphicswindow.hpp:13
Definition: sdlgraphicswindow.hpp:76
SDL_Window * mWindow
Definition: sdlgraphicswindow.hpp:81
virtual bool isRealizedImplementation() const
Definition: sdlgraphicswindow.hpp:37
SDL_GLContext mContext
Definition: sdlgraphicswindow.hpp:14
virtual bool releaseContextImplementation()
Definition: sdlgraphicswindow.cpp:148
WindowData(SDL_Window *window)
Definition: sdlgraphicswindow.hpp:78
virtual void setCursor(MouseCursor cursor)
Definition: sdlgraphicswindow.cpp:66
virtual void setSyncToVBlank(bool on)
Definition: sdlgraphicswindow.cpp:181
const char * name
Definition: crashcatcher.cpp:59