summaryrefslogtreecommitdiff
path: root/Oneko.cs
diff options
context:
space:
mode:
authorSarah Bradley <git@sarahduck.ca>2023-12-25 16:24:47 -0800
committerSarah Bradley <git@sarahduck.ca>2023-12-25 16:24:47 -0800
commitf6100c020613de7980861b7d77f4c37e1a65a025 (patch)
treea73f5a0b0f133a34bfd0e171cf7af01d43e72279 /Oneko.cs
parent626c005b5217b70089fdd6956f2736f600015026 (diff)
Added image size limits
Diffstat (limited to 'Oneko.cs')
-rw-r--r--Oneko.cs6
1 files changed, 4 insertions, 2 deletions
diff --git a/Oneko.cs b/Oneko.cs
index 7a1e3ac..f158024 100644
--- a/Oneko.cs
+++ b/Oneko.cs
@@ -17,6 +17,8 @@ abstract class Oneko : Drawable
public string Name = "Oneko";
+ protected readonly static byte[] FallbackImg = EmbeddedResources.GetResource("nekos.oneko.png");
+
public Oneko() : base()
{
Size = new(32,32);
@@ -25,10 +27,10 @@ abstract class Oneko : Drawable
string SpriteSheetPath = OnekoOnline.Config.GetValue("SpriteSheetPath", "nekos/oneko.png");
if (File.Exists(SpriteSheetPath) && new FileInfo(SpriteSheetPath).Length < 128*256*3) {
- SpriteSheet = Bitmap.FromPNGMemory(File.ReadAllBytes(SpriteSheetPath));
+ SpriteSheet = Bitmap.FromPNGMemory(File.ReadAllBytes(SpriteSheetPath), 256, 128);
} else {
Console.WriteLine("Path to spritesheet was invalid or the file was too big, using the default.");
- SpriteSheet = Bitmap.FromPNGMemory(EmbeddedResources.GetResource("nekos.oneko.png"));
+ SpriteSheet = Bitmap.FromPNGMemory(FallbackImg, 256, 128);
}
}