1 /*
2  *  The ManaPlus Client
3  *  Copyright (C) 2010  The Mana Developers
4  *  Copyright (C) 2011-2019  The ManaPlus Developers
5  *  Copyright (C) 2019-2021  Andrei Karas
6  *
7  *  This file is part of The ManaPlus Client.
8  *
9  *  This program is free software; you can redistribute it and/or modify
10  *  it under the terms of the GNU General Public License as published by
11  *  the Free Software Foundation; either version 2 of the License, or
12  *  any later version.
13  *
14  *  This program is distributed in the hope that it will be useful,
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17  *  GNU General Public License for more details.
18  *
19  *  You should have received a copy of the GNU General Public License
20  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
21  */
22 
23 #ifndef RESOURCES_SPRITE_IMAGESPRITE_H
24 #define RESOURCES_SPRITE_IMAGESPRITE_H
25 
26 #include "resources/sprite/sprite.h"
27 
28 #include "resources/image/image.h"
29 
30 class Graphics;
31 
32 class ImageSprite final : public Sprite
33 {
34     public:
35         explicit ImageSprite(Image *const image);
36 
37         A_DELETE_COPY(ImageSprite)
38 
39         ~ImageSprite() override final;
40 
reset()41         bool reset() override final
42         { return false; }
43 
play(const std::string & action A_UNUSED)44         bool play(const std::string &action A_UNUSED) override final
45         { return false; }
46 
update(const int time A_UNUSED)47         bool update(const int time A_UNUSED) override final
48         { return false; }
49 
50         void draw(Graphics *const graphics,
51                   const int posX, const int posY)
52                   const override final A_NONNULL(2);
53 
getWidth()54         int getWidth() const override final A_WARN_UNUSED
55         { return mImage != nullptr ? mImage->getWidth() : 0; }
56 
getHeight()57         int getHeight() const override final A_WARN_UNUSED
58         { return mImage != nullptr ? mImage->getHeight() : 0; }
59 
getImage()60         const Image* getImage() const override final A_WARN_UNUSED
61         { return mImage; }
62 
setSpriteDirection(const SpriteDirection::Type direction A_UNUSED)63         bool setSpriteDirection(const SpriteDirection::Type
64                                 direction A_UNUSED) override final
65         { return false; }
66 
getNumberOfLayers()67         int getNumberOfLayers() const A_WARN_UNUSED
68         { return 1; }
69 
getCurrentFrame()70         unsigned int getCurrentFrame() const override final A_WARN_UNUSED
71         { return 0; }
72 
getFrameCount()73         unsigned int getFrameCount() const override final A_WARN_UNUSED
74         { return 1; }
75 
updateNumber(const unsigned num A_UNUSED)76         bool updateNumber(const unsigned num A_UNUSED) override final
77         { return false; }
78 
79     private:
80         Image *mImage;
81 };
82 
83 #endif  // RESOURCES_SPRITE_IMAGESPRITE_H
84