Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Game.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "NonCopyable.hpp"
4 #include <string>
5 #include <entt/entity/registry.hpp>
6 //#include "World.h"
7 
8 namespace Fling
9 {
16  class Game : public NonCopyable
17  {
18  // Friend class to the engine so that we can ensure the proper world is setup
19  friend class Engine;
20 
21  public:
22 
26  virtual void Init(entt::registry& t_Reg) = 0;
27 
28  /* Called when the engine is shutting down */
29  virtual void Shutdown(entt::registry& t_Reg) = 0;
30 
34  virtual void Update(entt::registry& t_Reg, float DeltaTime) = 0;
35 
42  FORCEINLINE class World* GetWorld() const { assert(m_OwningWorld); return m_OwningWorld; }
43 
49  FORCEINLINE bool WantsToQuit() const { return m_WantsToQuit; }
50 
51  protected:
52 
53  // You really should not be implementing the game's ctor
54  Game() = default;
55  virtual ~Game() = default;
56 
58  class World* m_OwningWorld = nullptr;
59 
61  bool m_WantsToQuit = false;
62  };
63 } // namespace Fling
bool m_WantsToQuit
Change this value to true when the game is ready to exit the application entirely.
Definition: Game.h:61
FORCEINLINE class World * GetWorld() const
Gets the owning world of this game.
Definition: Game.h:42
Core engine class of Fling.
Definition: Engine.h:35
The game class is mean to be overridden on a per-game instance.
Definition: Game.h:16
FORCEINLINE bool WantsToQuit() const
If true then this game wants to texit the application entirely.
Definition: Game.h:49
virtual ~Game()=default
The world holds all active levels in the game.
Definition: World.h:21
virtual void Init(entt::registry &t_Reg)=0
Called before the first Update tick.
Definition: SandboxGame.cpp:25
Game()=default
class World * m_OwningWorld
The world that updates this game.
Definition: Game.h:58
virtual void Shutdown(entt::registry &t_Reg)=0
Definition: SandboxGame.cpp:69
Class that removes the copy operator and constructor.
Definition: NonCopyable.hpp:10
Definition: Engine.h:29
virtual void Update(entt::registry &t_Reg, float DeltaTime)=0
Update is called every frame.
Definition: SandboxGame.cpp:80