diff options
| author | Sarah Bradley <git@sarahduck.ca> | 2023-12-25 16:24:47 -0800 |
|---|---|---|
| committer | Sarah Bradley <git@sarahduck.ca> | 2023-12-25 16:24:47 -0800 |
| commit | f6100c020613de7980861b7d77f4c37e1a65a025 (patch) | |
| tree | a73f5a0b0f133a34bfd0e171cf7af01d43e72279 /Mouse.cs | |
| parent | 626c005b5217b70089fdd6956f2736f600015026 (diff) | |
Added image size limits
Diffstat (limited to 'Mouse.cs')
| -rw-r--r-- | Mouse.cs | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -15,6 +15,8 @@ abstract class Mouse : Drawable public static Action<Mouse>? Clicked; + protected readonly static byte[] FallbackImg = EmbeddedResources.GetResource("misc.cursor.png"); + public Mouse() : base() { DrawOrder = 100; @@ -23,10 +25,10 @@ abstract class Mouse : Drawable string CursorPath = OnekoOnline.Config.GetValue("CursorSpritePath", "misc/cursor.png"); if (File.Exists(CursorPath) && new FileInfo(CursorPath).Length < 2500) { - Cursor = Bitmap.FromPNGMemory(File.ReadAllBytes(CursorPath)); + Cursor = Bitmap.FromPNGMemory(File.ReadAllBytes(CursorPath), 32, 32); } else { Console.WriteLine("The cursor PNG was either mising or too big. Using the default."); - Cursor = Bitmap.FromPNGMemory(EmbeddedResources.GetResource("misc.cursor.png")); + Cursor = Bitmap.FromPNGMemory(FallbackImg); } } |
