#include "ofApp.h"
void ofApp::setup(){
ofSetOrientation(OF_ORIENTATION_90_RIGHT);
counter = 0;
ofSetCircleResolution(50);
ofBackground(255,255,255);
bSmooth = false;
}
void ofApp::update(){
counter = counter + 0.033f;
}
void ofApp::draw(){
ofTranslate(0, -140, 0);
ofScale(0.7, 0.7, 1.0);
ofSetColor(255,130,0);
float radius = 50 + 10 * sin(counter);
ofFill();
ofDrawCircle(100,400,radius);
ofNoFill();
ofSetHexColor(0xCCCCCC);
ofDrawCircle(100,400,80);
ofSetHexColor(0x000000);
ofDrawBitmapString("circle", 75,500);
ofFill();
for (int i = 0; i < 200; i++){
ofSetColor((int)ofRandom(0,255),(int)ofRandom(0,255),(int)ofRandom(0,255));
ofDrawRectangle(ofRandom(250,350),ofRandom(350,450),ofRandom(10,20),ofRandom(10,20));
}
ofSetHexColor(0x000000);
ofDrawBitmapString("rectangles", 275,500);
ofSetHexColor(0x00FF33);
ofDrawRectangle(400,350,100,100);
ofEnableAlphaBlending();
ofSetColor(255,0,0,127);
ofDrawRectangle(450,430,100,33);
ofSetColor(255,0,0,(int)(counter * 10.0f) % 255);
ofDrawRectangle(450,370,100,33);
ofDisableAlphaBlending();
ofSetHexColor(0x000000);
ofDrawBitmapString("transparency", 410,500);
if (bSmooth){
ofEnableSmoothing();
}
ofSetHexColor(0xFF0000);
for (int i = 0; i < 20; i++){
ofDrawLine(600,300 + (i*5),800, 250 + (i*10));
}
if (bSmooth){
ofDisableSmoothing();
}
ofSetHexColor(0x000000);
ofDrawBitmapString("lines\ntouch to toggle smoothness", 600,500);
}
void ofApp::exit(){
}
void ofApp::touchDown(ofTouchEventArgs & touch){
bSmooth = true;
}
void ofApp::touchMoved(ofTouchEventArgs & touch){
}
void ofApp::touchUp(ofTouchEventArgs & touch){
bSmooth = false;
}
void ofApp::touchDoubleTap(ofTouchEventArgs & touch){
}
void ofApp::touchCancelled(ofTouchEventArgs & touch){
bSmooth = false;
}
void ofApp::lostFocus(){
}
void ofApp::gotFocus(){
}
void ofApp::gotMemoryWarning(){
}
void ofApp::deviceOrientationChanged(int newOrientation){
}
Comments