Your SlideShare is downloading. ×
0
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Sbaw090519
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Sbaw090519

4,035

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
4,035
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
32
Comments
0
Likes
1
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide









































  • Transcript

    • 1. #import quot;GraphView.hquot; // AppDelegate class interface. @interface AppDelegate : NSObject <UIAccelerometerDelegate> { IBOutlet UIWindow *window; IBOutlet GraphView *graphView; IBOutlet UIToolbar *toolbar; } @property (nonatomic, retain) UIWindow *window; @property (nonatomic, retain) GraphView *graphView; @property (nonatomic, retain) UIToolbar *toolbar; - (IBAction)toggleRun:(id)sender; - (IBAction)toggleFiltering:(id)sender;
    • 2. #include quot;testApp.hquot; //-------------------------------------------------------------- void testApp::setup(){ } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ // ofSetColor(63, 127, 255); // ofCircle(ofGetWidth() / 2, ofGetHeight() / 2, 100); }
    • 3. #ifndef _TEST_APP #define _TEST_APP #include quot;ofMain.hquot; class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); ... ( ) ... private: float posX, posY; float speedX, speedY; }; #endif
    • 4. #include quot;testApp.hquot; void testApp::draw(){ // void testApp::setup(){ ofSetColor(63, 127, 255); ofBackground(0,0,0); // posX = ofGetWidth() / 2; posY = ofGetHeight() / 2; ofCircle(posX, posY, 100); speedX = ofRandom(-5, 5); } speedY = ofRandom(-5, 5); } void testApp::update(){ posX += speedX; if(posX < 0 || posX > ofGetWidth()){ speedX *= -1; } posY += speedY; if(posY < 0 || posY > ofGetHeight()){ speedY *= -1; } }
    • 5. #ifndef _TEST_APP #define _TEST_APP #include quot;ofMain.hquot; #define BALL_NUM 100 class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); private: float posX[BALL_NUM], posY[BALL_NUM]; float speedX[BALL_NUM], speedY[BALL_NUM]; }; #endif
    • 6. #include quot;testApp.hquot; //-------------------------------------- void testApp::setup(){ ofBackground(0,0,0); for(int i = 0; i < BALL_NUM; i++){ posX[i] = ofGetWidth() / 2; posY[i] = ofGetHeight() / 2; speedX[i] = ofRandom(-1, 1); speedY[i] = ofRandom(-1, 1); } } //-------------------------------------- void testApp::update(){ for(int i = 0; i < BALL_NUM; i++){ posX[i] += speedX[i]; if(posX[i] < 0 || posX[i] > ofGetWidth()){ speedX[i] *= -1; } posY[i] += speedY[i]; if(posY[i] < 0 || posY[i] > ofGetHeight()){ speedY[i] *= -1; } } }
    • 7. //-------------------------------------- void testApp::draw(){ for(int i = 0; i < BALL_NUM; i++){ // ofSetColor(63, 127, 255); // ofCircle(posX[i], posY[i], 20); } } ... ( )
    • 8. #ifndef _TEST_APP #define _TEST_APP #include quot;ofMain.hquot; #define BALL_NUM 100 class testApp : public ofBaseApp{ public: void setup(); void update(); void draw(); void keyPressed(int key); void keyReleased(int key); void mouseMoved(int x, int y ); void mouseDragged(int x, int y, int button); void mousePressed(int x, int y, int button); void mouseReleased(int x, int y, int button); void windowResized(int w, int h); private: float posX[BALL_NUM], posY[BALL_NUM]; float speedX[BALL_NUM], speedY[BALL_NUM]; }; #endif
    • 9. #include quot;testApp.hquot; //-------------------------------------- void testApp::setup(){ ofBackground(0,0,0); for(int i = 0; i < BALL_NUM; i++){ posX[i] = ofGetWidth() / 2; posY[i] = ofGetHeight() / 2; speedX[i] = ofRandom(-1, 1); speedY[i] = ofRandom(-1, 1); } } //-------------------------------------- void testApp::update(){ for(int i = 0; i < BALL_NUM; i++){ posX[i] += speedX[i]; if(posX[i] < 0 || posX[i] > ofGetWidth()){ speedX[i] *= -1; } posY[i] += speedY[i]; if(posY[i] < 0 || posY[i] > ofGetHeight()){ speedY[i] *= -1; } } }
    • 10. //-------------------------------------- void testApp::draw(){ for(int i = 0; i < BALL_NUM; i++){ // ofSetColor(63, 127, 255); // ofCircle(posX[i], posY[i], 20); } } ... ( )

    ×