SHOW:
|
|
- or go back to the newest paste.
| 1 | - | public static Texture2D LoadFromFile(string filePath) |
| 1 | + | public static Texture2D LoadFromFile(string filePath, GraphicsDevice graphicsDevice) |
| 2 | {
| |
| 3 | if (!filePath.EndsWith(".png")) { throw new ArgumentException("Tried to load an image that was not a PNG.", "filePath"); }
| |
| 4 | if (!File.Exists(filePath)) { throw new FileNotFoundException(string.Format("The file at {0} does not exist.")); }
| |
| 5 | ||
| 6 | using (Stream stream = File.OpenRead(filePath)) | |
| 7 | {
| |
| 8 | - | return Texture2D.FromStream(GameServices.Graphics, stream); |
| 8 | + | return Texture2D.FromStream(graphicsDevice, stream); |
| 9 | } | |
| 10 | } |