forked from openframeworks/openFrameworks
-
Notifications
You must be signed in to change notification settings - Fork 4
/
testApp.mm
executable file
·111 lines (77 loc) · 2.66 KB
/
testApp.mm
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "testApp.h"
//--------------------------------------------------------------
void testApp::setup(){
ofxiPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);
bikers.loadImage("images/bikers.jpg");
gears.loadImage("images/gears.gif");
tdf.loadImage("images/tdf_1972_poster.jpg");
tdfSmall.loadImage("images/tdf_1972_poster.jpg");
tdfSmall.resize(tdf.width / 4, tdf.height / 4);
tdfSmall.setImageType(OF_IMAGE_GRAYSCALE);
transparency.loadImage("images/transparency.png");
bikeIcon.loadImage("images/bike_icon.png");
bikeIcon.setImageType(OF_IMAGE_GRAYSCALE);
}
//--------------------------------------------------------------
void testApp::update(){
ofBackground(255,255,255);
}
//--------------------------------------------------------------
void testApp::draw(){
ofScale(0.5, 0.5, 1.0);
ofSetHexColor(0xFFFFFF);
bikers.draw(0,0);
gears.draw(600,0);
tdf.draw(600,300);
ofSetHexColor(0xDD3333);
tdfSmall.draw(200,300);
ofSetHexColor(0xFFFFFF);
ofEnableAlphaBlending();
transparency.draw(sin(ofGetElapsedTimeMillis()/1000.0f) * 100 + 500,20);
ofDisableAlphaBlending();
ofSetHexColor(0x000000);
// getting the pixels out of an image,
// and then use the values to draw circles
unsigned char * pixels = bikeIcon.getPixels();
int w = bikeIcon.width;
int h = bikeIcon.height;
for (int i = 0; i < w; i++){
for (int j = 0; j < h; j++){
int value = pixels[j * w + i];
float pct = 1 - (value / 255.0f);
ofCircle(i*10,500 + j*10,1 + 5*pct);
}
}
ofSetHexColor(0xFFFFFF);
bikeIcon.draw(300,500, 20,20);
}
//--------------------------------------------------------------
void testApp::exit(){
}
//--------------------------------------------------------------
void testApp::touchDown(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::touchMoved(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::touchUp(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::touchDoubleTap(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::touchCancelled(ofTouchEventArgs & touch){
}
//--------------------------------------------------------------
void testApp::lostFocus(){
}
//--------------------------------------------------------------
void testApp::gotFocus(){
}
//--------------------------------------------------------------
void testApp::gotMemoryWarning(){
}
//--------------------------------------------------------------
void testApp::deviceOrientationChanged(int newOrientation){
}