summaryrefslogtreecommitdiff
path: root/vfg/src/Puppet.h
blob: 7ee80ee9ea6c5d155b991a2fddb2698039135742 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#ifndef PUPPET_H
#define PUPPET_H

#include "ofMain.h"
#include "ofxSprite.h"
#include "ofxXmlSettings.h"

/*
"base" clip will be drawn unless another clip is playing

TODO: make resolution independent
*/

class puppetSprite: public ofxSprite {
	public:
	void draw(float x, float y, float scale) {
		getCurrentImage().draw(x-(anchorPoint.x*scale),y-(anchorPoint.y*scale),getWidth()*scale,getHeight()*scale);
	}
};

class Puppet
{
    public:
        Puppet();
        virtual ~Puppet();
        void load(string filename);
        void play(string clip);
        void playNow(string clip);
        void draw(float x, float y, float scale=1.0f);
        bool isPlaying();
    protected:
    private:
        map<string,puppetSprite> clips;
        deque<string> playlist;
};

#endif // PUPPET_H