OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
displaymanager.h
1 /*
2  Copyright (C) 2014 - 2016 Mutzii
3 
4  This program is free software: you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation, either version 3 of the License, or
7  (at your option) any later version.
8 
9  This program is distributed in the hope that it will be useful,
10  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  GNU General Public License for more details.
13 
14  You should have received a copy of the GNU General Public License
15  along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 */
18 #ifndef DISPLAYMANAGER_H
19 #define DISPLAYMANAGER_H
20 
21 #include "index.h"
22 #include "display.h"
23 #include "input.h"
24 #include "Config/displayconfig.h"
25 #include "rendermanager.h"
26 
27 namespace Engine
28 {
29  /* Display List */
30  using DisplayList = std::list< GLFWDisplay * >;
31 
36  {
37  private:
38 
39  static DisplayManager * ptrInstance;
40 
42  DisplayManager( const DisplayManager & ){}
43  void operator=( const DisplayManager & ){}
44 
45  public: /* GLFw - Callbacks */
46 
47  static void ResizeCallback( GLFWwindow * window , int width , int height );
48  static void KeyboardCallback( GLFWwindow * window , int key , int scancode , int action , int mods );
49  static void MouseClickCallback( GLFWwindow * window , int button , int action , int mods );
50  static void CursorCallback( GLFWwindow * window , double x , double y );
51  static void WheelCallback( GLFWwindow * window , double x , double y );
52 
53  public:
54 
60  static DisplayManager * getSingletonPtr(void);
61 
67  void initialize( DisplayConfig * config );
68  void finish(void);
69 
70  GLFWDisplay * getDisplay( const std::string & display_name );
71 
79  GLFWDisplay * createDisplay( DisplayConfig * config ) throw( std::runtime_error ) ;
80 
89  GLFWDisplay * createDisplay( int width , int height , const char * window_title , GLFWwindow * share = NULL ) throw( std::runtime_error ) ;
90 
96  //GLFWDisplay * createHideDisplay( GLFWwindow * share = NULL ) throw( std::runtime_error );
97 
106  void makeContext( GLFWDisplay * display ) throw( std::runtime_error ) ;
107 
113  void BindCallbacksTo( GLFWDisplay * display ) throw( std::runtime_error );
114 
120  DisplayList getDisplayList(void);
121 
127  void registerDisplay ( GLFWDisplay * display );
128 
135  void unregister( GLFWDisplay * display );
136 
142  void destroy( GLFWDisplay * display );
143 
144  private:
145 
146  void glfw_init_check( void ) throw( std::runtime_error );
147 
148  bool glfw_init;
149  DisplayList m_display_list;
150  };
151 
152 
153 }
154 #endif // DISPLAYMANAGER_H
static DisplayManager * getSingletonPtr(void)
getSingletonPtr
Definition: DisplayManager.cpp:28
The DisplayManager controlled the GLFW Display.
Definition: displaymanager.h:35
Definition: element.h:23
void destroy(GLFWDisplay *display)
destroy
Definition: DisplayManager.cpp:205
void initialize(DisplayConfig *config)
initialize
Definition: DisplayManager.cpp:38
DisplayList getDisplayList(void)
getDisplayList
Definition: DisplayManager.cpp:190
GLFWDisplay * createDisplay(DisplayConfig *config)
createMainDisplay
Definition: DisplayManager.cpp:69
void unregister(GLFWDisplay *display)
unregister
Definition: DisplayManager.cpp:200
The GLFWDisplay - display class.
Definition: display.h:104
void makeContext(GLFWDisplay *display)
createHideDisplay
Definition: DisplayManager.cpp:157
void registerDisplay(GLFWDisplay *display)
registerDisplay
Definition: DisplayManager.cpp:195
The DisplayConfig - config class.
Definition: displayconfig.h:29
void BindCallbacksTo(GLFWDisplay *display)
BindCallbacksTo.
Definition: DisplayManager.cpp:168