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
15 * This class moves the interface that will be used by the animator to modify
16 * kboard graphics into the variant's semantics.
18 template <typename Variant
>
19 class UnwrappedGraphicalAPI
{
20 GraphicalAPI
* m_graphical_api
;
22 UnwrappedGraphicalAPI(GraphicalAPI
* interface
)
23 : m_graphical_api(interface
) {
26 virtual const PointConverter
* converter() {
27 return m_graphical_api
->converter();
30 virtual const typename
Variant::Position
* position() {
31 const WrappedPosition
<Variant
> *p
= dynamic_cast<const WrappedPosition
<Variant
>*>(m_graphical_api
->position());
35 MISMATCH(m_graphical_api
->position(), WrappedPosition
<Variant
>);
40 virtual SpritePtr
setSprite(const Point
& p
, const typename
Variant::Piece
& piece
, bool use_drop
, bool show
) {
41 WrappedPiece
<Variant
> wpiece(piece
);
42 return m_graphical_api
->setSprite(p
, &wpiece
, use_drop
, show
);
45 virtual SpritePtr
getSprite(const Point
& p
) {
46 return m_graphical_api
->getSprite(p
);
49 virtual SpritePtr
takeSprite(const Point
& p
) {
50 return m_graphical_api
->takeSprite(p
);
53 virtual SpritePtr
insertPoolSprite(int index
, const AbstractPiece
& piece
) {
54 WrappedPiece
<Variant
> wpiece(piece
);
55 return m_graphical_api
->insertPoolSprite(index
, &wpiece
);
58 virtual SpritePtr
getPoolSprite(int index
) {
59 return m_graphical_api
->getPoolSprite(index
);
62 virtual SpritePtr
takePoolSprite(int index
) {
63 return m_graphical_api
->takePoolSprite(index
);
67 #endif //UNWRAPPEDGRAPHICALAPI_H