Ejemplo n.º 1
0
        public DebugRenderer(GraphicsDevice graphics, Camera2D camera)
        {
            _textureRenderer = new TextureRenderer(camera, new SpriteBatch(graphics))
            {
                SpriteColor     = new Color(128, 128, 128, 128),
                Offset          = new Vector2(0.5f, 0.5f),
                SourceRectangle = new Rectangle(0, 0, 1, 1)
            };

            _dummyTexture = new Texture2D(graphics, 1, 1);
            _dummyTexture.SetData(Enumerable.Repeat(Color.White, 1 * 1).ToArray());
        }
        public VisibleTileGridDrawer(GraphicsDevice device,
                                     ResourceLoader resources,
                                     WorldGrid world,
                                     Camera2D camera2D)
        {
            _tileTextures = resources.MapEnumToResources <TileType, Texture2D>("images/tiles.");

            _worldView = new WorldGridSlice <int>(world,
                                                  device.Viewport.Width / Constants.PixelSize + 2,
                                                  device.Viewport.Height / Constants.PixelSize + 2);
            _worldView.Initialize(new GridCoordinate(0, 0));
            _camera = camera2D;

            _renderer = new TextureRenderer(_camera, new SpriteBatch(device))
            {
                Offset = new Vector2(0.5f, 0.5f) * Constants.PixelSize
            };
        }