From f139e6c1dcdfaa79967e4f7e6c3961677019b02d Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Sun, 13 Nov 2022 18:22:36 +0100 Subject: Use a namespace alias --- src/main.cpp | 25 ++++++++++++++----------- 1 file 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 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}; }; -- cgit v1.2.3