-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdefault.cpp
52 lines (39 loc) · 955 Bytes
/
default.cpp
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 "ofMain.h"
class testApp: public ofBaseApp {
public:
void setup() {
ofSetCurrentRenderer(ofPtr<ofBaseRenderer>(new ofGLRenderer(false)));
ofSetFrameRate(60);
ofBackground(0, 0, 0);
ofSetVerticalSync(true);
ofEnableAlphaBlending();
ofSetWindowShape(640, 380);
ofSetWindowPosition(0,0);
}
void draw() {
for(int j = 0; j < 10; j++) {
ofSetColor(j*25, 20-j*10, 100-j*25, 255);
ofBeginShape();
ofVertex(ofGetWidth(), 0);
ofVertex(0,0);
for(int i = 0; i < ofGetWidth(); i+=4) {
float xRange = ofGetHeight() - j*40;
float freq = 100.f +pow(j, 2.5);
float y = ofMap(sin(ofGetElapsedTimef()+i/freq), -1, 1, xRange, xRange+100);
ofVertex(i, y);
}
ofEndShape();
}
}
void keyPressed(int key) {
if(key=='f') {
ofToggleFullscreen();
}
}
};
// required by livecode-c++ to workls
extern "C" {
ofBaseApp *getAppPtr(ofAppBaseWindow *win) {
return new testApp();
}
};