From a6d1f7f9abdedce7c03056408ed2172792abce53 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 20 Dec 2015 18:23:50 +0300 Subject: Move sprite.h into sprites directory. --- src/CMakeLists.txt | 2 +- src/Makefile.am | 2 +- src/animatedsprite.h | 2 +- src/being/compoundsprite.h | 2 +- src/imagesprite.h | 2 +- src/resources/sprite/sprite.h | 130 ++++++++++++++++++++++++++++++++++++++++++ src/sprite.h | 130 ------------------------------------------ 7 files changed, 135 insertions(+), 135 deletions(-) create mode 100644 src/resources/sprite/sprite.h delete mode 100644 src/sprite.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 616a1fa8f..cb4eb0fd4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1126,7 +1126,7 @@ SET(SRCS const/sound.h soundmanager.cpp soundmanager.h - sprite.h + resources/sprite/sprite.h enums/screendensity.h enums/state.h enums/textcommandtype.h diff --git a/src/Makefile.am b/src/Makefile.am index 8665aff0e..6b3c0aac5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -644,7 +644,7 @@ SRC += events/actionevent.h \ resources/animation.h \ simpleanimation.cpp \ simpleanimation.h \ - sprite.h \ + resources/sprite/sprite.h \ const/sound.h \ soundmanager.cpp \ soundmanager.h \ diff --git a/src/animatedsprite.h b/src/animatedsprite.h index 10e378593..be27e5d10 100644 --- a/src/animatedsprite.h +++ b/src/animatedsprite.h @@ -23,7 +23,7 @@ #ifndef ANIMATEDSPRITE_H #define ANIMATEDSPRITE_H -#include "sprite.h" +#include "resources/sprite/sprite.h" class Animation; class AnimationDelayLoad; diff --git a/src/being/compoundsprite.h b/src/being/compoundsprite.h index 25dee6b65..4a82855cf 100644 --- a/src/being/compoundsprite.h +++ b/src/being/compoundsprite.h @@ -22,7 +22,7 @@ #ifndef BEING_COMPOUNDSPRITE_H #define BEING_COMPOUNDSPRITE_H -#include "sprite.h" +#include "resources/sprite/sprite.h" #include #include diff --git a/src/imagesprite.h b/src/imagesprite.h index 528b8c6ac..61defaa2f 100644 --- a/src/imagesprite.h +++ b/src/imagesprite.h @@ -22,7 +22,7 @@ #ifndef IMAGESPRITE_H #define IMAGESPRITE_H -#include "sprite.h" +#include "resources/sprite/sprite.h" #include "resources/image.h" diff --git a/src/resources/sprite/sprite.h b/src/resources/sprite/sprite.h new file mode 100644 index 000000000..34ec001e1 --- /dev/null +++ b/src/resources/sprite/sprite.h @@ -0,0 +1,130 @@ +/* + * The ManaPlus Client + * Copyright (C) 2010 The Mana Developers + * Copyright (C) 2011-2015 The ManaPlus Developers + * + * This file is part of The ManaPlus Client. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#ifndef RESOURCES_SPRITE_SPRITE_H +#define RESOURCES_SPRITE_SPRITE_H + +#include "resources/sprite/spritedef.h" + +#include "localconsts.h" + +class Graphics; +class Image; + +class Sprite notfinal +{ + public: + virtual ~Sprite() + { } + + /** + * Resets the sprite. + * + * @returns true if the sprite changed, false otherwise + */ + virtual bool reset() = 0; + + /** + * Plays an action using the current direction. + * + * @returns true if the sprite changed, false otherwise + */ + virtual bool play(const std::string &action) = 0; + + /** + * Inform the animation of the passed time so that it can output the + * correct animation frame. + * + * @returns true if the sprite changed, false otherwise + */ + virtual bool update(const int time) = 0; + + /** + * Draw the current animation frame at the coordinates given in screen + * pixels. + */ + virtual void draw(Graphics *const graphics, + const int posX, const int posY) + const A_NONNULL(2) = 0; + + /** + * Gets the width in pixels of the image of the current frame + */ + virtual int getWidth() const A_WARN_UNUSED = 0; + + /** + * Gets the height in pixels of the image of the current frame + */ + virtual int getHeight() const A_WARN_UNUSED = 0; + + /** + * Returns a reference to the current image being drawn. + */ + virtual const Image* getImage() const A_WARN_UNUSED = 0; + + /** + * Sets the direction. + * + * @returns true if the sprite changed, false otherwise + */ + virtual bool setSpriteDirection(const SpriteDirection::Type + direction) = 0; + + /** + * Sets the alpha value of the animated sprite + */ + virtual void setAlpha(float alpha) + { mAlpha = alpha; } + + /** + * Returns the current alpha opacity of the animated sprite. + */ + virtual float getAlpha() const A_WARN_UNUSED + { return mAlpha; } + + /** + * Returns the current frame number for the sprite. + */ + virtual unsigned int getCurrentFrame() const A_WARN_UNUSED = 0; + + /** + * Returns the frame count for the sprite. + */ + virtual unsigned int getFrameCount() const A_WARN_UNUSED = 0; + + virtual const void *getHash() const A_WARN_UNUSED + { return nullptr; } + + virtual const void *getHash2() const A_WARN_UNUSED + { return this; } + + virtual bool updateNumber(const unsigned num) = 0; + + protected: + Sprite() : + mAlpha() + { + } + + float mAlpha; /**< The alpha opacity used to draw */ +}; + +#endif // RESOURCES_SPRITE_SPRITE_H diff --git a/src/sprite.h b/src/sprite.h deleted file mode 100644 index 3575eea2f..000000000 --- a/src/sprite.h +++ /dev/null @@ -1,130 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2010 The Mana Developers - * Copyright (C) 2011-2015 The ManaPlus Developers - * - * This file is part of The ManaPlus Client. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -#ifndef SPRITE_H -#define SPRITE_H - -#include "resources/sprite/spritedef.h" - -#include "localconsts.h" - -class Graphics; -class Image; - -class Sprite notfinal -{ - public: - virtual ~Sprite() - { } - - /** - * Resets the sprite. - * - * @returns true if the sprite changed, false otherwise - */ - virtual bool reset() = 0; - - /** - * Plays an action using the current direction. - * - * @returns true if the sprite changed, false otherwise - */ - virtual bool play(const std::string &action) = 0; - - /** - * Inform the animation of the passed time so that it can output the - * correct animation frame. - * - * @returns true if the sprite changed, false otherwise - */ - virtual bool update(const int time) = 0; - - /** - * Draw the current animation frame at the coordinates given in screen - * pixels. - */ - virtual void draw(Graphics *const graphics, - const int posX, const int posY) - const A_NONNULL(2) = 0; - - /** - * Gets the width in pixels of the image of the current frame - */ - virtual int getWidth() const A_WARN_UNUSED = 0; - - /** - * Gets the height in pixels of the image of the current frame - */ - virtual int getHeight() const A_WARN_UNUSED = 0; - - /** - * Returns a reference to the current image being drawn. - */ - virtual const Image* getImage() const A_WARN_UNUSED = 0; - - /** - * Sets the direction. - * - * @returns true if the sprite changed, false otherwise - */ - virtual bool setSpriteDirection(const SpriteDirection::Type - direction) = 0; - - /** - * Sets the alpha value of the animated sprite - */ - virtual void setAlpha(float alpha) - { mAlpha = alpha; } - - /** - * Returns the current alpha opacity of the animated sprite. - */ - virtual float getAlpha() const A_WARN_UNUSED - { return mAlpha; } - - /** - * Returns the current frame number for the sprite. - */ - virtual unsigned int getCurrentFrame() const A_WARN_UNUSED = 0; - - /** - * Returns the frame count for the sprite. - */ - virtual unsigned int getFrameCount() const A_WARN_UNUSED = 0; - - virtual const void *getHash() const A_WARN_UNUSED - { return nullptr; } - - virtual const void *getHash2() const A_WARN_UNUSED - { return this; } - - virtual bool updateNumber(const unsigned num) = 0; - - protected: - Sprite() : - mAlpha() - { - } - - float mAlpha; /**< The alpha opacity used to draw */ -}; - -#endif // SPRITE_H -- cgit v1.2.3-70-g09d2