Beispiel #1
0
        /// 実行メイン
        public void Run(string[] args)
        {
            /// 初期化
            init();

            while (loop)
            {
                /// アプリケーションの状態を更新
                SystemEvents.CheckEvents();

                /// Fps制御
                long currTime = stopwatch.ElapsedMilliseconds;
                long diffTime = currTime - prevFpsTime;

                if (diffTime < waitFpsTime && (waitFpsTime - diffTime) < waitFpsTime)
                {
                    Thread.Sleep((int)(waitFpsTime - diffTime));
                }

                /// FPSを計測
                currTime = stopwatch.ElapsedMilliseconds;
                if ((currTime - prevFpsTime) > 0)
                {
                    nowMs  = (currTime - prevFpsTime);
                    nowFps = 1000.0f / nowMs;
                }
                else
                {
                    nowMs  = (currTime - prevFpsTime);
                    nowFps = 0.0f;
                }

                prevFpsTime = currTime;

                // 入力情報更新
                inputTouch.Update();
                inputGPad.Update();

                /// 更新&描画
                update();
                render();
            }

            /// 破棄
            term();
        }