raylibstarter 0.1.0
store.h
Go to the documentation of this file.
1#pragma once
2
3#include <map>
4
5#include <raylib.h>
6
7#include "stage.h"
8#include "actor.h"
9
10namespace game::core {
11 /**
12 * @brief A central place to share globally accessible objects that should be accessible from anywhere.
13 */
14 struct Store final {
15 /// The Stage object is responsible for the scene change and for updating and drawing the scene contents
16 inline static std::unique_ptr<game::core::Stage> stage = nullptr;
17
18 /// To get the mouse position the mouse support must be enabled when initializing the Game object.
19 /// @brief The virtual mouse position.
20 inline static Vector2 mouse_position = { };
21
22 /// Global game counter. Can be used e.g. for the calculation of animation times.
23 inline static long long int ticks = 1;
24
25 /// The actors map can contain shared pointers to actor objects that are to be used across multiple scenes (e.g. the player actor).
26 inline static std::map<std::string, std::shared_ptr<game::core::Actor>> actors = { };
27 };
28}
A central place to share globally accessible objects that should be accessible from anywhere.
Definition: store.h:14
static long long int ticks
Global game counter. Can be used e.g. for the calculation of animation times.
Definition: store.h:23
static std::unique_ptr< game::core::Stage > stage
The Stage object is responsible for the scene change and for updating and drawing the scene contents.
Definition: store.h:16
static Vector2 mouse_position
The virtual mouse position.
Definition: store.h:20
static std::map< std::string, std::shared_ptr< game::core::Actor > > actors
The actors map can contain shared pointers to actor objects that are to be used across multiple scene...
Definition: store.h:26