2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@gmail.com>
3 (c) 2006 Maurizio Monge <maurizio.monge@kdemail.net>
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
11 #ifndef CORE__TAGUAAPI_H
12 #define CORE__TAGUAAPI_H
15 #include <boost/shared_ptr.hpp>
16 #include "animation_fwd.h"
17 #include "namedsprite.h"
20 typedef boost::shared_ptr
<class Sprite
> SpritePtr
;
26 * This class defines the interface that will be used by the animator to modify
29 class TAGUA_EXPORT TaguaAPI
{
34 * @return The current game state
36 virtual const IState
* state() const = 0;
39 * @return a sprite at the position \a index in the graphical pool.
41 virtual NamedSprite
getSprite(const Point
& p
) = 0;
44 * Removes a sprite at the position \a index in the graphical pool.
45 * @return the newly created sprite.
47 virtual NamedSprite
takeSprite(const Point
& p
) = 0;
50 * Sets the piece at the position @a index in the graphical pool.
51 * @return the newly created sprite.
53 virtual NamedSprite
setPiece(const Point
& p
, const Piece
& piece
, bool show
) = 0;
56 * Create a new piece, but do not add it to the graphical system.
57 * @return the newly created sprite.
59 virtual NamedSprite
createPiece(const Point
& p
, const Piece
& piece
, bool show
) = 0;
62 * Sets the sprite at the position @a index in the graphical pool.
63 * @return the newly created sprite.
65 virtual void setSprite(const Point
& p
, const NamedSprite
& sprite
) = 0;
68 * @return how many sprites are contained in the pool
70 virtual int poolSize(int pool
) = 0;
73 * @return the sprite at the position @a index in the graphical pool.
75 virtual NamedSprite
getPoolSprite(int pool
, int index
) = 0;
78 * Removes the sprite at the position @a index in the graphical pool.
80 virtual void removePoolSprite(int pool
, int index
) = 0;
83 * Removes the sprite at the position @a index in the graphical pool (only for drops).
84 * @return the removed sprite.
86 virtual NamedSprite
takePoolSprite(int pool
, int index
) = 0;
89 * Inserts a sprite at the position @a index in the graphical pool.
90 * @return the newly created sprite.
92 virtual NamedSprite
insertPoolPiece(int pool
, int index
, const Piece
& piece
) = 0;
95 * @return the piece of the pool that has been dropped, or (-1,-1)
97 virtual std::pair
<const IColor
*, int> droppedPoolPiece() = 0;
99 virtual AnimationPtr
group(const QString
& flags
) const = 0;
100 virtual AnimationPtr
appear(const NamedSprite
& sprite
,
101 const QString
& flags
) const = 0;
102 virtual AnimationPtr
disappear(const NamedSprite
& sprite
,
103 const QString
& flags
) const = 0;
104 virtual AnimationPtr
move(const NamedSprite
& sprite
,
105 const Point
& destination
,
106 const QString
& flags
) const = 0;
107 virtual AnimationPtr
move(const NamedSprite
& sprite
,
109 const QString
& flags
) const = 0;
110 virtual AnimationPtr
morph(const NamedSprite
& sprite1
,
111 const NamedSprite
& sprite2
,
112 const QString
& flags
) const = 0;
115 #endif // CORE__TAGUAAPI_H