Exemplo n.º 1
0
        public DoubleBuffer()
        {
            // allocate buffers
            m_arrbuffers = new ChangeBuffer[2];
            m_arrbuffers[0] = new ChangeBuffer();
            m_arrbuffers[1] = new ChangeBuffer();

            //Create WaitHandlers
            m_RenderFrameStart = new AutoResetEvent(false);
            m_RenderFrameEnd = new AutoResetEvent(false);
            m_UpdateFrameStart = new AutoResetEvent(false);
            m_UpdateFrameEnd = new AutoResetEvent(false);

            // reset the values
            Reset();
        }
Exemplo n.º 2
0
        public void StartRenderProcessing(out ChangeBuffer renderBuffer, out GameTime gameTime)
        {
            // wait for the green light
            m_RenderFrameStart.WaitOne();

            // ensure data is pushed to memory
            Thread.MemoryBarrier();

            // get the current render Buffer
            renderBuffer = m_arrbuffers[m_nCurrentRenderBuffer];

            // get the time
            gameTime = m_Gametime;
        }