ST_engine  0.3-ALPHA
game_manager_mock.hpp
1 /* This file is part of the "ST" project.
2  * You may use, distribute or modify this code under the terms
3  * of the GNU General Public License version 2.
4  * See LICENCE.txt in the root directory of the project.
5  *
6  * Author: Maxim Atanasov
7  * E-mail: maxim.atanasov@protonmail.com
8  */
9 
10 #ifndef ST_GAME_MANAGER_MOCK_HPP
11 #define ST_GAME_MANAGER_MOCK_HPP
12 
13 #include <vector>
14 #include <SDL_atomic.h>
15 #include <task_manager.hpp>
16 #include "../../../../ST_message_bus/include/message_bus.hpp"
17 #include <game_manager/level/level.hpp>
18 
31 class game_manager {
32 private:
33 
34  //methods
35  void handle_messages();
36 
37  int8_t load_level(const std::string &) { return 0; }
38 
39  void unload_level(const std::string &) {}
40 
41  void start_level(const std::string &) {}
42 
43  void reset_keys() {}
44 
45  void run_level_loop() {}
46 
47  ST::level *level = new ST::level("test_level", nullptr);
48 
49 public:
50 
51  bool fullscreen_status = false;
52  bool vsync_flag = true;
53  uint8_t music_volume_level = 100;
54  uint8_t sounds_volume_level = 100;
55  bool audio_enabled = true;
56  int8_t gravity = 0;
57 
58  game_manager(message_bus *msg_bus, task_manager *tsk_mngr) {}
59 
60  ~game_manager() = default;
61 
62  std::string get_active_level() const { return "test_level"; }
63 
64  ST::level *get_level() {
65  get_level_calls++;
66  return level;
67  }
68 
69  bool key_pressed(size_t arg) const { return true; };
70 
71  bool key_held(size_t arg) const { return true; };
72 
73  bool key_released(size_t arg) const { return true; };
74 
75  int32_t get_mouse_x() const { return 100; };
76 
77  int32_t get_mouse_y() const { return 200; };
78 
79  void update() {};
80 
81  bool game_is_running() const { return true; };
82 
83  void center_camera_on_entity(uint64_t id) { center_camera_on_entity_calls++; }
84 
85  int16_t get_left_trigger() const { return 100; }
86 
87  int16_t get_right_trigger() const { return 200; }
88 
89  int16_t get_left_stick_horizontal() const { return 100; }
90 
91  int16_t get_left_stick_vertical() const { return 200; }
92 
93  int16_t get_right_stick_vertical() const { return 300; }
94 
95  int16_t get_right_stick_horizontal() const { return 400; }
96 
97  void save_state(const std::string &filepath) {};
98 
99  uint16_t get_internal_width() const { return 1920; }
100 
101  uint16_t get_internal_height() const { return 1080; };
102 
103  uint16_t get_window_width() const { return 2560; };
104 
105  uint16_t get_window_height() const { return 1440; };
106 
107  //Variables to keep track of method calls
108  uint8_t get_level_calls = 0;
109  uint8_t center_camera_on_entity_calls = 0;
110 };
111 
112 
113 #endif //ST_GAME_MANAGER_MOCK_HPP
This object contains all the data for a level and provides functions for loading and unloading a leve...
Definition: level.hpp:29
This class is responsible for managing all levels and the lua backend, it is the heart of the engine.
bool key_released(uint16_t arg) const
uint16_t get_internal_width() const
void center_camera_on_entity(uint64_t id)
uint16_t get_window_height() const
int16_t get_left_stick_vertical() const
bool key_held(uint16_t arg) const
int16_t get_left_trigger() const
int32_t get_mouse_x() const
int16_t get_right_stick_vertical() const
int16_t get_left_stick_horizontal() const
ST::level * get_level() const
uint16_t get_window_width() const
bool game_is_running() const
uint16_t get_internal_height() const
int32_t get_mouse_y() const
bool key_pressed(uint16_t arg) const
int16_t get_right_trigger() const
game_manager(message_bus &msg_bus)
int16_t get_right_stick_horizontal() const
std::string get_active_level() const
The central messaging system of the engine. All subsystem make extensive use of it.
Definition: message_bus.hpp:29
The Task Manager handles all things multi-threaded in the engine.