#include "testApp.h" #include "ofMain.h" //-------------------------------------------------------------- void testApp::setup(){ // macs by default run on non vertical sync, which can make animation very, very fast // this fixes that: ofSetVerticalSync(true); ofSetFrameRate(60); // set background: ofBackground(0,0,0); angle = 0; } //-------------------------------------------------------------- void testApp::update(){ angle += (0.07f); } //-------------------------------------------------------------- void testApp::draw(){ float origX = ofGetWidth()/2; float origY = ofGetHeight()/2; float radius = 100; float xPos = origX + radius * cos(angle*pctMouseX); float yPos = origY + (radius * sin(angle*pctMouseY)) * -1; // since 0,0 is top left corner.... PR.addPoint( ofPoint(xPos, yPos, 0) ); ofFill(); ofSetColor(255,255,255); //ofCircle(xPos, yPos, 7); PR.draw(); // debug char debugTxt[1024]; sprintf(debugTxt, "pct X: %f\npct Y: %f", pctMouseX, pctMouseY); ofDrawBitmapString(debugTxt, 20, 40); } //-------------------------------------------------------------- void testApp::keyPressed (int key){ } //-------------------------------------------------------------- void testApp::keyReleased (int key){ } //-------------------------------------------------------------- void testApp::mouseMoved(int x, int y ){ pctMouseX = (float) mouseX / (float) ofGetWidth(); pctMouseY = (float) mouseY / (float) ofGetHeight(); } //-------------------------------------------------------------- void testApp::mouseDragged(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mousePressed(int x, int y, int button){ } //-------------------------------------------------------------- void testApp::mouseReleased(){ }