예제 #1
0
 protected override void Draw()
 {
     _snake.Draw();
     _fruit.Draw();
     base.Draw();
     _gameField.PrintScore(String.Format("Score {0}", _score));
 }
예제 #2
0
        /// <summary>
        /// Renders everything
        /// </summary>
        /// <param name="e">event arg passed to us by opentk</param>
        protected override void OnRenderFrame(FrameEventArgs e)
        {
            if (_running)
            {
                GL.Clear(ClearBufferMask.ColorBufferBit);

                //TODO: Draw the background here

                //Draw fruit
                _fruitShader.Bind();
                _fruitTexture.Bind();
                _fruit.Draw();

                //Draw the body of the snake
                _snakeShader.Bind();
                for (int i = 0; i < _snake.Count; i++)
                {
                    _snake[i].Draw();
                }
                //Draw the head of the snake
                _snakeHeadShader.Bind();
                _snakeHeadTexture.Bind();
                _snakeHead.Draw();

                Context.SwapBuffers();
            }

            base.OnRenderFrame(e);
        }
예제 #3
0
        public void Draw(SpriteBatch spriteBatch) {
            
            spriteBatch.Draw( Textures.Pixel, _rectSceneBg, Colors.GlobalBG);
            spriteBatch.Draw( Textures.Pixel, _rectGameScreen,  Colors.GameScene.Border);
            spriteBatch.Draw( Textures.Pixel, _rectBoard,  Colors.GameScene.FieldBg);
            spriteBatch.Draw( Textures.Pixel, _rectStatus,  Colors.GameScene.StatisticsBg);

            _fruit.Draw(spriteBatch);
            _snake.Draw(spriteBatch);
            _stats.Draw(spriteBatch);

        }
예제 #4
0
 private void Draw()
 {
     _snake.Draw();
     _fruit.Draw();
     _gameField.Draw();
 }