コード例 #1
0
ファイル: Game.cs プロジェクト: pekkah/oglesv2cf
        private bool RunGameLoop()
        {
            while (!NativeCore.PeekMessage(out this.message, IntPtr.Zero, 0, 0, 0))
            {
                NativeCore.QueryPerformanceCounter(ref this.updateEndCount);
                this.updateDeltaCount   = this.updateEndCount - this.updateStartCount;
                this.updateDeltaSeconds = this.updateDeltaCount / (double)this.counterFrequency;

                if (this.updateDeltaSeconds >= this.requestedUpdateDelta)
                {
                    this.Update(this.updateDeltaSeconds);
                    NativeCore.QueryPerformanceCounter(ref this.updateStartCount);
                }

                NativeCore.QueryPerformanceCounter(ref this.renderEndCount);
                this.renderDeltaCount   = this.renderEndCount - this.renderStartCount;
                this.renderDeltaSeconds = this.renderDeltaCount / (double)this.counterFrequency;

                if (this.renderDeltaSeconds >= this.requestedRenderDelta)
                {
                    this.Render(this.renderDeltaSeconds);
                    NativeCore.QueryPerformanceCounter(ref this.renderStartCount);
                }
            }

            this.OnHandleMessage(this.message);

            return(this.ExitGame);
        }
コード例 #2
0
ファイル: Game.cs プロジェクト: pekkah/oglesv2cf
        private void RunApplication()
        {
            NativeCore.QueryPerformanceFrequency(ref this.counterFrequency);

            NativeCore.QueryPerformanceCounter(ref this.updateStartCount);

            this.updateEndCount = this.updateStartCount;

            this.renderStartCount = this.updateEndCount;
            this.renderEndCount   = this.renderStartCount;

            while (!this.RunGameLoop())
            {
                Application.DoEvents();
            }

            Application.DoEvents();

            Application.Exit();
        }