Moved global.* to mastersettings.*, and converted many error messages to use the...
[tagua/yd.git] / src / graphicalapi.h
blob3bae53c1556fb74790088724b3b54be35e52a190
1 /*
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.
9 */
11 #ifndef GRAPHICALAPI_H
12 #define GRAPHICALAPI_H
14 #include <vector>
15 #include <boost/shared_ptr.hpp>
16 #include "animationfactory.h"
17 #include "kboard.h"
18 #include "pointconverter.h"
19 #include "namedsprite.h"
20 #include "fwd.h"
22 typedef boost::shared_ptr<class Sprite> SpritePtr;
24 /**
25 * This class defines the interface that will be used by the animator to modify
26 * kboard graphics.
28 class GraphicalAPI {
29 public:
30 virtual ~GraphicalAPI() { }
32 /**
33 * \return the current abstract position.
35 virtual const PointConverter* converter() const = 0;
37 /**
38 * \return the current abstract position.
40 virtual AbstractPosition::Ptr position() const = 0;
42 /**
43 * \return a sprite at the position \a index in the graphical pool.
45 virtual NamedSprite getSprite(const Point& p) = 0;
47 /**
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;
53 /**
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;
59 /**
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;
65 /**
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;
71 /**
72 * \return how many sprites are contained in the pool
74 virtual int poolSize(int pool) = 0;
76 /**
77 * \return the sprite at the position \a index in the graphical pool.
79 //virtual NamedSprite getPoolSprite(int pool, int index) = 0;
81 /**
82 * Removes the sprite at the position \a index in the graphical pool.
84 virtual void removePoolSprite(int pool, int index) = 0;
86 /**
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;
92 /**
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;
98 /**
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