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 HLVARIANT__ANIMATOR_H
12 #define HLVARIANT__ANIMATOR_H
14 #include "animation.h"
16 #include "variantdata.h"
20 class AnimationFactory
;
26 * Can be used as a base class for other specialized animators.
28 template <typename _Variant
>
31 typedef _Variant Variant
;
33 typedef typename UnwrappedGraphicalAPIPtr
<Variant
>::type API
;
34 typedef typename VariantData
<Variant
>::GameState GameState
;
35 typedef typename VariantData
<Variant
>::Move Move
;
36 typedef typename VariantData
<Variant
>::Piece Piece
;
39 BaseAnimator(API cinterface
)
40 : m_cinterface(cinterface
) { }
41 virtual ~BaseAnimator() { }
43 virtual AnimationGroupPtr
warp(const GameState
& final
);
44 virtual AnimationGroupPtr
forward(const GameState
& final
, const Move
& move
);
45 virtual AnimationGroupPtr
back(const GameState
& final
, const Move
& move
);
49 template <typename _Variant
>
50 class SimpleAnimator
: BaseAnimator
<_Variant
> {
52 typedef _Variant Variant
;
54 typedef BaseAnimator
<Variant
> Base
;
56 typedef typename
Base::API API
;
57 typedef typename
Base::GameState GameState
;
58 typedef typename
Base::Move Move
;
59 typedef typename
Base::Piece Piece
;
61 using Base::m_cinterface
;
63 virtual SchemePtr
movement(const NamedSprite
& sprite
, const Point
& from
, const Point
& to
);
65 SimpleAnimator(API cinterface
)
66 : Base(cinterface
) { }
68 virtual AnimationGroupPtr
warp(const GameState
& final
);
69 virtual AnimationGroupPtr
forward(const GameState
& final
, const Move
& move
);
70 virtual AnimationGroupPtr
back(const GameState
& final
, const Move
& move
);
75 #endif // HLVARIANT__ANIMATOR_H