-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathexampleScene.cpp
More file actions
52 lines (26 loc) · 1.06 KB
/
exampleScene.cpp
File metadata and controls
52 lines (26 loc) · 1.06 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
#include "exampleScene.h"
void exampleScene::setup(){
angle.set("angle", 0, -180, 180);
width.set("width", 100, 20, 400);
parameters.add(angle);
parameters.add(width);
loadCode("exampleScene/exampleCode.cpp");
setSceneName("exampleScene");
}
void exampleScene::update(){
// arbitrarily wiggle things up.... so we can see if this works.
// later
angle = angle.getMin() + ofMap(sin(ofGetElapsedTimef()*0.5), -1, 1, 0, 1) * (angle.getMax() - angle.getMin());
// width = width.getMin() + ofMap(sin(ofGetElapsedTimef()*0.7), -1, 1, 0, 1) * (width.getMax() - width.getMin());
}
void exampleScene::draw(){
ofSetRectMode(OF_RECTMODE_CENTER);
ofPushMatrix();
ofTranslate(dimensions.width/2, dimensions.height/2);
ofRotate(angle);
ofDrawRectangle(0, 0, width, 40);
ofPopMatrix();
ofSetRectMode(OF_RECTMODE_CORNER);
ofLine(0, 0, dimensions.width, dimensions.height);
ofLine(0, dimensions.height, dimensions.width, 0);
}