[ Video ]
[ About ]
ハリネズミを飼い始めました。
I started to keep a hedgehog.
[ Source ]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#include "ofMain.h" class ofApp : 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 mouseEntered(int x, int y) {}; void mouseExited(int x, int y) {}; void windowResized(int w, int h) {}; void dragEvent(ofDragInfo dragInfo) {}; void gotMessage(ofMessage msg) {}; ofImage uni_chan; ofTrueTypeFont font; ofVec2f font_size_1, font_size_2; string message_1 = "New Family!!"; string message_2 = "Hedgehog"; }; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
#include "ofApp.h" //-------------------------------------------------------------- void ofApp::setup() { ofSetFrameRate(60); ofBackground(255); ofSetWindowTitle("Insta"); ofNoFill(); ofSetLineWidth(3); this->font.loadFont("fonts/Kazesawa-Bold.ttf", 48); this->font_size_1.x = this->font.stringWidth(message_1); this->font_size_1.y = this->font.stringHeight(message_1); this->font_size_2.x = this->font.stringWidth(message_2); this->font_size_2.y = this->font.stringHeight(message_2); this->uni_chan.loadImage("uni.png"); } //-------------------------------------------------------------- void ofApp::update() { } //-------------------------------------------------------------- void ofApp::draw() { this->font.drawString(message_1, ofGetWidth() / 2 - this->font_size_1.x / 2, ofGetHeight() / 5 - this->font_size_1.y / 2); this->font.drawString(message_2, ofGetWidth() / 2 - this->font_size_2.x / 2, ofGetHeight() / 5 + this->font_size_2.y / 2); ofSetColor(255); this->uni_chan.draw(ofGetWidth() / 2 - this->uni_chan.getWidth() / 2 - 20, ofGetHeight() - this->uni_chan.getHeight()); float radius = 300; float x, y; float noise_value; ofVec2f position; ofSetColor(0); ofTranslate(ofGetWidth() / 2, ofGetHeight() / 2 + this->uni_chan.getHeight() / 3); ofBeginShape(); for (int deg = 0; deg < 360; deg += 10) { position = ofVec2f(radius * cos(deg * DEG_TO_RAD), radius * sin(deg * DEG_TO_RAD)); noise_value = ofNoise(ofGetFrameNum() * 0.05) * 0.5; if (deg % 20 == 0) { ofVertex(position.x * (0.8 + noise_value), position.y * (0.8 + noise_value)); } else { ofVertex(position.x * 0.8, position.y * 0.8); } } ofEndShape(true); } //-------------------------------------------------------------- int main() { ofSetupOpenGL(720, 720, OF_WINDOW); ofRunApp(new ofApp()); } |