Created
December 6, 2011 11:29
-
-
Save companje/1437868 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "testApp.h" | |
//-------------------------------------------------------------- | |
void testApp::setup(){ | |
ofSetFrameRate(60); //limit framerate to 60 | |
ofSetBackgroundAuto(false); //turn off automatic background clearing | |
ofEnableAlphaBlending(); //enable transparency | |
ofBackground(0); //set background to black | |
ball.x = 100; //initial position for ball | |
ball.y = 200; | |
} | |
//-------------------------------------------------------------- | |
void testApp::update(){ | |
ball.x = ball.x + 5; //update position off ball | |
ball.y = ball.y + 5; | |
if (ball.x > ofGetWidth()) ball.x = 0; //if ball disappears let it appear again | |
if (ball.y > ofGetHeight()) ball.y = 0; | |
} | |
//-------------------------------------------------------------- | |
void testApp::draw(){ | |
//draw a semi transparent black rectangle | |
ofSetColor(0,20); | |
ofRect(0,0,ofGetWidth(),ofGetHeight()); | |
//draw a white circle | |
ofSetColor(255); | |
ofCircle(ball.x, ball.y, 50); | |
} | |
//-------------------------------------------------------------- | |
void testApp::keyPressed(int key){ | |
} | |
//-------------------------------------------------------------- | |
void testApp::keyReleased(int key){ | |
} | |
//-------------------------------------------------------------- | |
void testApp::mouseMoved(int x, int y ){ | |
} | |
//-------------------------------------------------------------- | |
void testApp::mouseDragged(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void testApp::mousePressed(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void testApp::mouseReleased(int x, int y, int button){ | |
} | |
//-------------------------------------------------------------- | |
void testApp::windowResized(int w, int h){ | |
} | |
//-------------------------------------------------------------- | |
void testApp::gotMessage(ofMessage msg){ | |
} | |
//-------------------------------------------------------------- | |
void testApp::dragEvent(ofDragInfo dragInfo){ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment