Ejemplo n.º 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;
        }
Ejemplo n.º 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;
        }
Ejemplo n.º 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();
        }