mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Added Window.SetIcon
This commit is contained in:
@@ -250,6 +250,18 @@ namespace GlitchyEngine
|
|||||||
[CLink]
|
[CLink]
|
||||||
static extern IntBool IsWindowUnicode(HWND whnd);
|
static extern IntBool IsWindowUnicode(HWND whnd);
|
||||||
|
|
||||||
|
public Result<void> SetIcon(StringView filePath)
|
||||||
|
{
|
||||||
|
HICON hIcon = LoadImageW(0, filePath.ToScopedNativeWChar!(), .Icon, 0, 0, .LoadFromFile);
|
||||||
|
if (hIcon == 0)
|
||||||
|
return .Err;
|
||||||
|
|
||||||
|
// WM_SETICON 0x0080
|
||||||
|
SendMessageW(_windowHandle, 0x0080, 1 /* ICON_BIG */, (int)hIcon);
|
||||||
|
|
||||||
|
return .Ok;
|
||||||
|
}
|
||||||
|
|
||||||
private static LRESULT MessageHandler(HWND hwnd, uint32 uMsg, WPARAM wParam, LPARAM lParam)
|
private static LRESULT MessageHandler(HWND hwnd, uint32 uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
void* windowPtr = (void*)GetWindowLongPtrW(hwnd, GWL_USERDATA);
|
void* windowPtr = (void*)GetWindowLongPtrW(hwnd, GWL_USERDATA);
|
||||||
|
|||||||
@@ -110,5 +110,10 @@ namespace GlitchyEngine
|
|||||||
}
|
}
|
||||||
|
|
||||||
public extern void Update();
|
public extern void Update();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the Icon of the window to the given file.
|
||||||
|
*/
|
||||||
|
public extern Result<void> SetIcon(StringView filePath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user