示例#1
0
        public void StartUpdateProcessing(out ChangeBuffer updateBuffer, out GameTime gameTime)
        {
            //wait for start signal
            updateFrameStart.WaitOne();
            Thread.MemoryBarrier();

            //get the update buffer
            updateBuffer = buffers[currentUpdateBuffer];

            //get the game time
            gameTime = this.gameTime;
        }
示例#2
0
        public void StartRenderProcessing(out ChangeBuffer renderBuffer, out GameTime gameTime)
        {
            //wait for start signal
            renderFrameStart.WaitOne();
            Thread.MemoryBarrier();

            //get the render buffer
            renderBuffer = buffers[currentRenderBuffer];

            //ret the game time
            gameTime = this.gameTime;
        }
示例#3
0
        public DoubleBuffer()
        {
            //create the buffers
            buffers    = new ChangeBuffer[2];
            buffers[0] = new ChangeBuffer();
            buffers[1] = new ChangeBuffer();

            //create the WaitHandlers
            renderFrameStart = new AutoResetEvent(false);
            renderFrameEnd   = new AutoResetEvent(false);
            updateFrameStart = new AutoResetEvent(false);
            updateFrameEnd   = new AutoResetEvent(false);

            //reset the values
            Reset();
        }