-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathParticle.cpp
More file actions
57 lines (43 loc) · 1.03 KB
/
Particle.cpp
File metadata and controls
57 lines (43 loc) · 1.03 KB
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
53
54
55
56
57
/*
* Particle.cpp
* openFrameworks
*
* Created by Joshua Walton on 6/14/08.
* Copyright 2008 Lab at Rockwell Group. All rights reserved.
*
*/
#include "Particle.h"
#include <iostream>
Particle::Particle(ofxVec3f _pos, int _timeToLive) {
origPos = _pos;
pos = origPos;
float tRan = ofRandom(10,100);
myWidth = tRan;
myHeight = tRan;
timeToLive = _timeToLive;
timeStarted = ofGetElapsedTimeMillis();
alpha = 200;
cout<<"MADE A PARTICLE"<<endl;
// load an image to use
//crystalImage.loadImage("glitter.png");
}
void Particle::update() {
vel = vel + acc;
pos = pos + vel;
//cout<<"IT WORKED"<<endl;
//cout<<"test "<<acc.x<<endl;
//cout<<"pos: "<<pos.x<<endl;
}
void Particle::draw() {
glPushMatrix();
glTranslated((pos.x - (myWidth/2)), (pos.y - (myHeight/2)), pos.z);
//cout<<"IT WORKED"<<endl;
ofSetColor(255, ofRandom(120,255), ofRandom(120,255));
glEnable( GL_BLEND );
//crystalImage.draw(0,0, myWidth, myHeight);
ofCircle(0,0,myWidth);
glPopMatrix();
}
void Particle::recycle() {
pos = origPos;
}