Fireworks Engine  v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
fireworks.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "src/audio/audioclip.h"
4 
6 
9 #include "src/graphics/mesh.h"
10 #include "src/graphics/model.h"
11 #include "src/graphics/scene3d.h"
12 #include "src/graphics/shader.h"
13 #include "src/graphics/texture.h"
14 #include "src/graphics/window.h"
15 
20 
23 
28 
34 
36 
38 
39 #include "src/utils/fileutils.h"
40 #include "src/utils/timer.h"
41 #include "src/utils/wavloader.h"
42 
43 #include <glm/glm.hpp>
44 #include <glm/gtc/matrix_transform.hpp>
45 #include <glm/gtx/string_cast.hpp>
46 
47 namespace fireworks {
48 
49  using namespace audio;
50  using namespace components;
51  using namespace graphics;
52  using namespace physics;
53  using namespace utils;
54  // External namespaces
55  using namespace glm;
56 
60  class Fireworks
61  {
62  private:
64  graphics::Window* m_Window;
66  Timer* m_Timer;
68  unsigned int m_FramesPerSecond;
70  unsigned int m_UpdatePerSecond;
71  protected:
72  Fireworks() : m_FramesPerSecond(0), m_UpdatePerSecond(0) { }
73 
74  virtual ~Fireworks()
75  {
76  delete m_Window;
77  delete m_Timer;
78  }
87  graphics::Window* createWindow(const char* name, int width, int height)
88  {
89  m_Window = new graphics::Window(name, width, height);
90  return m_Window;
91  }
92  public:
96  void start()
97  {
98  init();
99  run();
100  }
101  protected:
103  virtual void init() = 0;
105  virtual void tick() { };
107  virtual void update() { };
109  virtual void render() = 0;
110 
114  inline const unsigned int getFPS() { return m_FramesPerSecond; }
115 
120  inline const unsigned int getUPS() { return m_UpdatePerSecond; }
121  private:
122  void run();
123  };
124 }
The Game class to use the Fireworks Engine.
Definition: fireworks.h:60
virtual void update()
Runs 60 times per second.
Definition: fireworks.h:107
Fireworks()
Definition: fireworks.h:72
Timer class to keep track of the time.
Definition: timer.h:8
const unsigned int getUPS()
A function to get the current UPS : Updates per second .
Definition: fireworks.h:120
Definition: audioclip.cpp:3
const unsigned int getFPS()
A function to get the current FPS : Frames per second .
Definition: fireworks.h:114
void start()
A function that starts the main game loop.
Definition: fireworks.h:96
The class responsible for Window Creation.
Definition: Window.h:168
virtual ~Fireworks()
Definition: fireworks.h:74
virtual void tick()
Runs once per second.
Definition: fireworks.h:105
graphics::Window * createWindow(const char *name, int width, int height)
A function to create the Main Window.
Definition: fireworks.h:87