-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSprite.h
52 lines (47 loc) · 1.09 KB
/
Sprite.h
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
//----------------------------------------------------------------------------------
//
// Basic Sprite Class
//
//
// Kevin M. Smith - CS 134 SJSU
#include "ofMain.h"
// This is a base object that all drawable object inherit from
// It is possible this will be replaced by ofNode when we move to 3D
//
class BaseObject {
public:
BaseObject();
ofVec2f trans, scale;
float rot;
bool bSelected;
void setPosition(ofVec3f);
};
// General Sprite class (similar to a Particle)
//
class Sprite : public BaseObject {
public:
Sprite();
void draw();
float age();
void setImage(ofImage);
float speed; // in pixels/sec
ofVec3f velocity; // in pixels/sec
ofImage image;
float birthtime; // elapsed time in ms
float lifespan; // time in ms
string name;
bool haveImage;
float width, height;
};
// Manages all Sprites in a system. You can create multiple systems
//
class SpriteSystem {
public:
void add(Sprite);
void remove(int);
void update();
int removeNear(ofVec3f point, float dist);
void draw();
vector<Sprite> sprites;
};