Beispiel #1
0
        public void RenderFrame()
        {
            if (needsReset)
            {
                needsReset = false;

                this.Dispatcher.Invoke((Action) delegate
                {
                    AdjustScrollBars();
                });
                ResetDevice();
            }
            DxDevice.Clear(ClearOptions.Target, Color.White, 1.0f, 0); // Clear the window to black
#if UseXNAZorder
            sprite.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.FrontToBack, SaveStateMode.None);
#else
            sprite.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied, null, null, null, null, Matrix.CreateScale(1.0f));
#endif

            if (selectedBoard != null) // No map selected to draw on
            {
                lock (this)
                {
                    if (selectedBoard != null) // check again
                    {
                        selectedBoard.RenderBoard(sprite);
                        if (selectedBoard.MapSize.X < _CurrentDXWindowSize.Width)
                        {
                            DrawLine(sprite, new Vector2(MapSize.X, 0), new Vector2(MapSize.X, _CurrentDXWindowSize.Height), Color.Black);
                        }
                        if (selectedBoard.MapSize.Y < _CurrentDXWindowSize.Height)
                        {
                            DrawLine(sprite, new Vector2(0, MapSize.Y), new Vector2(_CurrentDXWindowSize.Width, MapSize.Y), Color.Black);
                        }
                    }
                }
            }
#if FPS_TEST
            fontEngine.DrawString(sprite, new System.Drawing.Point(), Color.Black, fpsCounter.Frames.ToString(), 1000);
#endif
            sprite.End();
            try
            {
                DxDevice.Present();
            }
            catch (DeviceLostException)
            {
            }
            catch (DeviceNotResetException)
            {
                needsReset = true;
            }
        }
Beispiel #2
0
        public void RenderFrame()
        {
            if (needsReset)
            {
                Invoke((Action) delegate
                {
                    ResetDock();
                    AdjustScrollBars();
                });
                ResetDevice();
                needsReset = false;
            }
            DxDevice.Clear(ClearOptions.Target, Color.White, 1.0f, 0); // Clear the window to black
#if UseXNAZorder
            sprite.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.FrontToBack, SaveStateMode.None);
#else
            sprite.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
#endif
            lock (this)
            {
                selectedBoard.RenderBoard(sprite);
                if (selectedBoard.MapSize.X < DxContainer.Width)
                {
                    DrawLine(sprite, new Vector2(MapSize.X, 0), new Vector2(MapSize.X, DxContainer.Height), Color.Black);
                }
                if (selectedBoard.MapSize.Y < DxContainer.Height)
                {
                    DrawLine(sprite, new Vector2(0, MapSize.Y), new Vector2(DxContainer.Width, MapSize.Y), Color.Black);
                }
            }
#if FPS_TEST
            fontEngine.DrawString(sprite, new System.Drawing.Point(), Color.Black, fpsCounter.Frames.ToString(), 1000);
#endif
            sprite.End();
            try
            {
                DxDevice.Present();
            }
            catch (DeviceLostException)
            {
            }
            catch (DeviceNotResetException)
            {
                needsReset = true;
            }
        }
Beispiel #3
0
        public void RenderFrame()
        {
            if (!deviceReady || ((Form)Parent.Parent.Parent).WindowState == FormWindowState.Minimized)
            {
                return;
            }
            frameCount++;
            DxDevice.Clear(ClearOptions.Target, Color.White, 1.0f, 0); // Clear the window to black
#if UseXNAZorder
            sprite.Begin(SpriteBlendMode.AlphaBlend, SpriteSortMode.FrontToBack, SaveStateMode.None);
#else
            //sprite.Begin(/*SpriteBlendMode.AlphaBlend*/);
            sprite.Begin(SpriteSortMode.Immediate, BlendState.NonPremultiplied);
#endif
            selectedBoard.RenderBoard(sprite);
            if (selectedBoard.MapSize.X < DxContainer.Width)
            {
                DrawLine(sprite, new Vector2(MapSize.X, 0), new Vector2(MapSize.X, DxContainer.Height), Color.Black);
            }
            if (selectedBoard.MapSize.Y < DxContainer.Height)
            {
                DrawLine(sprite, new Vector2(0, MapSize.Y), new Vector2(DxContainer.Width, MapSize.Y), Color.Black);
            }
            sprite.End();
            try
            {
                DxDevice.Present();
            }
            catch (DeviceLostException)
            {
            }
            catch (DeviceNotResetException)
            {
                try
                {
                    ResetDevice();
                }
                catch (DeviceLostException)
                {
                }
            }
        }