Initial porting to the new component API.
[tagua/yd.git] / src / core / taguaapi.h
blobc86cdfd562f5e200ca82a6c12587564d4d14d5ae
1 /*
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.
9 */
11 #ifndef CORE__TAGUAAPI_H
12 #define CORE__TAGUAAPI_H
14 #include <vector>
15 #include <boost/shared_ptr.hpp>
16 #include "animation_fwd.h"
17 #include "namedsprite.h"
18 #include "point.h"
20 typedef boost::shared_ptr<class Sprite> SpritePtr;
21 class IColor;
22 class IState;
23 class Piece;
25 /**
26 * This class defines the interface that will be used by the animator to modify
27 * tagua graphics.
29 class TAGUA_EXPORT TaguaAPI {
30 public:
31 virtual ~TaguaAPI();
33 /**
34 * @return The current game state
36 virtual const IState* state() const = 0;
38 /**
39 * @return a sprite at the position \a index in the graphical pool.
41 virtual NamedSprite getSprite(const Point& p) = 0;
43 /**
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;
49 /**
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;
55 /**
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;
61 /**
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;
67 /**
68 * @return how many sprites are contained in the pool
70 virtual int poolSize(int pool) = 0;
72 /**
73 * @return the sprite at the position @a index in the graphical pool.
75 virtual NamedSprite getPoolSprite(int pool, int index) = 0;
77 /**
78 * Removes the sprite at the position @a index in the graphical pool.
80 virtual void removePoolSprite(int pool, int index) = 0;
82 /**
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;
88 /**
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;
94 /**
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,
108 int destination,
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