* 実装メモ [#nc172af3] #contents ** 2011/03/08 G3Dの初期設定 [#z9a61350] |項目|初期値|h |viewport|メインスクリーンのサイズいっぱい| |clearColor|RGBA(0.0,0.0,0.0,0.0)| |colorUpdate|enable| |clearDepth|1.0| |depthUpdate|enable| |depthCompare|always| |mtxProj|ortho l-r(-1,1) b-t(-1,1) n-f(0,1)| |mtxView|identity| ** 2011/03/06 iOSのエントリーポイント [#x1600cb2] こんな感じかな。 #code(c,){{ int main() { // Macと同じように引数解釈 // ... // C++のコードに移動 return mainC( ... ); } int mainC( Arg aArg ) { // xmainスレッド作成 // ... // UIMain実行 // ... // xmainスレッドの完了待ち // ... // 終了 } int xmainThreadEntryPoint( Arg* aArgPtr ) { // 起動完了待ち waitSignal(); // UIMainからSignalが来るのを待つ // ここにくるのはDidFinishedLaunchのタイミング // xmain起動 int result = 0; { // Application作成 Application app( *aArgPtr ); // xmain呼び出し result = xmain( app ); } // ここにくるのはapplicationWillTerminate // UIMainに終了したことを伝達 signalToUIMain(); // 何も待たずスレッド終了 return result; } }} スレッドでUIViewとかUIWindowを作っても表示されないところで数時間はまった。 スレッドがexitせずにsleepする状態だと怒るらしい。 スレッドを寝かす前に CATransaction::flush() で明示的にCoreAnimationを更新してやるといけた。 正しい方法かどうかは不明…。 ** 2011/03/05 iOS対応どうやろう [#fd178c92] 元々WinとMacのクロスプラットフォームで考えていましたが 流行のiOSも対応させてみるのはおもしろそうと思いちょっと考えてみました。 iOS対応となると一番ネックなのがイベントドリブン式になるということ。 didFinishLaunchingWithOptions applicationWillTerminate applicationWillResignActive applicationDidBecomeActive 初期化・後始末・アクティブ化・非アクティブ化のイベント。 後は毎秒60回のイベントが流れてくると考えれば良さそうです。 …という要件からメインループを書いてみる。 #code(c,){{ int xmain() { Application app; bool doExit = false; while ( !doExit ) { Event event = app.eventReceive(); switch( event ) { case EventKind_Quit: doExit = true; break; case EventKind_BecomeActive: break; case EventKind_ResignActive: break; case EventKind_UpdateFrame: update(); draw(); break; default: break; } } } }} なんとかいけるかな? |