ManaPlus
imagesprite.h
Go to the documentation of this file.
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 
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 
38 
39  ~ImageSprite() override final;
40 
42  { return false; }
43 
44  bool play(const std::string &action A_UNUSED) override final
45  { return false; }
46 
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 
55  { return mImage != nullptr ? mImage->getWidth() : 0; }
56 
58  { return mImage != nullptr ? mImage->getHeight() : 0; }
59 
61  { return mImage; }
62 
64  direction A_UNUSED) override final
65  { return false; }
66 
68  { return 1; }
69 
71  { return 0; }
72 
74  { return 1; }
75 
76  bool updateNumber(const unsigned num A_UNUSED) override final
77  { return false; }
78 
79  private:
81 };
82 
83 #endif // RESOURCES_SPRITE_IMAGESPRITE_H
ImageSprite(Image *const image)
Definition: imagesprite.cpp:29
int getWidth() const
Definition: imagesprite.h:54
int getHeight() const
Definition: imagesprite.h:57
bool update(const int time)
Definition: imagesprite.h:47
unsigned int getCurrentFrame() const
Definition: imagesprite.h:70
bool setSpriteDirection(const SpriteDirection::Type direction)
Definition: imagesprite.h:63
int getNumberOfLayers() const
Definition: imagesprite.h:67
unsigned int getFrameCount() const
Definition: imagesprite.h:73
Image * mImage
Definition: imagesprite.h:80
bool play(const std::string &action)
Definition: imagesprite.h:44
bool updateNumber(const unsigned num)
Definition: imagesprite.h:76
const Image * getImage() const
Definition: imagesprite.h:60
bool reset()
Definition: imagesprite.h:41
void draw(Graphics *const graphics, const int posX, const int posY) const
Definition: imagesprite.cpp:52
Definition: sprite.h:34
#define override
Definition: localconsts.h:47
#define A_WARN_UNUSED
Definition: localconsts.h:161
#define A_NONNULL(...)
Definition: localconsts.h:168
#define final
Definition: localconsts.h:46
#define A_DELETE_COPY(func)
Definition: localconsts.h:53
#define A_UNUSED
Definition: localconsts.h:160