static void Main(string[] args)
        {
            Player john = new Player("John Rambo");

            john.AddScore(123);
            Console.WriteLine(john);
            Console.WriteLine(john.ToJson());

            Apple apple = new Apple(23);

            Console.WriteLine(apple);
            Console.WriteLine(apple.ToJson());

            List <IJsonRepresentable> jsonObjects = new List <IJsonRepresentable>();

            jsonObjects.Add(john);
            jsonObjects.Add(apple);

            Console.WriteLine("Polymorphism at work");
            foreach (var item in jsonObjects)
            {
                Console.WriteLine(item.ToJson());
            }

            Console.WriteLine("\n\n GRAPHICS \n\n");
            GraphicsEngine engine = new GraphicsEngine();

            engine.Draw(apple);
            engine.Draw(john);
        }
Ejemplo n.º 2
0
 protected override void OnRender(DrawingContext drawingContext)
 {
     base.OnRender(drawingContext);
     if (engine != null)
     {
         engine.Draw(drawingContext);
     }
 }
Ejemplo n.º 3
0
        /// <summary>
        /// This is called when the game should draw itself.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(new Color(53, 101, 77));
            // TODO: Add your drawing code here
            spriteBatch.Begin();

            _graphicsEngine.Draw(_graphics, spriteBatch, _bloomFilter, framesPerSecond, _board);

            CalculateFps(gameTime);

            spriteBatch.End();

            base.Draw(gameTime);
        }
Ejemplo n.º 4
0
        private void Form_Paint(object sender, PaintEventArgs e)
        {
            //Draw the graphics/GUI

            foreach (Control c in this.Controls)
            {
                c.Refresh();
            }

            if (graphicsEngine != null)
            {
                graphicsEngine.Draw(e.Graphics);
            }
            //set Current player from model
            current_player.BackColor = this.board.getCurrentPlayerColor();
            //Update status lable
            lable_players.Text = this.board.getStatus();
            //Force the next Paint()
            this.Invalidate();
        }