1
0
Fork 0
This repository has been archived on 2019-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Galactic_Colors_Control/Galactic Colors Control GUI/Utilities.cs

32 lines
934 B
C#

using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Graphics;
using System.IO;
namespace Galactic_Colors_Control_GUI
{
static class Utilities
{
static public void SpriteFromPng(string path, ref Texture2D sprite, GraphicsDevice graphics)
{
if (File.Exists(path))
{
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
sprite = Texture2D.FromStream(graphics, fileStream);
}
}
}
static public void SoundFromMp3(string path, ref SoundEffect sound)
{
if (File.Exists(path))
{
using (FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read))
{
sound = SoundEffect.FromStream(fileStream);
}
}
}
}
}