23 lines
558 B
C#
23 lines
558 B
C#
|
using System.IO;
|
||
|
using Microsoft.Xna.Framework;
|
||
|
using Microsoft.Xna.Framework.Graphics;
|
||
|
|
||
|
namespace Elite
|
||
|
{
|
||
|
public class Sprite
|
||
|
{
|
||
|
private Texture2D _texture;
|
||
|
|
||
|
public Sprite(GraphicsDevice device, string filename)
|
||
|
{
|
||
|
var fileStream = new FileStream(filename, FileMode.Open);
|
||
|
_texture = Texture2D.FromStream(device, fileStream);
|
||
|
fileStream.Dispose();
|
||
|
}
|
||
|
|
||
|
public void Draw(SpriteBatch batch)
|
||
|
{
|
||
|
batch.Draw(_texture, Vector2.Zero, Color.White);
|
||
|
}
|
||
|
}
|
||
|
}
|