Exemple #1
0
        /// <summary>
        /// Draws the Window.
        /// </summary>
        /// <param name="sender">The sender of the event.</param>
        /// <param name="e">The paint event.</param>
        private void DrawHandler(Object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.SmoothingMode      = SmoothingMode.HighSpeed;
            g.PixelOffsetMode    = PixelOffsetMode.HighSpeed;
            g.CompositingQuality = CompositingQuality.HighSpeed;

            // Translate down so the chessboard can be draw from (0, 0).
            g.TranslateTransform(0, MenuHeight);

            if (Game != null)
            {
                Game.Draw(g);
            }
            else if (AnalysisBox != null)
            {
                AnalysisBox.DrawWindow(g);
            }
            else
            {
                VisualPosition.DrawDarkSquares(g);
                VisualPosition.DrawPieces(g);
            }
        }
Exemple #2
0
 /// <summary>
 /// Draw the main window.
 /// </summary>
 /// <param name="g">The drawing surface.</param>
 public void DrawWindow(Graphics g)
 {
     VisualPosition.DrawDarkSquares(g);
     if (_selectedSquare != Position.InvalidSquare)
     {
         VisualPosition.DrawSquare(g, WindowSelectionBrush, _selectedSquare);
     }
     VisualPosition.DrawPieces(g);
 }
Exemple #3
0
        /// <summary>
        /// Draws the position and animations associated with the game.
        /// </summary>
        /// <param name="g">The drawing surface.</param>
        public void Draw(Graphics g)
        {
            VisualPosition.DrawDarkSquares(g);
            White.Draw(g);
            Black.Draw(g);
            VisualPosition.DrawPieces(g);

            if (_state != GameState.Ingame && _state != GameState.Stopped)
            {
                g.FillRectangle(OverlayBrush, 0, 0, VisualPosition.Width, VisualPosition.Width);
                g.DrawString(_message, MessageFont, MessageBrush, 20, 20);
            }
        }