diff options
Diffstat (limited to 'Editor/Win/Win.cpp')
-rw-r--r-- | Editor/Win/Win.cpp | 65 |
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 |