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 GRAPHICALAPI_H
12 #define GRAPHICALAPI_H
15 #include <boost/shared_ptr.hpp>
16 #include "animationfactory.h"
18 #include <core/namedsprite.h>
21 typedef boost::shared_ptr
<class Sprite
> SpritePtr
;
24 * This class defines the interface that will be used by the animator to modify
29 virtual ~GraphicalAPI();
32 * \return the current abstract position.
34 virtual AbstractPosition::Ptr
position() const = 0;
37 * \return a sprite at the position \a index in the graphical pool.
39 virtual NamedSprite
getSprite(const Point
& p
) = 0;
42 * Removes a sprite at the position \a index in the graphical pool.
43 * \return the newly created sprite.
45 virtual NamedSprite
takeSprite(const Point
& p
) = 0;
48 * Sets the piece at the position \a index in the graphical pool.
49 * \return the newly created sprite.
51 virtual NamedSprite
setPiece(const Point
& p
, const AbstractPiece
* piece
, bool show
) = 0;
54 * Create a new piece, but do not add it to the graphical system.
55 * \return the newly created sprite.
57 virtual NamedSprite
createPiece(const Point
& p
, const AbstractPiece
* piece
, bool show
) = 0;
60 * Sets the sprite at the position \a index in the graphical pool.
61 * \return the newly created sprite.
63 virtual void setSprite(const Point
& p
, const NamedSprite
& sprite
) = 0;
66 * \return how many sprites are contained in the pool
68 virtual int poolSize(int pool
) = 0;
71 * \return the sprite at the position \a index in the graphical pool.
73 virtual NamedSprite
getPoolSprite(int pool
, int index
) = 0;
76 * Removes the sprite at the position \a index in the graphical pool.
78 virtual void removePoolSprite(int pool
, int index
) = 0;
81 * Removes the sprite at the position \a index in the graphical pool (only for drops).
82 * \return the removed sprite.
84 virtual NamedSprite
takePoolSprite(int pool
, int index
) = 0;
87 * Inserts a sprite at the position \a index in the graphical pool.
88 * \return the newly created sprite.
90 virtual NamedSprite
insertPoolPiece(int pool
, int index
, const AbstractPiece
* piece
) = 0;
93 * \return the piece of the pool that has been dropped, or (-1,-1)
95 virtual std::pair
<int, int> droppedPoolPiece() = 0;
97 virtual AnimationPtr
group(const QString
& flags
) const = 0;
98 virtual AnimationPtr
appear(const NamedSprite
& sprite
,
99 const QString
& flags
) const = 0;
100 virtual AnimationPtr
disappear(const NamedSprite
& sprite
,
101 const QString
& flags
) const = 0;
102 virtual AnimationPtr
move(const NamedSprite
& sprite
,
103 const Point
& destination
,
104 const QString
& flags
) const = 0;
105 virtual AnimationPtr
move(const NamedSprite
& sprite
,
107 const QString
& flags
) const = 0;
108 virtual AnimationPtr
morph(const NamedSprite
& sprite1
,
109 const NamedSprite
& sprite2
,
110 const QString
& flags
) const = 0;
112 virtual AnimationPtr
animate(const Animate::Scheme
& scheme
, Animate::AnimationType type
) = 0;
115 #endif //GRAPHICALAPI_H