summaryrefslogtreecommitdiff
path: root/Editor/Win/Win.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-30 11:32:16 +0800
committerchai <chaifix@163.com>2021-10-30 11:32:16 +0800
commit42ec7286b2d36a9ba22925f816a17cb1cc2aa5ce (patch)
tree24bc7009457a8d7500f264e89946dc20d069294f /Editor/Win/Win.cpp
parent164885fd98d48703bd771f802d79557b7db97431 (diff)
+ Penlight
Diffstat (limited to 'Editor/Win/Win.cpp')
-rw-r--r--Editor/Win/Win.cpp65
1 files changed, 65 insertions, 0 deletions
diff --git a/Editor/Win/Win.cpp b/Editor/Win/Win.cpp
index f6310e2..1081492 100644
--- a/Editor/Win/Win.cpp
+++ b/Editor/Win/Win.cpp
@@ -3,6 +3,17 @@
namespace Win
{
+ static HINSTANCE s_InstanceHandle = NULL;
+
+ HINSTANCE GetInstanceHandle()
+ {
+ if (s_InstanceHandle == NULL)
+ {
+ s_InstanceHandle = GetModuleHandle(NULL);
+ }
+ return s_InstanceHandle;
+ }
+
std::string GetCurrentWorkingDirectory()
{
char path[MAX_PATH];
@@ -15,4 +26,58 @@ namespace Win
SetDllDirectory(path.c_str());
}
+ //https://stackoverflow.com/questions/59608898/how-to-get-the-state-of-the-cursor
+ //https://iwoohaha.tistory.com/archive/20080917
+ void SetCursor(ECursor cursor)
+ {
+ LPCSTR name = IDC_ARROW;
+ switch (cursor)
+ {
+ case Win::Cursor_AppStarting:
+ name = IDC_APPSTARTING;
+ break;
+ case Win::Cursor_Arrow:
+ name = IDC_ARROW;
+ break;
+ case Win::Cursor_Cross:
+ name = IDC_CROSS;
+ break;
+ case Win::Cursor_Help:
+ name = IDC_HELP;
+ break;
+ case Win::Cursor_IBeam:
+ name = IDC_IBEAM;
+ break;
+ case Win::Cursor_NO:
+ name = IDC_NO;
+ break;
+ case Win::Cursor_SizeAll:
+ name = IDC_SIZEALL;
+ break;
+ case Win::Cursor_SizeNESW:
+ name = IDC_SIZENESW;
+ break;
+ case Win::Cursor_SizeNS:
+ name = IDC_SIZENS;
+ break;
+ case Win::Cursor_SizeNWSE:
+ name = IDC_SIZENWSE;
+ break;
+ case Win::Cursor_SizeWE:
+ name = IDC_SIZEWE;
+ break;
+ case Win::Cursor_UpArrow:
+ name = IDC_UPARROW;
+ break;
+ case Win::Cursor_Wait:
+ name = IDC_WAIT;
+ break;
+ default:
+ name = IDC_ARROW;
+ break;
+ }
+ HCURSOR hCursor = LoadCursorA(NULL, name);
+ ::SetCursor(hCursor);
+ }
+
} \ No newline at end of file