
Get it from the iTunes App Store here.

Made with openFrameworks.
‘openFrameworks’ カテゴリーのアーカイブ
iPhone App : cloOOck ver.1.1
2010年5月23日 日曜日
iPhone : onTimerをopenFrameworksで。
2010年5月6日 木曜日
openFrameworksでTimer処理ってなるとPocoってライブラリを使うっぽいですがiPhoneでは使えなさそうでしたのでObjective-C++でやってみました。最終的には実装しませんでしたがメモ代わりに残しておこうかと。
Appleのリファレンスを読みながらObjective-CからC++のメソッドを呼び出してみたわけですが、まぁ面倒なことです。
testApp.h
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | 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 lostFocus(); void gotFocus(); void gotMemoryWarning(); id intervalTimer; void onTimer(); }; |
testApp.mm
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 | class testApp; @interface IntervalTimer : NSObject { testApp *_testapp; } -( id )init:(testApp *)testapp; -( void )onTimer:( NSTimer * )timer; @end @implementation IntervalTimer -( void )dealloc { [super dealloc]; delete _testapp; } -( id )init:(testApp *)testapp { [super init]; _testapp = testapp; /* Interval : 1 / 10 */ [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(onTimer:) userInfo:nil repeats:YES]; return self; } -( void )onTimer:( NSTimer * )timer { _testapp->onTimer(); } @end void testApp::setup() { // register touch events ofRegisterTouchEvents(this); // initialize the accelerometer ofxAccelerometer.setup(); //iPhoneAlerts will be sent to this. ofxiPhoneAlerts.addListener(this); intervalTimer = [[IntervalTimer alloc] init:this]; [intervalTimer release]; } void testApp::onTimer() { } |
openFrameworksはじめました。
2010年2月27日 土曜日
openFrameworksを勉強しはじめてたんだけど、よいタイミングで本が出たので購入。
openFrameworksをいろいろさわっていくと、どうしてもC++わからないとやりたいことができなかったりだったので、一念発起してC++もあわせて勉強中です。
こうなるとC++にくわえて、OpenGL、OpenCv、Objective-Cと勉強したいことばかりになってきた。
あせるあせる。