From 1b41fc47e92d2a4a9456e705fc419263a2c380cc Mon Sep 17 00:00:00 2001 From: Date: Tue, 6 Feb 2018 02:13:21 -0800 Subject: [PATCH] Made layered texture to be able to have textures on textures. Might be used in the near future. --- GeneralMods/StardustCore/StardustCore.csproj | 2 + .../UIUtilities/LayeredTexture.cs | 44 +++++++++++++++++++ .../UIUtilities/Texture2DExtended.cs | 29 ++++++++++++ 3 files changed, 75 insertions(+) create mode 100644 GeneralMods/StardustCore/UIUtilities/LayeredTexture.cs create mode 100644 GeneralMods/StardustCore/UIUtilities/Texture2DExtended.cs diff --git a/GeneralMods/StardustCore/StardustCore.csproj b/GeneralMods/StardustCore/StardustCore.csproj index 137361de..a599906b 100644 --- a/GeneralMods/StardustCore/StardustCore.csproj +++ b/GeneralMods/StardustCore/StardustCore.csproj @@ -45,6 +45,7 @@ + @@ -61,6 +62,7 @@ + diff --git a/GeneralMods/StardustCore/UIUtilities/LayeredTexture.cs b/GeneralMods/StardustCore/UIUtilities/LayeredTexture.cs new file mode 100644 index 00000000..af7972df --- /dev/null +++ b/GeneralMods/StardustCore/UIUtilities/LayeredTexture.cs @@ -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 textureLayers; + + public LayeredTexture(List textures) + { + this.textureLayers = textures; + } + + /// + /// Adds a new texture as the top layer. + /// + /// + public void addTexture(Texture2DExtended texture) + { + this.textureLayers.Add(texture); + } + + /// + /// Adds a new texture at a specific layer depth. + /// + /// + /// + public void addTexture(Texture2DExtended texture, int index) + { + this.textureLayers.Insert(index, texture); + } + + public LayeredTexture Copy() + { + return new LayeredTexture(this.textureLayers); + } + + } +} diff --git a/GeneralMods/StardustCore/UIUtilities/Texture2DExtended.cs b/GeneralMods/StardustCore/UIUtilities/Texture2DExtended.cs new file mode 100644 index 00000000..134d3608 --- /dev/null +++ b/GeneralMods/StardustCore/UIUtilities/Texture2DExtended.cs @@ -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(path); + } + + public Texture2DExtended Copy() + { + return new Texture2DExtended(this.path); + } + } +}