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 UNWRAPPEDGRAPHICALAPI_H
12 #define UNWRAPPEDGRAPHICALAPI_H
14 #include "graphicalapi.h"
17 * This class moves the interface that will be used by the animator to modify
18 * kboard graphics into the variant's semantics.
20 template <typename Variant
>
21 class UnwrappedGraphicalAPI
{
22 GraphicalAPI
* m_graphical_api
;
24 UnwrappedGraphicalAPI(GraphicalAPI
* interface
)
25 : m_graphical_api(interface
) {
28 virtual ~UnwrappedGraphicalAPI(){}
30 virtual const PointConverter
* converter() {
31 return m_graphical_api
->converter();
34 virtual const typename
Variant::Position
* position() {
35 const WrappedPosition
<Variant
> *p
= dynamic_cast<const WrappedPosition
<Variant
>*>(m_graphical_api
->position());
39 MISMATCH(m_graphical_api
->position(), WrappedPosition
<Variant
>);
44 virtual SpritePtr
setSprite(const Point
& p
, const typename
Variant::Piece
& piece
, bool use_drop
, bool show
) {
45 WrappedPiece
<Variant
> wpiece(piece
);
46 return m_graphical_api
->setSprite(p
, &wpiece
, use_drop
, show
);
49 virtual SpritePtr
getSprite(const Point
& p
) {
50 return m_graphical_api
->getSprite(p
);
53 virtual SpritePtr
takeSprite(const Point
& p
) {
54 return m_graphical_api
->takeSprite(p
);
57 virtual int poolSize(int pool
) {
58 return m_graphical_api
->poolSize(pool
);
61 virtual SpritePtr
insertPoolSprite(int pool
, int index
, const AbstractPiece
& piece
) {
62 WrappedPiece
<Variant
> wpiece(piece
);
63 return m_graphical_api
->insertPoolSprite(pool
, index
, &wpiece
);
66 virtual SpritePtr
getPoolSprite(int pool
, int index
) {
67 return m_graphical_api
->getPoolSprite(pool
, index
);
70 virtual SpritePtr
takePoolSprite(int pool
, int index
) {
71 return m_graphical_api
->takePoolSprite(pool
, index
);
75 #endif //UNWRAPPEDGRAPHICALAPI_H