summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2022-11-13 18:21:41 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2022-11-13 18:24:39 +0100
commita9e3a2b212fb5b60bb0479fa999ddeeaa0355598 (patch)
treef72ff41c0891bea5b72e65bd0abacd2f8da7f7f0
parent87d8264e8b06db067cda79029c7798f4e5c578e8 (diff)
Use base constructors to reduce code size
-rw-r--r--src/graphics/animation.cpp15
-rw-r--r--src/graphics/animation.h8
2 files changed, 2 insertions, 21 deletions
diff --git a/src/graphics/animation.cpp b/src/graphics/animation.cpp
index 577324a..f311cf0 100644
--- a/src/graphics/animation.cpp
+++ b/src/graphics/animation.cpp
@@ -71,13 +71,6 @@ namespace Graphics{
Animation::~Animation(){}
// ONESHOT ANIMATION
- OneShotAnimation::OneShotAnimation(){}
-
- OneShotAnimation::OneShotAnimation(const sf::Texture& texture, int count,
- int switchTime, int height = 0, int width = 0, int row = 0):
- Animation(texture, count, switchTime, height, width, row) {
- }
-
bool OneShotAnimation::finished(){
return (i_ == count_ - 1);
}
@@ -98,14 +91,6 @@ namespace Graphics{
}
// BOUNCING ANIMATION
- BouncingAnimation::BouncingAnimation(){}
-
- BouncingAnimation::BouncingAnimation(const sf::Texture& texture, int count,
- int switchTime, int height = 0, int width = 0, int row = 0):
- Animation(texture, count, switchTime, height, width, row),
- up_ (true) {
- }
-
sf::IntRect& BouncingAnimation::next(int deltaTime){
if( !ticked(deltaTime) ) {
return rect_;
diff --git a/src/graphics/animation.h b/src/graphics/animation.h
index 503b75d..010a64a 100644
--- a/src/graphics/animation.h
+++ b/src/graphics/animation.h
@@ -28,9 +28,7 @@ namespace Graphics{
class OneShotAnimation : public Animation {
public:
- OneShotAnimation();
- OneShotAnimation(const sf::Texture& texture, int count, int
- switchTime, int height, int width, int row);
+ using Animation::Animation;
sf::IntRect& next(int deltaTime) override;
bool finished() override;
};
@@ -39,9 +37,7 @@ namespace Graphics{
private:
bool up_;
public:
- BouncingAnimation();
- BouncingAnimation(const sf::Texture& texture, int count, int
- switchTime, int height, int width, int row);
+ using Animation::Animation;
~BouncingAnimation();
sf::IntRect& next(int deltaTime) override;
};