testApp.h
#pragma once #include "ofMain.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); ofSoundPlayer mySound1; ofSoundPlayer mySound2; ofImage myImage1; ofImage myImage2; };
testApp.cpp
#include "testApp.h" int cx1 = 300; int cy1 = 300; int cx2 = 700; int cy2 = 300; //-------------------------------------------------------------- void testApp::setup(){ ofBackground(255,255,255); myImage1.loadImage("disk.png"); myImage2.loadImage("disk.png"); } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ ofPushMatrix(); ofTranslate(cx1, cy1, 0);//move pivot to centre ofRotate(ofGetFrameNum(), 0, 0, 1);//rotate from centre myImage1.draw(-myImage1.width/2,-myImage1.height/2); ofPopMatrix(); ofPushMatrix(); ofTranslate(cx2, cy2, 0);//move pivot to centre ofRotate(ofGetFrameNum(), 0, 0, 1);//rotate from centre myImage1.draw(-myImage2.width/2,-myImage2.height/2); ofPopMatrix(); }