hx3d  1
2D/3D Simple Game Framework
application.hpp
1 /*
2  Application management interface.
3  Copyright (C) 2015 Denis BOURGE
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
18  USA
19 */
20 
21 #ifndef HX3D_WINDOW_APPLICATION
22 #define HX3D_WINDOW_APPLICATION
23 
24 #include "hx3d/window/application_config.hpp"
25 #include "hx3d/utils/ptr.hpp"
26 
27 #include <string>
28 #include <glm/vec2.hpp>
29 
30 namespace hx3d {
31 
35 namespace window {
36 
37 class Game;
38 
42 class Application {
43 
44 public:
51  virtual ~Application();
52 
58  virtual void start(const Ptr<Game>& game) = 0;
59 
65  int getWidth();
66 
72  int getHeight();
73 
79  glm::ivec2 getSize();
80 
86  float getFPS();
87 
94  float getElapsedTime();
95 
96 protected:
97 
101  bool _running;
102 
104  int _width;
106  int _height;
108  unsigned int _fpsLimit;
110  std::string _title;
113 
115  float _currentFPS;
118 };
119 
120 } /* window */
121 } /* hx3d */
122 
123 #endif /* HX3D_WINDOW_APPLICATION */
unsigned int _fpsLimit
FPS limit.
Application configuration.
Application management.
Definition: application.hpp:42
hx3d framework namespace
Definition: audio.hpp:26
bool _fullscreen
Is the application in fullscreen ?
Application(ApplicationConfig config)
Create a window.
Definition: application.cpp:26
int _width
Application width.
virtual void start(const Ptr< Game > &game)=0
Start the window.
bool _running
Is the application running ?
glm::ivec2 getSize()
Get the window size (ivec2)
Definition: application.cpp:43
Ptr< Game > _game
Game pointer.
Definition: application.hpp:99
int _height
Application height.
float _elapsedTime
Elapsed time since the beginning.
float getElapsedTime()
Get the elapsed time in seconds since the application start. Reset after one hour.
Definition: application.cpp:51
std::string _title
Application title.
float getFPS()
Get the current frames per second (FPS)
Definition: application.cpp:47
float _currentFPS
Current FPS.
int getHeight()
Get the window height.
Definition: application.cpp:39
std::shared_ptr< T > Ptr
Quick-typing shared ptr.
Definition: ptr.hpp:34
int getWidth()
Get the window width.
Definition: application.cpp:35