diff --git a/Nerfed.Runtime/Assets/Textures/NerfedIcon.png b/Nerfed.Runtime/Assets/Textures/NerfedIcon.png new file mode 100644 index 0000000..8871620 --- /dev/null +++ b/Nerfed.Runtime/Assets/Textures/NerfedIcon.png @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4d1f92103b9e977e29680273bec93b44b40ed8977c4e2b1d6a539c21361492de +size 1134 diff --git a/Nerfed.Runtime/Window/Window.cs b/Nerfed.Runtime/Window/Window.cs index 42b9066..0bd536b 100644 --- a/Nerfed.Runtime/Window/Window.cs +++ b/Nerfed.Runtime/Window/Window.cs @@ -87,6 +87,14 @@ public Window(GraphicsDevice graphicsDevice, WindowCreateInfo windowCreateInfo) Width = (uint) width; Height = (uint) height; + unsafe + { + byte* pixels = ImageUtils.GetPixelDataFromFile(Path.Combine(System.AppContext.BaseDirectory, "Assets", "Textures", "NerfedIcon.png"), out uint w, out uint h, out uint size); + nint icon = SDL.SDL_CreateRGBSurfaceFrom(new IntPtr(pixels), (int)w, (int)h, 8 * 4, (int)w * 4, 0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000); + SDL.SDL_SetWindowIcon(Handle, icon); + ImageUtils.FreePixelData(pixels); + } + windowsById.Add(SDL.SDL_GetWindowID(Handle), this); }