summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2022-11-13 18:22:36 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2022-11-13 18:25:29 +0100
commitf139e6c1dcdfaa79967e4f7e6c3961677019b02d (patch)
tree1e68649aa99f6ef6abe5005325d3d159b5d7c328
parenta9e3a2b212fb5b60bb0479fa999ddeeaa0355598 (diff)
Use a namespace alias
-rw-r--r--src/main.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/main.cpp b/src/main.cpp
index dcedb03..1987af4 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -6,6 +6,8 @@
#include "graphics/animation.h"
#include "entity.h"
+namespace gph = Graphics;
+
class Unit: Entity{
private:
sf::Texture spritesheet_;
@@ -19,12 +21,12 @@ class Unit: Entity{
dying = 4,
};
std::vector<int> animation_frame_count { 6, 8, 6, 1, 14 };
- Graphics::Animation walking_animation;
- Graphics::Animation standing_animation;
- Graphics::OneShotAnimation shooting_animation;
- Graphics::OneShotAnimation complaining_animation;
- Graphics::OneShotAnimation dying_animation;
- Graphics::Animation* current_animation = &standing_animation;
+ gph::Animation walking_animation;
+ gph::Animation standing_animation;
+ gph::OneShotAnimation shooting_animation;
+ gph::OneShotAnimation complaining_animation;
+ gph::OneShotAnimation dying_animation;
+ gph::Animation* current_animation = &standing_animation;
sf::Sprite sprite;
sf::Vector2f position;
@@ -34,11 +36,12 @@ class Unit: Entity{
Unit(){
spritesheet_.loadFromFile("assets/img/Player/Player Angle 1 Sheet.png");
- standing_animation = Graphics::Animation(spritesheet_, 6, 60, 44, 48, 0);
- walking_animation = Graphics::Animation(spritesheet_, 8, 60, 44, 48, 1);
- shooting_animation = Graphics::OneShotAnimation(spritesheet_, 6, 60, 44, 48, 2);
- complaining_animation = Graphics::OneShotAnimation(spritesheet_, 1, 60, 44, 48, 3);
- dying_animation = Graphics::OneShotAnimation(spritesheet_, 14, 60, 44, 48, 4);
+ standing_animation = gph::Animation(spritesheet_, 6, 60, 44, 48, 0);
+ walking_animation = gph::Animation(spritesheet_, 8, 60, 44, 48, 1);
+ shooting_animation = gph::OneShotAnimation(spritesheet_, 6, 60, 44, 48, 2);
+ complaining_animation = gph::OneShotAnimation(spritesheet_, 1, 60, 44, 48, 3);
+ dying_animation = gph::OneShotAnimation(spritesheet_, 14, 60, 44, 48, 4);
+
position = sf::Vector2f{0,0};
speed = sf::Vector2f{0,0};
};