diff options
Diffstat (limited to 'src/components')
| -rw-r--r-- | src/components/animatable.h | 146 | ||||
| -rw-r--r-- | src/components/mappable.h | 208 | ||||
| -rw-r--r-- | src/components/playable.h | 28 | ||||
| -rw-r--r-- | src/components/ponderable.h | 151 | ||||
| -rw-r--r-- | src/components/realizable.h | 67 | ||||
| -rw-r--r-- | src/components/transformable.h | 79 |
6 files changed, 350 insertions, 329 deletions
| diff --git a/src/components/animatable.h b/src/components/animatable.h index ec72be0..1a678ba 100644 --- a/src/components/animatable.h +++ b/src/components/animatable.h | |||
| @@ -8,88 +8,86 @@ | |||
| 8 | class AnimatableComponent : public Component { | 8 | class AnimatableComponent : public Component { |
| 9 | public: | 9 | public: |
| 10 | 10 | ||
| 11 | /** | ||
| 12 | * Constructor for initializing the animation set, because it is not default | ||
| 13 | * constructible. | ||
| 14 | */ | ||
| 11 | AnimatableComponent( | 15 | AnimatableComponent( |
| 12 | AnimationSet animationSet, | 16 | AnimationSet animationSet) : |
| 13 | std::string animation) : | 17 | animationSet(std::move(animationSet)) |
| 14 | animationSet_(std::move(animationSet)), | ||
| 15 | animation_(std::move(animation)) | ||
| 16 | { | 18 | { |
| 17 | } | 19 | } |
| 18 | 20 | ||
| 19 | inline size_t getFrame() const | 21 | /** |
| 20 | { | 22 | * The animation set that this entity will use -- an object describing the |
| 21 | return frame_; | 23 | * different animations that can be used to render the entity. |
| 22 | } | 24 | * |
| 23 | 25 | * @managed_by RealizingSystem | |
| 24 | inline void setFrame(size_t v) | 26 | */ |
| 25 | { | 27 | AnimationSet animationSet; |
| 26 | frame_ = v; | 28 | |
| 27 | } | 29 | /** |
| 28 | 30 | * The name of the currently active animation. | |
| 29 | inline size_t getCountdown() const | 31 | * |
| 30 | { | 32 | * @managed_by AnimatingSystem |
| 31 | return countdown_; | 33 | */ |
| 32 | } | 34 | std::string animation; |
| 33 | 35 | ||
| 34 | inline void setCountdown(size_t v) | 36 | /** |
| 35 | { | 37 | * For prototypes, the name of the original animation. |
| 36 | countdown_ = v; | 38 | * |
| 37 | } | 39 | * @managed_by RealizingSystem |
| 38 | 40 | */ | |
| 39 | inline const AnimationSet& getAnimationSet() const | 41 | std::string origAnimation; |
| 40 | { | 42 | |
| 41 | return animationSet_; | 43 | /** |
| 42 | } | 44 | * Helper method for accessing the currently active animation. |
| 43 | 45 | */ | |
| 44 | inline const Animation& getAnimation() const | 46 | inline const Animation& getAnimation() const |
| 45 | { | 47 | { |
| 46 | return animationSet_.getAnimation(animation_); | 48 | return animationSet.getAnimation(animation); |
| 47 | } | 49 | } |
| 48 | 50 | ||
| 49 | inline void setAnimation(std::string animation) | 51 | /** |
| 50 | { | 52 | * The frame of animation that is currently being rendered. |
| 51 | animation_ = std::move(animation); | 53 | * |
| 52 | } | 54 | * @managed_by AnimatingSystem |
| 53 | 55 | */ | |
| 54 | inline bool isFlickering() const | 56 | size_t frame = 0; |
| 55 | { | 57 | |
| 56 | return flickering_; | 58 | /** |
| 57 | } | 59 | * The amount of time (in game frames) before the animation is advanced. |
| 58 | 60 | * | |
| 59 | inline void setFlickering(bool v) | 61 | * @managed_by AnimatingSystem |
| 60 | { | 62 | */ |
| 61 | flickering_ = v; | 63 | size_t countdown = 0; |
| 62 | } | 64 | |
| 63 | 65 | /** | |
| 64 | inline size_t getFlickerTimer() const | 66 | * This option allows to give the sprite a "flickering" effect (as in, it is |
| 65 | { | 67 | * not rendered in some frames). |
| 66 | return flickerTimer_; | 68 | */ |
| 67 | } | 69 | bool flickering = false; |
| 68 | 70 | ||
| 69 | inline void setFlickerTimer(size_t v) | 71 | /** |
| 70 | { | 72 | * Used for the flickering effect. |
| 71 | flickerTimer_ = v; | 73 | * |
| 72 | } | 74 | * @managed_by AnimatingSystem |
| 73 | 75 | */ | |
| 74 | inline bool isFrozen() const | 76 | size_t flickerTimer = 0; |
| 75 | { | 77 | |
| 76 | return frozen_; | 78 | /** |
| 77 | } | 79 | * If enabled, this will prevent the sprite's animation from progressing (but |
| 78 | 80 | * will not affect things such as placement on screen and flickering). | |
| 79 | inline void setFrozen(bool v) | 81 | */ |
| 80 | { | 82 | bool frozen = false; |
| 81 | frozen_ = v; | 83 | |
| 82 | } | 84 | /** |
| 83 | 85 | * If this flag is disabled, the entity will be ignored by the animating | |
| 84 | private: | 86 | * system. |
| 85 | 87 | * | |
| 86 | AnimationSet animationSet_; | 88 | * @managed_by RealizingSystem |
| 87 | std::string animation_; | 89 | */ |
| 88 | size_t frame_ = 0; | 90 | bool active = false; |
| 89 | size_t countdown_ = 0; | ||
| 90 | bool flickering_ = false; | ||
| 91 | size_t flickerTimer_ = 0; | ||
| 92 | bool frozen_ = false; | ||
| 93 | }; | 91 | }; |
| 94 | 92 | ||
| 95 | #endif /* end of include guard: SPRITE_RENDERABLE_H_D3AACBBF */ | 93 | #endif /* end of include guard: SPRITE_RENDERABLE_H_D3AACBBF */ |
| diff --git a/src/components/mappable.h b/src/components/mappable.h index 633cdf4..6f3d38e 100644 --- a/src/components/mappable.h +++ b/src/components/mappable.h | |||
| @@ -2,14 +2,47 @@ | |||
| 2 | #define MAPPABLE_H_0B0316FB | 2 | #define MAPPABLE_H_0B0316FB |
| 3 | 3 | ||
| 4 | #include <map> | 4 | #include <map> |
| 5 | #include <string> | ||
| 6 | #include <vector> | ||
| 7 | #include <list> | ||
| 5 | #include "component.h" | 8 | #include "component.h" |
| 6 | #include "renderer/texture.h" | 9 | #include "renderer/texture.h" |
| 7 | #include "collision.h" | 10 | #include "collision.h" |
| 8 | #include "map.h" | 11 | #include "entity_manager.h" |
| 9 | 12 | ||
| 10 | class MappableComponent : public Component { | 13 | class MappableComponent : public Component { |
| 11 | public: | 14 | public: |
| 12 | 15 | ||
| 16 | using id_type = EntityManager::id_type; | ||
| 17 | |||
| 18 | /** | ||
| 19 | * Helper type that stores information about map adjacency. | ||
| 20 | */ | ||
| 21 | class Adjacent { | ||
| 22 | public: | ||
| 23 | |||
| 24 | enum class Type { | ||
| 25 | wall, | ||
| 26 | wrap, | ||
| 27 | warp, | ||
| 28 | reverse | ||
| 29 | }; | ||
| 30 | |||
| 31 | Adjacent( | ||
| 32 | Type type = Type::wall, | ||
| 33 | size_t mapId = 0) : | ||
| 34 | type(type), | ||
| 35 | mapId(mapId) | ||
| 36 | { | ||
| 37 | } | ||
| 38 | |||
| 39 | Type type; | ||
| 40 | size_t mapId; | ||
| 41 | }; | ||
| 42 | |||
| 43 | /** | ||
| 44 | * Helper type that stores information about collision boundaries. | ||
| 45 | */ | ||
| 13 | class Boundary { | 46 | class Boundary { |
| 14 | public: | 47 | public: |
| 15 | 48 | ||
| @@ -20,121 +53,100 @@ public: | |||
| 20 | double lower, | 53 | double lower, |
| 21 | double upper, | 54 | double upper, |
| 22 | Type type) : | 55 | Type type) : |
| 23 | axis_(axis), | 56 | axis(axis), |
| 24 | lower_(lower), | 57 | lower(lower), |
| 25 | upper_(upper), | 58 | upper(upper), |
| 26 | type_(type) | 59 | type(type) |
| 27 | { | ||
| 28 | } | ||
| 29 | |||
| 30 | inline double getAxis() const | ||
| 31 | { | ||
| 32 | return axis_; | ||
| 33 | } | ||
| 34 | |||
| 35 | inline double getLower() const | ||
| 36 | { | ||
| 37 | return lower_; | ||
| 38 | } | ||
| 39 | |||
| 40 | inline double getUpper() const | ||
| 41 | { | ||
| 42 | return upper_; | ||
| 43 | } | ||
| 44 | |||
| 45 | inline Type getType() const | ||
| 46 | { | 60 | { |
| 47 | return type_; | ||
| 48 | } | 61 | } |
| 49 | 62 | ||
| 50 | private: | 63 | double axis; |
| 51 | 64 | double lower; | |
| 52 | double axis_; | 65 | double upper; |
| 53 | double lower_; | 66 | Type type; |
| 54 | double upper_; | ||
| 55 | Type type_; | ||
| 56 | }; | 67 | }; |
| 57 | 68 | ||
| 58 | MappableComponent( | 69 | /** |
| 59 | Texture tileset, | 70 | * Helper types for efficient storage and lookup of collision boundaries. |
| 60 | Texture font) : | 71 | */ |
| 61 | tileset_(std::move(tileset)), | ||
| 62 | font_(std::move(font)) | ||
| 63 | { | ||
| 64 | } | ||
| 65 | |||
| 66 | using asc_boundaries_type = | 72 | using asc_boundaries_type = |
| 67 | std::multimap< | 73 | std::multimap< |
| 68 | double, | 74 | double, |
| 69 | Boundary, | 75 | const Boundary, |
| 70 | std::less<double>>; | 76 | std::less<double>>; |
| 71 | 77 | ||
| 72 | using desc_boundaries_type = | 78 | using desc_boundaries_type = |
| 73 | std::multimap< | 79 | std::multimap< |
| 74 | double, | 80 | double, |
| 75 | Boundary, | 81 | const Boundary, |
| 76 | std::greater<double>>; | 82 | std::greater<double>>; |
| 77 | 83 | ||
| 78 | inline size_t getMapId() const | 84 | /** |
| 79 | { | 85 | * Constructor for initializing the tileset and font attributes, as they are |
| 80 | return mapId_; | 86 | * not default constructible. |
| 81 | } | 87 | */ |
| 82 | 88 | MappableComponent( | |
| 83 | inline void setMapId(size_t v) | 89 | Texture tileset, |
| 84 | { | 90 | Texture font) : |
| 85 | mapId_ = v; | 91 | tileset(std::move(tileset)), |
| 86 | } | 92 | font(std::move(font)) |
| 87 | |||
| 88 | inline desc_boundaries_type& getLeftBoundaries() | ||
| 89 | { | ||
| 90 | return leftBoundaries_; | ||
| 91 | } | ||
| 92 | |||
| 93 | inline asc_boundaries_type& getRightBoundaries() | ||
| 94 | { | ||
| 95 | return rightBoundaries_; | ||
| 96 | } | ||
| 97 | |||
| 98 | inline desc_boundaries_type& getUpBoundaries() | ||
| 99 | { | ||
| 100 | return upBoundaries_; | ||
| 101 | } | ||
| 102 | |||
| 103 | inline asc_boundaries_type& getDownBoundaries() | ||
| 104 | { | ||
| 105 | return downBoundaries_; | ||
| 106 | } | ||
| 107 | |||
| 108 | inline const Texture& getTileset() const | ||
| 109 | { | ||
| 110 | return tileset_; | ||
| 111 | } | ||
| 112 | |||
| 113 | inline void setTileset(Texture v) | ||
| 114 | { | ||
| 115 | tileset_ = std::move(v); | ||
| 116 | } | ||
| 117 | |||
| 118 | inline const Texture& getFont() const | ||
| 119 | { | ||
| 120 | return font_; | ||
| 121 | } | ||
| 122 | |||
| 123 | inline void setFont(Texture v) | ||
| 124 | { | 93 | { |
| 125 | font_ = std::move(v); | ||
| 126 | } | 94 | } |
| 127 | 95 | ||
| 128 | private: | 96 | /** |
| 129 | 97 | * The ID of the map in the world definition that this entity represents. | |
| 130 | size_t mapId_ = -1; | 98 | * |
| 131 | 99 | * @managed_by RealizingSystem | |
| 132 | desc_boundaries_type leftBoundaries_; | 100 | */ |
| 133 | asc_boundaries_type rightBoundaries_; | 101 | size_t mapId; |
| 134 | desc_boundaries_type upBoundaries_; | 102 | |
| 135 | asc_boundaries_type downBoundaries_; | 103 | /** |
| 136 | Texture tileset_; | 104 | * The title of the map, which is displayed at the bottom of the screen. |
| 137 | Texture font_; | 105 | */ |
| 106 | std::string title; | ||
| 107 | |||
| 108 | /** | ||
| 109 | * The map data. | ||
| 110 | * | ||
| 111 | * @managed_by RealizingSystem | ||
| 112 | */ | ||
| 113 | std::vector<int> tiles; | ||
| 114 | |||
| 115 | /** | ||
| 116 | * These objects describe the behavior of the four edges of the map. | ||
| 117 | * | ||
| 118 | * @managed_by RealizingSystem | ||
| 119 | */ | ||
| 120 | Adjacent leftAdjacent; | ||
| 121 | Adjacent rightAdjacent; | ||
| 122 | Adjacent upAdjacent; | ||
| 123 | Adjacent downAdjacent; | ||
| 124 | |||
| 125 | /** | ||
| 126 | * Collision boundaries, for detecting when a ponderable entity is colliding | ||
| 127 | * with the environment. | ||
| 128 | * | ||
| 129 | * @managed_by MappingSystem | ||
| 130 | */ | ||
| 131 | desc_boundaries_type leftBoundaries; | ||
| 132 | asc_boundaries_type rightBoundaries; | ||
| 133 | desc_boundaries_type upBoundaries; | ||
| 134 | asc_boundaries_type downBoundaries; | ||
| 135 | |||
| 136 | /** | ||
| 137 | * The list of entities representing the objects owned by the map. | ||
| 138 | * | ||
| 139 | * @managed_by RealizingSystem | ||
| 140 | */ | ||
| 141 | std::list<id_type> objects; | ||
| 142 | |||
| 143 | /** | ||
| 144 | * The tilesets for the map and the map name. | ||
| 145 | * | ||
| 146 | * TODO: These probably do not belong here. | ||
| 147 | */ | ||
| 148 | Texture tileset; | ||
| 149 | Texture font; | ||
| 138 | }; | 150 | }; |
| 139 | 151 | ||
| 140 | #endif /* end of include guard: MAPPABLE_H_0B0316FB */ | 152 | #endif /* end of include guard: MAPPABLE_H_0B0316FB */ |
| diff --git a/src/components/playable.h b/src/components/playable.h index 86a7ee7..94d4326 100644 --- a/src/components/playable.h +++ b/src/components/playable.h | |||
| @@ -2,22 +2,30 @@ | |||
| 2 | #define PLAYABLE_H_DDC566C3 | 2 | #define PLAYABLE_H_DDC566C3 |
| 3 | 3 | ||
| 4 | #include "component.h" | 4 | #include "component.h" |
| 5 | #include <functional> | 5 | #include "entity_manager.h" |
| 6 | 6 | ||
| 7 | class PlayableComponent : public Component { | 7 | class PlayableComponent : public Component { |
| 8 | public: | 8 | public: |
| 9 | 9 | ||
| 10 | using MapChangeCallback = std::function<void()>; | 10 | using id_type = EntityManager::id_type; |
| 11 | 11 | ||
| 12 | bool changingMap = false; | 12 | /** |
| 13 | int newMapId = -1; | 13 | * The entity ID of the map that the player is on. |
| 14 | double newMapX = 0; | 14 | * |
| 15 | double newMapY = 0; | 15 | * @managed_by PlayingSystem |
| 16 | MapChangeCallback newMapCallback; | 16 | */ |
| 17 | id_type mapId; | ||
| 17 | 18 | ||
| 18 | int checkpointMapId = -1; | 19 | /** |
| 19 | double checkpointX = 0; | 20 | * The map ID and coordinates of the location that the player will spawn after |
| 20 | double checkpointY = 0; | 21 | * dying. Note that the map ID here is a world description map ID, not an |
| 22 | * entity ID. | ||
| 23 | * | ||
| 24 | * @managed_by PlayingSystem | ||
| 25 | */ | ||
| 26 | size_t checkpointMapId; | ||
| 27 | double checkpointX; | ||
| 28 | double checkpointY; | ||
| 21 | 29 | ||
| 22 | }; | 30 | }; |
| 23 | 31 | ||
| diff --git a/src/components/ponderable.h b/src/components/ponderable.h index 78af25f..fd7e775 100644 --- a/src/components/ponderable.h +++ b/src/components/ponderable.h | |||
| @@ -6,100 +6,73 @@ | |||
| 6 | class PonderableComponent : public Component { | 6 | class PonderableComponent : public Component { |
| 7 | public: | 7 | public: |
| 8 | 8 | ||
| 9 | /** | ||
| 10 | * List of different types of physical bodies. | ||
| 11 | * | ||
| 12 | * vacuumed - Default. | ||
| 13 | * freefalling - The body will be treated as if there were a downward force | ||
| 14 | * of gravity being exerted onto it. The body will also exhibit | ||
| 15 | * terminal velocity (that is, its downward velocity will be | ||
| 16 | * capped at a constant value). | ||
| 17 | */ | ||
| 9 | enum class Type { | 18 | enum class Type { |
| 10 | vacuumed, | 19 | vacuumed, |
| 11 | freefalling | 20 | freefalling |
| 12 | }; | 21 | }; |
| 13 | 22 | ||
| 14 | PonderableComponent(Type type) : type_(type) | 23 | /** |
| 15 | { | 24 | * Constructor for initializing the body type, which is a constant. |
| 16 | } | 25 | */ |
| 17 | 26 | PonderableComponent(Type type) : type(type) | |
| 18 | inline Type getType() const | 27 | { |
| 19 | { | 28 | } |
| 20 | return type_; | 29 | |
| 21 | } | 30 | /** |
| 22 | 31 | * The velocity of the body. | |
| 23 | inline double getVelocityX() const | 32 | */ |
| 24 | { | 33 | double velX = 0.0; |
| 25 | return velX_; | 34 | double velY = 0.0; |
| 26 | } | 35 | |
| 27 | 36 | /** | |
| 28 | inline void setVelocityX(double v) | 37 | * The acceleration of the body. |
| 29 | { | 38 | */ |
| 30 | velX_ = v; | 39 | double accelX = 0.0; |
| 31 | } | 40 | double accelY = 0.0; |
| 32 | 41 | ||
| 33 | inline double getVelocityY() const | 42 | /** |
| 34 | { | 43 | * The type of physical body that the entity is meant to assume. The body will |
| 35 | return velY_; | 44 | * be acted upon differently based on this. See the enumeration above for more |
| 36 | } | 45 | * details. |
| 37 | 46 | * | |
| 38 | inline void setVelocityY(double v) | 47 | * @managed_by PonderingSystem |
| 39 | { | 48 | */ |
| 40 | velY_ = v; | 49 | const Type type; |
| 41 | } | 50 | |
| 42 | 51 | /** | |
| 43 | inline double getAccelX() const | 52 | * Whether or not a freefalling body is in contact with the ground. |
| 44 | { | 53 | * |
| 45 | return accelX_; | 54 | * @managed_by PonderingSystem |
| 46 | } | 55 | */ |
| 47 | 56 | bool grounded = false; | |
| 48 | inline void setAccelX(double v) | 57 | |
| 49 | { | 58 | /** |
| 50 | accelX_ = v; | 59 | * If enabled, this will prevent the body from moving. |
| 51 | } | 60 | */ |
| 52 | 61 | bool frozen = false; | |
| 53 | inline double getAccelY() const | 62 | |
| 54 | { | 63 | /** |
| 55 | return accelY_; | 64 | * If disabled, collision detection for this body will not be performed and |
| 56 | } | 65 | * other bodies will ignore it. |
| 57 | 66 | */ | |
| 58 | inline void setAccelY(double v) | 67 | bool collidable = true; |
| 59 | { | 68 | |
| 60 | accelY_ = v; | 69 | /** |
| 61 | } | 70 | * If this flag is disabled, the entity will be ignored by the pondering |
| 62 | 71 | * system. | |
| 63 | inline bool isGrounded() const | 72 | * |
| 64 | { | 73 | * @managed_by RealizingSystem |
| 65 | return grounded_; | 74 | */ |
| 66 | } | 75 | bool active = false; |
| 67 | |||
| 68 | inline void setGrounded(bool v) | ||
| 69 | { | ||
| 70 | grounded_ = v; | ||
| 71 | } | ||
| 72 | |||
| 73 | inline bool isFrozen() const | ||
| 74 | { | ||
| 75 | return frozen_; | ||
| 76 | } | ||
| 77 | |||
| 78 | inline void setFrozen(bool v) | ||
| 79 | { | ||
| 80 | frozen_ = v; | ||
| 81 | } | ||
| 82 | |||
| 83 | inline bool isCollidable() const | ||
| 84 | { | ||
| 85 | return collidable_; | ||
| 86 | } | ||
| 87 | |||
| 88 | inline void setCollidable(bool v) | ||
| 89 | { | ||
| 90 | collidable_ = v; | ||
| 91 | } | ||
| 92 | |||
| 93 | private: | ||
| 94 | |||
| 95 | double velX_ = 0.0; | ||
| 96 | double velY_ = 0.0; | ||
| 97 | double accelX_ = 0.0; | ||
| 98 | double accelY_ = 0.0; | ||
| 99 | Type type_ = Type::vacuumed; | ||
| 100 | bool grounded_ = false; | ||
| 101 | bool frozen_ = false; | ||
| 102 | bool collidable_ = true; | ||
| 103 | }; | 76 | }; |
| 104 | 77 | ||
| 105 | #endif /* end of include guard: TANGIBLE_H_746DB3EE */ | 78 | #endif /* end of include guard: TANGIBLE_H_746DB3EE */ |
| diff --git a/src/components/realizable.h b/src/components/realizable.h new file mode 100644 index 0000000..f6a7eb4 --- /dev/null +++ b/src/components/realizable.h | |||
| @@ -0,0 +1,67 @@ | |||
| 1 | #ifndef REALIZABLE_H_36D8D71E | ||
| 2 | #define REALIZABLE_H_36D8D71E | ||
| 3 | |||
| 4 | #include "component.h" | ||
| 5 | #include <set> | ||
| 6 | #include <map> | ||
| 7 | #include "entity_manager.h" | ||
| 8 | |||
| 9 | class RealizableComponent : public Component { | ||
| 10 | public: | ||
| 11 | |||
| 12 | using id_type = EntityManager::id_type; | ||
| 13 | |||
| 14 | /** | ||
| 15 | * Path to the XML file containing the world definition. | ||
| 16 | * | ||
| 17 | * @managed_by RealizingSystem | ||
| 18 | */ | ||
| 19 | std::string worldFile; | ||
| 20 | |||
| 21 | /** | ||
| 22 | * Starting map and player location for a new game. | ||
| 23 | * | ||
| 24 | * @managed_by RealizingSystem | ||
| 25 | */ | ||
| 26 | int startingMapId; | ||
| 27 | int startingX; | ||
| 28 | int startingY; | ||
| 29 | |||
| 30 | /** | ||
| 31 | * The set of map entities loaded by this entity. It is only intended for | ||
| 32 | * there to be one realizable entity, so this should contain all loaded maps. | ||
| 33 | * The realizable entity has ownership of the loaded maps. | ||
| 34 | * | ||
| 35 | * @managed_by RealizingSystem | ||
| 36 | */ | ||
| 37 | std::set<id_type> maps; | ||
| 38 | |||
| 39 | /** | ||
| 40 | * A lookup table that translates a map ID to the entity representing that | ||
| 41 | * loaded map. | ||
| 42 | * | ||
| 43 | * @managed_by RealizingSystem | ||
| 44 | */ | ||
| 45 | std::map<size_t, id_type> entityByMapId; | ||
| 46 | |||
| 47 | /** | ||
| 48 | * The entity ID of the currently active map. | ||
| 49 | * | ||
| 50 | * @managed_by RealizingSystem | ||
| 51 | */ | ||
| 52 | id_type activeMap; | ||
| 53 | |||
| 54 | /** | ||
| 55 | * Whether or not a map has been activated yet. | ||
| 56 | * | ||
| 57 | * @managed_by RealizingSystem | ||
| 58 | */ | ||
| 59 | bool hasActiveMap = false; | ||
| 60 | |||
| 61 | /** | ||
| 62 | * The entity ID of the currently active player. | ||
| 63 | */ | ||
| 64 | id_type activePlayer; | ||
| 65 | }; | ||
| 66 | |||
| 67 | #endif /* end of include guard: REALIZABLE_H_36D8D71E */ | ||
| diff --git a/src/components/transformable.h b/src/components/transformable.h index 6ed2637..3296e49 100644 --- a/src/components/transformable.h +++ b/src/components/transformable.h | |||
| @@ -6,64 +6,27 @@ | |||
| 6 | class TransformableComponent : public Component { | 6 | class TransformableComponent : public Component { |
| 7 | public: | 7 | public: |
| 8 | 8 | ||
| 9 | TransformableComponent( | 9 | /** |
| 10 | double x, | 10 | * The coordinates of the entity. |
| 11 | double y, | 11 | */ |
| 12 | int w, | 12 | double x; |
| 13 | int h) : | 13 | double y; |
| 14 | x_(x), | 14 | |
| 15 | y_(y), | 15 | /** |
| 16 | w_(w), | 16 | * The size of the entity. |
| 17 | h_(h) | 17 | */ |
| 18 | { | 18 | int w; |
| 19 | } | 19 | int h; |
| 20 | 20 | ||
| 21 | inline double getX() const | 21 | /** |
| 22 | { | 22 | * For prototypes, the original coordinates and size of the entity. |
| 23 | return x_; | 23 | * |
| 24 | } | 24 | * @managed_by RealizingSystem |
| 25 | 25 | */ | |
| 26 | inline void setX(double v) | 26 | double origX; |
| 27 | { | 27 | double origY; |
| 28 | x_ = v; | 28 | int origW; |
| 29 | } | 29 | int origH; |
| 30 | |||
| 31 | inline double getY() const | ||
| 32 | { | ||
| 33 | return y_; | ||
| 34 | } | ||
| 35 | |||
| 36 | inline void setY(double v) | ||
| 37 | { | ||
| 38 | y_ = v; | ||
| 39 | } | ||
| 40 | |||
| 41 | inline int getW() const | ||
| 42 | { | ||
| 43 | return w_; | ||
| 44 | } | ||
| 45 | |||
| 46 | inline void setW(int v) | ||
| 47 | { | ||
| 48 | w_ = v; | ||
| 49 | } | ||
| 50 | |||
| 51 | inline int getH() const | ||
| 52 | { | ||
| 53 | return h_; | ||
| 54 | } | ||
| 55 | |||
| 56 | inline void setH(int v) | ||
| 57 | { | ||
| 58 | h_ = v; | ||
| 59 | } | ||
| 60 | |||
| 61 | private: | ||
| 62 | |||
| 63 | double x_; | ||
| 64 | double y_; | ||
| 65 | int w_; | ||
| 66 | int h_; | ||
| 67 | }; | 30 | }; |
| 68 | 31 | ||
| 69 | #endif /* end of include guard: LOCATABLE_H_39E526CA */ | 32 | #endif /* end of include guard: LOCATABLE_H_39E526CA */ |
