Ejemplo n.º 1
0
 public static void InitTexture(this ITextured tex, string texturePath, GraphicsDevice dev)
 {
     if (tex.Texture == null)
     {
         tex.Texture = tex.LoadTexture(texturePath, dev);
     }
 }
Ejemplo n.º 2
0
 public static Texture2D LoadTexture(this ITextured tex, string texturePath, GraphicsDevice dev)
 {
     using (var s = File.Open(texturePath, FileMode.Open))
     {
         return(Texture2D.FromStream(dev, s));
     }
 }
Ejemplo n.º 3
0
        private void SetActiveTexture(MapDocument document, ITextured tex)
        {
            if (tex == null)
            {
                return;
            }

            var at = new ActiveTexture {
                Name = tex.Texture.Name
            };

            MapDocumentOperation.Perform(document, new TrivialOperation(x => x.Map.Data.Replace(at), x => x.Update(at)));
        }