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