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.
14 #include <boost/shared_ptr.hpp>
15 #include "animation.h"
20 class GraphicalPosition
;
23 * A variant-agnostic animator.
24 * Can be used as a base class for other specialized animators.
26 template <typename Variant
>
27 class SimpleAnimator
{
29 typedef boost::shared_ptr
<AnimationGroup
> AnimationPtr
;
30 typedef GenericGraphicalPosition
<Variant
> GPosition
;
31 typedef typename WrappedGraphicalPosition
<Variant
>::GElement GElement
;
32 typedef typename
Variant::Position Position
;
33 typedef typename
Variant::Piece Piece
;
34 typedef typename
Variant::Move Move
;
36 PointConverter
* m_converter
;
37 boost::shared_ptr
<GPosition
> m_position
;
45 virtual boost::shared_ptr
<MovementAnimation
>
46 createMovementAnimation(const GElement
& element
, const QPoint
& destination
);
48 virtual boost::shared_ptr
<Animation
> createCapture(const Point
& p
,
49 const GElement
& piece
,
50 const GElement
& captured
,
53 virtual void finalizeBackAnimation(AnimationPtr
,
56 virtual void finalizeForwardAnimation(AnimationPtr
,
60 SimpleAnimator(PointConverter
* converter
, const boost::shared_ptr
<GPosition
>& position
);
61 virtual ~SimpleAnimator() { }
62 AnimationPtr
warp(const Position
&);
63 AnimationPtr
forward(const Position
&, const Move
& move
);
64 AnimationPtr
back(const Position
&, const Move
& move
);