openframeworks ios 入門

Download openFrameworks iOS 入門

Post on 27-May-2015

2.370 views

Category:

Documents

3 download

Embed Size (px)

TRANSCRIPT

  • 1. iTamabi13 openFrameworks iOS 2013916

2. iPhone SDK + openFrameworks !! + 3. openFrameworks (for iPhone) 4. openFrameworks ? C++ http://openframeworks.cc/ 5. 2004Zachary Lieberman Zachary LiebermanTheo WatsonArturo Castro 6. Zachary Lieberman 7. openFrameworks ? !! ...etc. openFrameworks (=) 8. oF main.cpp testApp.h testApp.cpp openGL GLUT freeimage freetype fmod rtaudio quicktime openCV ofSimpleApp, ofGraphics, ofImage, ofTruTypeFont, ofVidePlayer, ofVideoGrabber, ofTexture, ofSoundPlayer, ofSoundStream, ofSerial, ofMath, ofUtils OpenFrameworks 9. !! Macof_preRelease_v007_iphone/apps/ iPhoneExamples/XCode .xcodeproj Xcode iPhone 10. !! Run () iOS () 11. Simulator!! advancedGraphics 12. apps > iPhoneExamples > emptyExample apps > iPhoneExamples > emptyExample apps > iTamabi_example110524 > emptyExample 13. OpneFrameworks testApp.htestApp.mm !! main.cpp testApp.h testApp.cpp openGL GLUT freeimage freetype fmod rtaudio quicktime openCV ofSimpleApp, ofGraphics, ofImage, ofTruTypeFont, ofVidePlayer, ofVideoGrabber, ofTexture, ofSoundPlayer, ofSoundStream, ofSerial, ofMath, ofUtils OpenFrameworks 14. ! testApp.mm ! 15. 2 testApp.h - () testApp.mm - 16. 3 3 setup - update - draw - ... 17. #pragma once #include "ofMain.h" #include "ofxiPhone.h" #include "ofxiPhoneExtras.h" class testApp : public ofxiPhoneApp { ! public: ! void setup(); ! void update(); ! void draw(); ! void exit(); ! ! void touchDown(ofTouchEventArgs &touch); ! void touchMoved(ofTouchEventArgs &touch); ! void touchUp(ofTouchEventArgs &touch); ! void touchDoubleTap(ofTouchEventArgs &touch); ! void touchCancelled(ofTouchEventArgs &touch); ! ! void lostFocus(); ! void gotFocus(); ! void gotMemoryWarning(); ! void deviceOrientationChanged(int newOrientation); ! }; testApp.h testApp.h 18. #pragma once #include "ofMain.h" #include "ofxiPhone.h" #include "ofxiPhoneExtras.h" class testApp : public ofxiPhoneApp { ! public: ! void setup(); ! void update(); ! void draw(); ! void exit(); ! ! void touchDown(ofTouchEventArgs &touch); ! void touchMoved(ofTouchEventArgs &touch); ! void touchUp(ofTouchEventArgs &touch); ! void touchDoubleTap(ofTouchEventArgs &touch); ! void touchCancelled(ofTouchEventArgs &touch); ! ! void lostFocus(); ! void gotFocus(); ! void gotMemoryWarning(); ! void deviceOrientationChanged(int newOrientation); ! }; testApp.h testApp.h 19. #pragma once #include "ofMain.h" #include "ofxiPhone.h" #include "ofxiPhoneExtras.h" class testApp : public ofxiPhoneApp { ! public: ! void setup(); ! void update(); ! void draw(); ! void exit(); ! ! void touchDown(ofTouchEventArgs &touch); ! void touchMoved(ofTouchEventArgs &touch); ! void touchUp(ofTouchEventArgs &touch); ! void touchDoubleTap(ofTouchEventArgs &touch); ! void touchCancelled(ofTouchEventArgs &touch); ! ! void lostFocus(); ! void gotFocus(); ! void gotMemoryWarning(); ! void deviceOrientationChanged(int newOrientation); ! }; testApp.h testApp.h 20. #include "testApp.h" //-------------------------------------------------------------- void testApp::setup(){! ! // register touch events ! ofRegisterTouchEvents(this); ! ! // initialize the accelerometer ! ofxAccelerometer.setup(); ! ! //iPhoneAlerts will be sent to this. ! ofxiPhoneAlerts.addListener(this); ! ! //If you want a landscape oreintation ! //iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT); ! ! ofBackground(127,127,127); } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ ! } testApp.mm testApp.mm 21. #include "testApp.h" //-------------------------------------------------------------- void testApp::setup(){! ! // register touch events ! ofRegisterTouchEvents(this); ! ! // initialize the accelerometer ! ofxAccelerometer.setup(); ! ! //iPhoneAlerts will be sent to this. ! ofxiPhoneAlerts.addListener(this); ! ! //If you want a landscape oreintation ! //iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT); ! ! ofBackground(127,127,127); } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ ! } testApp.mm testApp.mm 22. #include "testApp.h" //-------------------------------------------------------------- void testApp::setup(){! ! // register touch events ! ofRegisterTouchEvents(this); ! ! // initialize the accelerometer ! ofxAccelerometer.setup(); ! ! //iPhoneAlerts will be sent to this. ! ofxiPhoneAlerts.addListener(this); ! ! //If you want a landscape oreintation ! //iPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT); ! ! ofBackground(127,127,127); } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ ! } testApp.mm testApp.mm 23. ! 24. ! ( = x, y) ! (x,y) r 25. ! openFrameworks ofCircle (x, y, ); ofCircle (100, 200, 50); (100, 200) 50 26. #include "testApp.h" //-------------------------------------------------------------- void testApp::setup(){! ! // iPhone ! ofRegisterTouchEvents(this); ! ofxAccelerometer.setup(); ! ofxiPhoneAlerts.addListener(this); ! ! // ! ofBackground(0,0,0); } //-------------------------------------------------------------- void testApp::update(){ } //-------------------------------------------------------------- void testApp::draw(){ ! // ! ofCircle(160, 240, 50); } !! testApp.mm 1 27. !! ! 28. ? ... (Pixel) 29. ? R() G() B() () 30. ? openFrameworks ? ofSetColor ofSetColor (Red, Green, Blue, Alpha); 0 255 Alpha ofSetColor(0, 127, 255, 127); 31. // void testApp::draw(){ ! // 2 ! ofEnableAlphaBlending(); ! ofSetColor(0, 127, 255, 200); ! ofCircle(130, 240, 50); ! ofSetColor(255, 127, 0, 200); ! ofCircle(190, 240, 50); } // !! testApp.mm - draw( ) 32. !! ! 33. oF ? http://www.openframeworks.cc/documentation oF 34. Lets Try! iPhone () !! 35. ? setupupdatedraw : setup : update : draw 36. ! 01_03_RotateCircles