public Tuple <SpriteKey, SpriteInstanceData> Resolve(Sprite sprite) { var assetType = AssetTypeLookup[sprite.IdType]; var id = sprite.NumericId; ITexture texture = Resolve <IAssetManager>().LoadTexture(assetType, id); if (texture == null) { return(Tuple.Create(new SpriteKey(_defaultTexture, (int)DrawLayer.Diagnostic, sprite.Flags), SpriteInstanceData.Centred(sprite.Position, new Vector2(_defaultTexture.Width, _defaultTexture.Height), Vector2.Zero, Vector2.One, 0, 0))); } texture.GetSubImageDetails(sprite.SubObject, out var size, out var texOffset, out var texSize, out var layer); var key = new SpriteKey(texture, sprite.RenderOrder, sprite.Flags); var instance = SpriteInstanceData.CopyFlags( sprite.Position, sprite.Size ?? size, texOffset, texSize, layer, sprite.Flags | (texture.Format == PixelFormat.R8_UNorm ? SpriteFlags.UsePalette : 0) ); return(Tuple.Create(key, instance)); }