(519124ad1) Fixed items with no sprite crashing the game. Closes #1153

This commit is contained in:
Joonas Rikkonen
2019-03-28 12:40:08 +02:00
parent a8222e429f
commit bcd779fe78
3 changed files with 48 additions and 7 deletions
@@ -11,9 +11,14 @@ namespace Barotrauma
/// </summary>
public static class TextureLoader
{
public static Texture2D PlaceHolderTexture
{
get;
private set;
}
static TextureLoader()
{
BlendColorBlendState = new BlendState
{
ColorDestinationBlend = Blend.Zero,
@@ -38,6 +43,15 @@ namespace Barotrauma
_graphicsDevice = graphicsDevice;
_needsBmp = needsBmp;
_spriteBatch = new SpriteBatch(_graphicsDevice);
PlaceHolderTexture = new Texture2D(graphicsDevice, 32, 32);
Color[] data = new Color[32 * 32];
for (int i = 0; i < 32 * 32; i++)
{
data[i] = Color.Magenta;
}
PlaceHolderTexture.SetData(data);
}
public static Texture2D FromFile(string path, bool preMultiplyAlpha = true)