Пример #1
0
        private void UpdateImage()
        {
            if (!_dirty)
            {
                return;
            }

            if (_colorBuffer == null ||
                _colorBuffer.Width != Map.Width ||
                _colorBuffer.Height != Map.Height)
            {
                _colorBuffer = new ColorBuffer(Map.Width, Map.Height);
            }

            // Bottom layer
            UpdateLayer(tile => !_secondLayerTiles.Contains(tile.Info.Id));

            // Top layer
            UpdateLayer(tile => _secondLayerTiles.Contains(tile.Info.Id));

            var texture = _colorBuffer.CreateTexture2D(MyraEnvironment.GraphicsDevice);

            _image = new TextureRegion(texture);

            _dirty = false;
        }