OpenPolygon  1.0.0
OpenPolygon is a Rendering Engine
display.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 DISPLAY_H
19 #define DISPLAY_H
20 
21 #include "index.h"
22 #include "camera.h"
23 
24 namespace Engine
25 {
26 
30  struct GLFWData
31  {
32  GLFWwindow * window;
33 
34  bool mouse_visible;
35  };
36 
40  struct DisplayData
41  {
42  int width;
43  int height;
44  int viewport_x;
45  int viewport_y;
46 
47  const char * title;
48  std::string name;
49  glm::mat4 perspective;
50  };
51 
56  {
57  public:
58 
59  explicit OpenPolygonDisplay( const std::string & display_name );
60 
61  virtual ~OpenPolygonDisplay()=default;
62 
63  virtual void Close(void)=0; //Destroy Window
64 
65  virtual bool isClosed(void)=0;
66 
67  virtual void Update(void)=0; //Copy back-buffer into front-buffer
68 
69  virtual void setTitle( const char * title )=0;
70 
71  void setCamera( Camera * camera );
72 
73  void setViewPort( int x , int y , int width , int height );
74 
75  void setPerspective( glm::mat4 matrix );
76 
77  void setPerspective( float fovy , float aspect , float near , float far );
78 
79  Camera * getCamera(void);
80 
81  int getRenderHeight(void);
82 
83  int getRenderWidth(void);
84 
85  int getViewPortX(void);
86 
87  int getViewPortY(void);
88 
89  const std::string & getName(void);
90 
91  const char * getTitle(void);
92 
93  glm::mat4 getPerspective(void);
94 
95  protected:
96 
97  Camera * m_camera;
98  DisplayData m_display_data;
99  };
100 
105  {
106  public:
107  explicit GLFWDisplay( const std::string & display_name );
108  ~GLFWDisplay() = default;
109 
110  void Close(void) final override;
111 
112  bool isClosed(void) final override;
113 
114  void Update(void) final override;
115 
116  void setTitle(const char *title) final override;
117 
118  void setWindow( GLFWwindow * window );
119 
120  void setWindowSize( int width , int height );
121 
122  void catchMouse( bool visible );
123 
124  GLFWwindow * getWindow(void);
125 
126  private:
127 
128  GLFWData m_glfw_data;
129  };
130 }
131 
132 #endif // DISPLAY_H
Definition: element.h:23
The DisplayData struct.
Definition: display.h:40
The Camera class.
Definition: camera.h:31
The GLFWDisplay - display class.
Definition: display.h:104
The OpenPolygonDisplay - display abstract class.
Definition: display.h:55
The GLFWData struct.
Definition: display.h:30