From 13f477664c07826c92eac774f0035994c460c057 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 8 Nov 2021 11:32:32 +0800 Subject: *misc --- "Documents/\350\276\223\345\205\245.xlsx" | Bin 0 -> 10208 bytes Editor/GUI/GUIWindow.cpp | 22 ++++++++++----------- Projects/VisualStudio/Editor/Editor.vcxproj | 1 + .../VisualStudio/Editor/Editor.vcxproj.filters | 3 +++ Runtime/Events/InputEvent.cpp | 9 ++++++++- Runtime/Events/InputEvent.h | 3 +++ Runtime/Events/KeyCode.h | 3 +++ 7 files changed, 28 insertions(+), 13 deletions(-) create mode 100644 "Documents/\350\276\223\345\205\245.xlsx" create mode 100644 Runtime/Events/KeyCode.h diff --git "a/Documents/\350\276\223\345\205\245.xlsx" "b/Documents/\350\276\223\345\205\245.xlsx" new file mode 100644 index 0000000..2a4dafb Binary files /dev/null and "b/Documents/\350\276\223\345\205\245.xlsx" differ diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp index 16cf768..1a9ea00 100644 --- a/Editor/GUI/GUIWindow.cpp +++ b/Editor/GUI/GUIWindow.cpp @@ -29,10 +29,8 @@ static bool RedirectMouseWheel(HWND window, WPARAM wParam, LPARAM lParam) LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { -//#if GAMELAB_DEBUG -// static int _event_count = 0; -// log_info_tag("WndProc", "GUIWindow Event %d", ++_event_count); -//#endif + static int _event_count = 0; + ++_event_count; GUIWindow* self = (GUIWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (!self) @@ -51,7 +49,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara { static PAINTSTRUCT ps; - log_info_tag("WndProc", "WM_PAINT"); + log_info_tag("WndProc", "WM_PAINT %d", _event_count); self->SetAsRenderContext(); self->OnPaint(); @@ -64,7 +62,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara case WM_MOUSEWHEEL: // 在这个子窗口滚动 { - log_info_tag("WndProc","WM_MOUSEWHEEL"); + log_info_tag("WndProc","WM_MOUSEWHEEL %d", _event_count); // quick check if mouse is in our window RECT rc; @@ -105,7 +103,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara case WM_CHAR: case WM_MOUSEMOVE: { - log_info_tag("WndProc", "Mouse Or Key Events"); + log_info_tag("WndProc", "Mouse Or Key Events %d", _event_count); switch (message) { @@ -153,7 +151,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara case WM_WINDOWPOSCHANGED: { - log_info_tag("WndProc", "WM_WINDOWPOSCHANGED"); + log_info_tag("WndProc", "WM_WINDOWPOSCHANGED %d", _event_count); // 切换opengl渲染目标,重绘用户区 //if (self->m_GfxWindow) @@ -177,12 +175,12 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara } case WM_SETFOCUS: //获得焦点 - log_info_tag("WndProc", "WM_SETFOCUS"); + log_info_tag("WndProc", "WM_SETFOCUS %d", _event_count); self->OnFocus(); return 0; case WM_KILLFOCUS: //失去焦点 - log_info_tag("WndProc", "WM_KILLFOCUS"); + log_info_tag("WndProc", "WM_KILLFOCUS %d", _event_count); return 0; @@ -190,12 +188,12 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara break; case WM_CLOSE: - log_info_tag("WndProc", "WM_CLOSE"); + log_info_tag("WndProc", "WM_CLOSE %d", _event_count); delete self; return 0; case WM_INITMENUPOPUP: //下拉菜单或子菜单将要被激活的时候 - log_info_tag("WndProc", "WM_INITMENUPOPUP"); + log_info_tag("WndProc", "WM_INITMENUPOPUP %d", _event_count); return 0; } diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj b/Projects/VisualStudio/Editor/Editor.vcxproj index 5231a28..3ebe2b5 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj +++ b/Projects/VisualStudio/Editor/Editor.vcxproj @@ -267,6 +267,7 @@ + diff --git a/Projects/VisualStudio/Editor/Editor.vcxproj.filters b/Projects/VisualStudio/Editor/Editor.vcxproj.filters index d4fb6b7..f868707 100644 --- a/Projects/VisualStudio/Editor/Editor.vcxproj.filters +++ b/Projects/VisualStudio/Editor/Editor.vcxproj.filters @@ -744,6 +744,9 @@ Editor\GUI + + Runtime\Events + diff --git a/Runtime/Events/InputEvent.cpp b/Runtime/Events/InputEvent.cpp index ac41c94..e062bc2 100644 --- a/Runtime/Events/InputEvent.cpp +++ b/Runtime/Events/InputEvent.cpp @@ -1,12 +1,19 @@ #include "InputEvent.h" +InputEvent::InputEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + +} + void InputEvent::CastToTable(LuaBind::State& state) { lua_newtable(state); int table = state.GetTop(); + // "type" lua_pushnumber(state, type); lua_setfield(state, table, "type"); + // "mousePosition" -} +} \ No newline at end of file diff --git a/Runtime/Events/InputEvent.h b/Runtime/Events/InputEvent.h index 5a5ed36..6069c85 100644 --- a/Runtime/Events/InputEvent.h +++ b/Runtime/Events/InputEvent.h @@ -1,5 +1,6 @@ #pragma once +#include #include "Runtime/Lua/LuaHelper.h" #include "Runtime/Math/Math.h" @@ -49,6 +50,8 @@ struct InputEvent : public LuaBind::INativeTable bool use; + InputEvent(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + void CastToTable(LuaBind::State& state) override; }; \ No newline at end of file diff --git a/Runtime/Events/KeyCode.h b/Runtime/Events/KeyCode.h new file mode 100644 index 0000000..96786d7 --- /dev/null +++ b/Runtime/Events/KeyCode.h @@ -0,0 +1,3 @@ +#pragma once + + -- cgit v1.1-26-g67d0