using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using VBXSE; namespace WorldOfMinimalism { public static class Graphics { public static Texture2D ColorMapToTexture(Color[] colorMap, int width = 16, int height = 16) { Texture2D toReturn = null; try { //FIXME: Massive slowdown toReturn = new Texture2D(SpriteEngine.graphics.GraphicsDevice, width, height, false, SurfaceFormat.Color); toReturn.SetData(colorMap); } catch { //TODO: Error sprite } return toReturn; } public static void AddTexture(string name, Texture2D texture) { SpriteEngine.textures.Add(name, texture); } public static void AddTexture(string name, Color[] colorMap, int width = 16, int height = 16) { AddTexture(name, ColorMapToTexture(colorMap, width, height)); } } }