Exemplo n.º 1
0
        private void DrawScore(PongEnvironment env, Graphics g)
        {
            var middleX = (env.TableSize.Width / 2);

            g.DrawString(env.LeftPaddle.Points.ToString(), m_font, Brushes.White, middleX - 78, 45);
            g.DrawString(env.RightPaddle.Points.ToString(), m_font, Brushes.White, middleX + 12, 45);

            g.DrawImage(env.LeftPaddle.Controller.UIInformation.Avatar, middleX - 70, 10, 32, 32);
            g.DrawImage(env.RightPaddle.Controller.UIInformation.Avatar, middleX + 20, 10, 32, 32);
        }
Exemplo n.º 2
0
        private static void DrawField(PongEnvironment env, Graphics g, int width, int height)
        {
            // Top wall.
            g.FillRectangle(Brushes.White, 5, 15, width - 10, 15);

            var bottomWallY = height - 30;

            // Bottom wall.
            g.FillRectangle(Brushes.White, 5, bottomWallY, width - 10, 15);

            // Division.
            var divisionX = (width / 2) - 15;

            for (int y = 15; y < bottomWallY; y += 30)
            {
                g.FillRectangle(Brushes.White, divisionX, y, 15, 15);
            }
        }
Exemplo n.º 3
0
        private void DrawBall(PongEnvironment env, Graphics g)
        {
            var ball = env.Ball;

            g.FillRectangle(Brushes.White, ball.X, ball.Y, ball.Width, ball.Height);
        }