protected override void UnloadSynchronized() { base.UnloadSynchronized(); if (_spriteIcon != null) { _spriteIcon.Dispose(); _spriteIcon = null; } foreach (var icon in _iconTextures.Values) { icon.Dispose(); } }
private void RenderSprite( D3DXSprite sprite, Direct3DTexture9 texture, Size srcSize, RectangleF dstRect, bool antiAlias) { sprite.Begin(D3DXSPRITEFLAG.NONE); try { if (!antiAlias) { Allocator.Device.SetSamplerState(0, D3DSAMPLERSTATETYPE.D3DSAMP_MINFILTER, (int)D3DTEXTUREFILTERTYPE.D3DTEXF_POINT); Allocator.Device.SetSamplerState(0, D3DSAMPLERSTATETYPE.D3DSAMP_MAGFILTER, (int)D3DTEXTUREFILTERTYPE.D3DTEXF_POINT); Allocator.Device.SetSamplerState(0, D3DSAMPLERSTATETYPE.D3DSAMP_MIPFILTER, (int)D3DTEXTUREFILTERTYPE.D3DTEXF_POINT); } D3DXHelper.Draw2D(sprite, texture, dstRect, srcSize); } finally { sprite.End(); } }
protected override void UnloadSynchronized() { base.UnloadSynchronized(); if (_texture0 != null) { _texture0.Dispose(); _texture0 = null; } if (_textureMaskTv != null) { _textureMaskTv.Dispose(); _textureMaskTv = null; } if (_sprite != null) { _sprite.Dispose(); _sprite = null; } if (_spriteTv != null) { _spriteTv.Dispose(); _spriteTv = null; } }
protected override void LoadSynchronized() { base.LoadSynchronized(); _spriteIcon = D3DX9.CreateSprite(Allocator.Device); }
public unsafe static void Draw2D( D3DXSprite sprite, Direct3DTexture9 texture, RectangleF dstRect, Size srcSize) { var scale = new D3DXVECTOR2( dstRect.Width / (float)srcSize.Width, dstRect.Height / (float)srcSize.Height); var trans = new D3DXVECTOR2(dstRect.Location.X, dstRect.Location.Y); D3DMATRIX m; D3DMATRIX.Transformation2D(&m, null, 0f, &scale, null, 0f, &trans); sprite.SetTransform(ref m).CheckError(); sprite.Draw(texture, null, null, null, 0xffffffff).CheckError(); }