Last active
December 23, 2015 23:38
-
-
Save tado/6710857 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 "Particle.h" | |
| void Particle::setup(ofVec2f _position){ | |
| position = _position; | |
| } | |
| void Particle::draw(){ | |
| ofSetHexColor(0x3399cc); | |
| ofCircle(position, 10); | |
| } |
This file contains hidden or 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
| #pragma once | |
| #include "ofMain.h" | |
| class Particle { | |
| public: | |
| ofVec2f position; | |
| void setup(ofVec2f position); | |
| void draw(); | |
| }; |
This file contains hidden or 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); | |
| ofBackground(63); | |
| for(int i = 0; i < NUM; i++){ | |
| float posX = ofRandom(ofGetWidth()); | |
| float posY = ofRandom(ofGetHeight()); | |
| particle[i].setup(ofVec2f(posX, posY)); | |
| } | |
| } | |
| //-------------------------------------------------------------- | |
| void testApp::update(){ | |
| } | |
| //-------------------------------------------------------------- | |
| void testApp::draw(){ | |
| // 設定した場所に円を描く | |
| for(int i = 0; i < NUM; i++){ | |
| particle[i].draw(); | |
| } | |
| } |
This file contains hidden or 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
| #pragma once | |
| #include "ofMain.h" | |
| #include "Particle.h" | |
| 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); | |
| void dragEvent(ofDragInfo dragInfo); | |
| void gotMessage(ofMessage msg); | |
| static const int NUM = 100; | |
| Particle particle[NUM]; | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment