]> Dogcows Code - chaz/yoink/blob - src/Animation.hh
c8cdca8ed752c4b3addfdc4ee0ccd61906cabc19
[chaz/yoink] / src / Animation.hh
1
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
4 *
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
7 *
8 *****************************************************************************/
9
10 #ifndef _ANIMATION_HH_
11 #define _ANIMATION_HH_
12
13 /**
14 * @file Animation.hh
15 * Motion picture!!
16 */
17
18 #include <string>
19
20 #include <boost/shared_ptr.hpp>
21
22 #include <moof/math.hh>
23
24
25 class Animation;
26 typedef boost::shared_ptr<Animation> AnimationP;
27
28 /**
29 * A class to manage frame-based animation. Animation sequences can be
30 * loaded from file, then named sequences are started. The animation is
31 * updated periodically (each update cycle), and the correct current frame
32 * is determined. This class is generic enough that a frame can mean just
33 * about anything to whatever drawing context is used to render the frame.
34 */
35 class Animation
36 {
37 public:
38
39 Animation(const std::string& name);
40
41 static AnimationP alloc(const std::string& name)
42 {
43 return AnimationP(new Animation(name));
44 }
45
46 void startSequence(const std::string& name);
47
48 void update(moof::scalar t, moof::scalar dt);
49 unsigned getFrame() const;
50
51 private:
52
53 class impl;
54 boost::shared_ptr<impl> impl_;
55 };
56
57
58 #endif // _ANIMATION_HH_
59
This page took 0.031956 seconds and 3 git commands to generate.