summaryrefslogtreecommitdiff
path: root/Editor
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
parent164885fd98d48703bd771f802d79557b7db97431 (diff)
+ Penlight
Diffstat (limited to 'Editor')
-rw-r--r--Editor/FileSystem/FileWatcher.cpp3
-rw-r--r--Editor/FileSystem/FileWatcher.h16
-rw-r--r--Editor/GUI/GUIWindow.cpp1
-rw-r--r--Editor/GUI/WinUtils.h2
-rw-r--r--Editor/Win/Win.cpp65
-rw-r--r--Editor/Win/Win.h25
6 files changed, 110 insertions, 2 deletions
diff --git a/Editor/FileSystem/FileWatcher.cpp b/Editor/FileSystem/FileWatcher.cpp
new file mode 100644
index 0000000..443e0ac
--- /dev/null
+++ b/Editor/FileSystem/FileWatcher.cpp
@@ -0,0 +1,3 @@
+#include "FileWatcher.h"
+
+
diff --git a/Editor/FileSystem/FileWatcher.h b/Editor/FileSystem/FileWatcher.h
new file mode 100644
index 0000000..528fbe5
--- /dev/null
+++ b/Editor/FileSystem/FileWatcher.h
@@ -0,0 +1,16 @@
+#pragma once
+
+#include <string>
+#include "Runtime/Threading/Thread.h"
+
+// 检查某个指定文件夹中的文件或子文件夹是否被变动过。
+class FileWatcher : public Thread
+{
+public:
+
+
+private:
+ std::string m_WorkingDirectory;
+
+
+}; \ No newline at end of file
diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp
index 13249ac..fddc68d 100644
--- a/Editor/GUI/GUIWindow.cpp
+++ b/Editor/GUI/GUIWindow.cpp
@@ -2,6 +2,7 @@
#include "WinUtils.h"
#include "Runtime/Graphics/OpenGL.h"
#include "Editor/Graphics/Graphics.h"
+#include "Editor/Win/Win.h"
static bool RedirectMouseWheel(HWND window, WPARAM wParam, LPARAM lParam)
{
diff --git a/Editor/GUI/WinUtils.h b/Editor/GUI/WinUtils.h
index 9257d77..bef6420 100644
--- a/Editor/GUI/WinUtils.h
+++ b/Editor/GUI/WinUtils.h
@@ -5,7 +5,7 @@
namespace winutils
{
- HINSTANCE GetInstanceHandle();
+ HINSTANCE GetInstanceHandle();
// 注册windows窗口类
ATOM RegisterWindowClass(const wchar_t* className, WNDPROC windowProc, unsigned int style);
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
diff --git a/Editor/Win/Win.h b/Editor/Win/Win.h
index 8d7d85d..a60cb83 100644
--- a/Editor/Win/Win.h
+++ b/Editor/Win/Win.h
@@ -8,6 +8,10 @@
namespace Win
{
+ // 拿到当前程序的handle
+ HINSTANCE GetInstanceHandle();
+
+ // 当前工作目录
std::string GetCurrentWorkingDirectory();
void SetDllSearchDirectory(std::string path);
@@ -18,4 +22,23 @@ namespace Win
// 当前的执行是否在主线程
bool IsInMainThread();
-}
+ // 鼠标光标设置
+ enum ECursor
+ {
+ Cursor_AppStarting, // 标准的箭头和小沙漏
+ Cursor_Arrow, // 标准的箭头
+ Cursor_Cross, // 十字光标
+ Cursor_Help, // 标准的箭头和问号
+ Cursor_IBeam, // 工字光标
+ Cursor_NO, // 禁止圈
+ Cursor_SizeAll, // 四向箭头指向东、西、南、北
+ Cursor_SizeNESW, // 双箭头指向东北和西南
+ Cursor_SizeNS, // 双箭头指向南北
+ Cursor_SizeNWSE, // 双箭头指向西北和东南
+ Cursor_SizeWE, // 双箭头指向东西
+ Cursor_UpArrow, // 垂直箭头
+ Cursor_Wait, // 沙漏
+ };
+ void SetCursor(ECursor cursor);
+
+} \ No newline at end of file