Ejemplo n.º 1
0
        public void OnDeviceReset(object sender, EventArgs e)
        {
            _control = sender as DirectxControl;
            if (_control == null)
            {
                throw new ArgumentNullException(nameof(sender));
            }

            _sprite?.Dispose();
            _sprite = new Dx9.Sprite(_control.Device);

            _shipSprite?.Dispose();
            _shipSprite = new Dx9.Sprite(_control.Device);

            if (_texture == null)
            {
                _texture = Dx9.Texture.FromFile(_control.Device, "Ressources\\maxresdefault.jpg", _control.Device.Viewport.Width, _control.Device.Viewport.Height, 0, Dx9.Usage.None, Dx9.Format.Unknown, Dx9.Pool.Default, Dx9.Filter.Default, Dx9.Filter.Default, 0, out _imageInformation);
            }
            if (_shipTexture == null)
            {
                _shipTexture = Dx9.Texture.FromFile(_control.Device, "Ressources\\Voyager.png", 200, 200, 0, Dx9.Usage.None, Dx9.Format.Unknown, Dx9.Pool.Default, Dx9.Filter.Default, Dx9.Filter.Default, 0);
            }
            if (_circleTexture == null)
            {
                _circleTexture = Dx9.Texture.FromFile(_control.Device, "Ressources\\200px-65537-gon.svg.png", 20, 20, 0, Dx9.Usage.None, Dx9.Format.Unknown, Dx9.Pool.Default, Dx9.Filter.Default, Dx9.Filter.Default, 0);
            }
            if (_font == null)
            {
                SD.Font f = new SD.Font("Arial", 20f, SD.FontStyle.Regular);

                _font = new Dx9.Font(_control.Device, f);
            }
        }
Ejemplo n.º 2
0
 public void OnDeviceDestroyed(object sender, EventArgs e)
 {
     if (_sprite != null && !_sprite.Disposed)
     {
         _sprite.Dispose();
     }
     if (_shipSprite != null && !_shipSprite.Disposed)
     {
         _shipSprite.Dispose();
     }
     if (_texture != null && !_texture.Disposed)
     {
         _texture.Dispose();
         _texture = null;
     }
     if (_font != null && !_font.Disposed)
     {
         _font.Dispose();
         _font = null;
     }
 }
Ejemplo n.º 3
0
        void UnloadGraphicResources()
        {
            deviceReadyForRender = false;

            resourceManager.ReleaseAll();

            resourceManager.EmptyTexture.Dispose();
            emptyTexture.Dispose();

            spriteRenderer.Dispose();
            lineRenderer.Dispose();

            loadingOverlay.Unload();
            blendOverlay.Unload();
            errorOverlay.Unload();

            renderToSurface.Dispose();
            renderToTexture.Dispose();
        }