/** * メインループ部分です。 */ void mainLoop(){ // 描画を一定周期ごとに行うためのカウンタ int plotTiming = 50; int plotCounter = 0; // メインループ while(true){ // 状態の更新処理(力学シミュレーション) update(); // plotTiming回に一回、グラフを描画する if(plotCounter == plotTiming){ // 状態をグラフに描画 setGraph2DData(graph, vertexX, vertexY); // 少し待機(アニメーションウェイト) sleep(WAIT); // 描画タイミングのカウンタをリセット plotCounter = 0; } // 描画タイミングのカウンタを加算 plotCounter++; } }