Made layered texture to be able to have textures on textures. Might be used in the near future.

This commit is contained in:
2018-02-06 02:13:21 -08:00
parent 13e1d9591a
commit 1b41fc47e9
3 changed files with 75 additions and 0 deletions

View File

@ -45,6 +45,7 @@
<Compile Include="Animations\Animation.cs" />
<Compile Include="Animations\AnimationManager.cs" />
<Compile Include="IlluminateFramework\Colors.cs" />
<Compile Include="UIUtilities\LayeredTexture.cs" />
<Compile Include="UIUtilities\SpriteFonts\CharacterSheets\GenericCharacterSheets.cs" />
<Compile Include="UIUtilities\SpriteFonts\CharacterSheets\VanillaCharacterSheet.cs" />
<Compile Include="UIUtilities\SpriteFonts\Fonts\Components\CharacterSpacing.cs" />
@ -61,6 +62,7 @@
<Compile Include="UIUtilities\MenuComponents\Button.cs" />
<Compile Include="UIUtilities\SpriteFonts\Fonts\VanillaFont.cs" />
<Compile Include="UIUtilities\SpriteFonts\SpriteFont.cs" />
<Compile Include="UIUtilities\Texture2DExtended.cs" />
<Compile Include="Utilities.cs" />
</ItemGroup>
<ItemGroup>

View File

@ -0,0 +1,44 @@
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StardustCore.UIUtilities
{
public class LayeredTexture
{
public List<Texture2DExtended> textureLayers;
public LayeredTexture(List<Texture2DExtended> textures)
{
this.textureLayers = textures;
}
/// <summary>
/// Adds a new texture as the top layer.
/// </summary>
/// <param name="texture"></param>
public void addTexture(Texture2DExtended texture)
{
this.textureLayers.Add(texture);
}
/// <summary>
/// Adds a new texture at a specific layer depth.
/// </summary>
/// <param name="texture"></param>
/// <param name="index"></param>
public void addTexture(Texture2DExtended texture, int index)
{
this.textureLayers.Insert(index, texture);
}
public LayeredTexture Copy()
{
return new LayeredTexture(this.textureLayers);
}
}
}

View File

@ -0,0 +1,29 @@
using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StardustCore.UIUtilities
{
public class Texture2DExtended
{
public string Name;
public Texture2D texture;
public string path;
public Texture2DExtended(string path)
{
this.Name = Path.GetFileName(path);
this.path = path;
this.texture = StardustCore.ModCore.ModHelper.Content.Load<Texture2D>(path);
}
public Texture2DExtended Copy()
{
return new Texture2DExtended(this.path);
}
}
}