sneak/Shared/Textures.cs
Colin McMillen c189cfcc09 Add player health & a heart sprite.
GitOrigin-RevId: 3389f46044a3fbb48af8533370c0318982c9ad83
2020-02-27 16:28:48 -05:00

65 lines
2.4 KiB
C#

using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using System.Collections.Generic;
namespace SemiColinGames {
class TextureRef {
private static readonly List<TextureRef> allTextures = new List<TextureRef>();
public static void LoadAll(ContentManager content) {
foreach (TextureRef texture in allTextures) {
texture.Load(content);
}
}
private readonly string contentPath;
public TextureRef(string contentPath) {
allTextures.Add(this);
this.contentPath = contentPath;
}
public Texture2D Get { get; private set; }
private void Load(ContentManager content) {
Get = content.Load<Texture2D>(contentPath);
}
}
static class Textures {
public static SpriteFont DebugFont;
public static SpriteFont BannerFont;
public static TextureRef Player = new TextureRef("sprites/ccg/ninja_female");
public static TextureRef Heart = new TextureRef("sprites/semicolin/heart");
// Backgrounds are indexed by draw order; the first element should be drawn furthest back.
public static TextureRef[] Backgrounds = new TextureRef[] {
new TextureRef("backgrounds/szadiart/pf4/background1_day"),
new TextureRef("backgrounds/szadiart/pf4/background2a_day"),
new TextureRef("backgrounds/szadiart/pf4/background3_day"),
new TextureRef("backgrounds/szadiart/pf4/background4_day"),
};
public static TextureRef Cemetery = new TextureRef("tiles/anokolisa/cemetery");
public static TextureRef Crypt = new TextureRef("tiles/anokolisa/crypt");
public static TextureRef Dungeon = new TextureRef("tiles/anokolisa/dungeon");
public static TextureRef Forest = new TextureRef("tiles/anokolisa/forest");
public static TextureRef Garden = new TextureRef("tiles/anokolisa/garden");
public static TextureRef Grassland = new TextureRef("tiles/anokolisa/grassland");
public static TextureRef Ruins = new TextureRef("tiles/anokolisa/ruins");
public static TextureRef Sewer = new TextureRef("tiles/anokolisa/sewer");
public static TextureRef Temple = new TextureRef("tiles/anokolisa/temple");
public static TextureRef Village = new TextureRef("tiles/anokolisa/village");
public static void Load(ContentManager content) {
DebugFont = content.Load<SpriteFont>("fonts/debug");
BannerFont = content.Load<SpriteFont>("fonts/banner");
TextureRef.LoadAll(content);
}
}
}