2 Copyright (c) 2006 Paolo Capriotti <p.capriotti@sns.it>
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 "pointconverter.h"
19 #include "namedsprite.h"
22 typedef boost::shared_ptr
<class Sprite
> SpritePtr
;
25 * This class defines the interface that will be used by the animator to modify
30 virtual ~GraphicalAPI() { }
33 * \return the current abstract position.
35 virtual const PointConverter
* converter() const = 0;
38 * \return the current abstract position.
40 virtual AbstractPosition::Ptr
position() const = 0;
43 * \return a sprite at the position \a index in the graphical pool.
45 virtual NamedSprite
getSprite(const Point
& p
) = 0;
48 * Removes a sprite at the position \a index in the graphical pool.
49 * \return the newly created sprite.
51 virtual NamedSprite
takeSprite(const Point
& p
) = 0;
54 * Sets the piece at the position \a index in the graphical pool.
55 * \return the newly created sprite.
57 virtual NamedSprite
setPiece(const Point
& p
, const AbstractPiece
* piece
, bool show
) = 0;
60 * Create a new piece, but do not add it to the graphical system.
61 * \return the newly created sprite.
63 virtual NamedSprite
createPiece(const Point
& p
, const AbstractPiece
* piece
, bool show
) = 0;
66 * Sets the sprite at the position \a index in the graphical pool.
67 * \return the newly created sprite.
69 virtual void setSprite(const Point
& p
, const NamedSprite
& sprite
) = 0;
72 * \return how many sprites are contained in the pool
74 virtual int poolSize(int pool
) = 0;
77 * \return the sprite at the position \a index in the graphical pool.
79 //virtual NamedSprite getPoolSprite(int pool, int index) = 0;
82 * Removes the sprite at the position \a index in the graphical pool.
84 virtual void removePoolSprite(int pool
, int index
) = 0;
87 * Removes the sprite at the position \a index in the graphical pool (only for drops).
88 * \return the removed sprite.
90 virtual NamedSprite
takePoolSprite(int pool
, int index
) = 0;
93 * Inserts a sprite at the position \a index in the graphical pool.
94 * \return the newly created sprite.
96 virtual NamedSprite
insertPoolPiece(int pool
, int index
, const AbstractPiece
* piece
) = 0;
99 * \return the piece of the pool that has been dropped, or (-1,-1)
101 virtual std::pair
<int, int> droppedPoolPiece() = 0;
103 virtual AnimationPtr
animate(const Animate::Scheme
& scheme
, Animate::AnimationType type
) = 0;
106 #endif //GRAPHICALAPI_H