From 48deeeabfd86cfc5b993936760e1332308a47ab2 Mon Sep 17 00:00:00 2001 From: Sarah Duck Date: Mon, 16 Jun 2025 22:10:06 -0700 Subject: Optimizations, and Transparent Window! --- Oneko.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Oneko.cs') diff --git a/Oneko.cs b/Oneko.cs index e63c56a..402cc73 100644 --- a/Oneko.cs +++ b/Oneko.cs @@ -20,7 +20,7 @@ abstract class Oneko : Drawable protected static List allNekos = []; public static ReadOnlyCollection AllNekos => allNekos.AsReadOnly(); - protected readonly static byte[] FallbackImg = EmbeddedResources.GetResource("nekos.oneko.png"); + protected readonly static Image FallbackImg = Raylib.LoadImageFromMemory(".png", EmbeddedResources.GetResource("nekos.oneko.png")); public Oneko() : base() { @@ -30,10 +30,16 @@ 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), 256, 128); + #if DEBUG + //Bitmap Serialization test + using Bitmap SerializeTest = Bitmap.FromPNGMemory(File.ReadAllBytes(SpriteSheetPath), 256, 128); + SpriteSheet = Bitmap.Deserialize(SerializeTest.Serialize()); + #else + SpriteSheet = Bitmap.FromPNGMemory(File.ReadAllBytes(SpriteSheetPath), 256, 128); + #endif } else { Console.WriteLine("Path to spritesheet was invalid or the file was too big, using the default."); - SpriteSheet = Bitmap.FromPNGMemory(FallbackImg, 256, 128); + SpriteSheet = new Bitmap(Raylib.ImageCopy(FallbackImg), 256, 128); } allNekos.Add(this); -- cgit