#include "testApp.h" //-------------------------------------------------------------- void testApp::setup(){ ofSetVerticalSync(true); ofSetFrameRate(60); // set background ofBackground(255, 255, 255); // set the position of the rectangle: elRect.pos.x = (ofGetWidth()/2); elRect.pos.y = (ofGetHeight()/2); elRect.speed = 0.0; } //-------------------------------------------------------------- void testApp::update(){ elRect.update(); // calc (assuming 72px = 1inch @ 60fps) float inPerSec = (elRect.speed*60.0f)/72.0f; float miPerHr = inPerSec * (3600.0f/63360.0f); // debug sprintf( debugTxt, "-/+= speed: %f\ninches/second: %f\nmiles/hour: %f", elRect.speed, inPerSec, miPerHr ); } //-------------------------------------------------------------- void testApp::draw(){ elRect.draw(); // debug ofSetColor(0x333333); ofDrawBitmapString(debugTxt, 20, 30); } //-------------------------------------------------------------- void testApp::keyPressed (int key){ elRect.changeSpeed(key); }