Exemple #1
0
        private Texture2D TryLoadPNG(FileInfo finfo)
        {
            Stream fileStream = finfo.Open(FileMode.Open, FileAccess.Read);
            var    texture    = Texture2D.FromStream(SpaceGame.GetGraphicsDevice(), fileStream);

            fileStream.Close();
            return(texture);
        }
        private void Load(ResourceDefinition def)
        {
            Texture2D sprite;

            using (FileStream fileStream =
                       new FileStream(def.PathToTexture.FullName, FileMode.Open))
            {
                sprite = Texture2D.FromStream(SpaceGame.GetGraphicsDevice(), fileStream);
            }
            def.SetRenderable(sprite);
        }
 public DumbGraphicsRegistry()
 {
     SpaceGame.GetGraphicsDevice().DeviceReset += OnReset;
 }