public static Texture2D GetTexture(PackedContentManager content, GraphicsDevice device, string name) { try { if (File.Exists(content.RootDirectory+"/gfx/"+name)) { return Texture2D.FromStream(device, File.OpenRead(content.RootDirectory + "/gfx/" + name)); } else return content.Load<Texture2D>("gfx/"+name); } catch (ContentLoadException cle) { Console.WriteLine("Error loading texture: " + "gfx/"+name); return _default; } }
public static void LoadDefault(PackedContentManager content) { _default = content.Load<Texture2D>("gfx/default"); }
public static void SetContent(IServiceProvider serviceProvider, string ContentPath, string PackFile) { if (serviceProvider == null) return; _content = new PackedContentManager(serviceProvider, PackFile, ContentPath, Nomad.Archive.SevenZip.KnownSevenZipFormat.SevenZip); TextureLoader.LoadDefault(_content); _contentSet = true; }