Example #1
0
        public void DrawFrame(SpriteBatch spriteBatch, Camera camera)
        {
            float x, y;

            // TOP
            y = position.Y;
            for (x = position.X; x < position.X + gridSize; x += 10.0f)
            {
                spriteBatch.Draw(tex, camera.RelativePosition(new Vector2(x, y)), Color.White);
            }

            // BOTTOM
            y = position.Y + gridSize;
            for (x = position.X; x < position.X + gridSize; x += 10.0f)
            {
                spriteBatch.Draw(tex, camera.RelativePosition(new Vector2(x, y)), Color.White);
            }

            // LEFT
            x = position.X;
            for (y = position.Y; y < position.Y + gridSize; y += 10.0f)
            {
                spriteBatch.Draw(tex, camera.RelativePosition(new Vector2(x, y)), Color.White);
            }

            // RIGHT
            x = position.X + gridSize;
            for (y = position.Y; y < position.Y + gridSize; y += 10.0f)
            {
                spriteBatch.Draw(tex, camera.RelativePosition(new Vector2(x, y)), Color.White);
            }

            if (topLeft != null)
                topLeft.DrawFrame(spriteBatch, camera);
            if (topRight != null)
                topRight.DrawFrame(spriteBatch, camera);
            if (bottomLeft != null)
                bottomLeft.DrawFrame(spriteBatch, camera);
            if (bottomRight != null)
                bottomRight.DrawFrame(spriteBatch, camera);
        }