r-type  0.0.0
R-Type main
Loading...
Searching...
No Matches
IGameClient.hpp
Go to the documentation of this file.
1///
2/// @file IGameClient.hpp
3/// @brief This file contains the Game interface
4/// @namespace gme
5///
6
7#pragma once
8
9#include <string>
10#include <vector>
11
12namespace gme
13{
14
15 struct Sprite
16 { // TODO(bobis33): should have path to texture, and all necessary data
17 std::string type;
18 float pos_x = 0.F, pos_y = 0.F;
19 float v_x = 0.F, v_y = 0.F;
20 float scale_x = 1.F, scale_y = 1.F;
21 unsigned char r = 255u, g = 255u, b = 255u, a = 255u;
22 std::string texture_path = "";
23 float text_rect_x = 0.F, text_rect_y = 0.F;
25 std::string id;
26 };
27
28 ///
29 /// @class IScene
30 /// @brief Interface for scenes
31 /// @namespace gme
32 ///
33 class IScene
34 {
35 public:
36 virtual ~IScene() = default;
37
38 [[nodiscard]] virtual const std::string &getName() const = 0;
39 [[nodiscard]] virtual const std::vector<Sprite> &getEntities() const = 0;
40 [[nodiscard]] virtual std::vector<Sprite> &getEntitiesMutable() = 0;
41 }; // class IScene
42
43 ///
44 /// @class IGameClient
45 /// @brief Interface for the games
46 /// @namespace gme
47 ///
49 {
50 public:
51 virtual ~IGameClient() = default;
52
53 [[nodiscard]] virtual std::string &getName() = 0;
54 virtual void setName(const std::string &newName) = 0;
55
56 virtual void update(float deltaTime, unsigned int width, unsigned int height) = 0;
57 [[nodiscard]] virtual const IScene &getCurrentScene() const = 0;
58
59 private:
60 }; // class IGameClient
61
62} // namespace gme
Interface for the games.
virtual const IScene & getCurrentScene() const =0
virtual void update(float deltaTime, unsigned int width, unsigned int height)=0
virtual std::string & getName()=0
virtual void setName(const std::string &newName)=0
virtual ~IGameClient()=default
Interface for scenes.
virtual const std::vector< Sprite > & getEntities() const =0
virtual ~IScene()=default
virtual const std::string & getName() const =0
virtual std::vector< Sprite > & getEntitiesMutable()=0
float text_rect_x
unsigned char b
unsigned char g
unsigned char a
std::string texture_path
std::string id
float text_rect_y
std::string type
unsigned char r