From bc5623e4621e2957a6458f599a97c228fbd83d9a Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 3 Jul 2025 10:24:30 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4Window::input=5Fevent?= =?UTF-8?q?=EF=BC=8C=E5=87=8F=E5=B0=91=E4=B8=80=E6=AC=A1=E4=BC=A0=E9=80=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inc/hgl/platform/Window.h | 12 +----------- src/Win/WinWindow.cpp | 2 +- src/Window.cpp | 5 +---- 3 files changed, 3 insertions(+), 16 deletions(-) diff --git a/inc/hgl/platform/Window.h b/inc/hgl/platform/Window.h index f0ed89e..65165f5 100644 --- a/inc/hgl/platform/Window.h +++ b/inc/hgl/platform/Window.h @@ -1,5 +1,4 @@ -#ifndef HGL_GRAPH_WINDOW_INCLUDE -#define HGL_GRAPH_WINDOW_INCLUDE +#pragma once #include #include @@ -21,14 +20,6 @@ namespace hgl protected: - /** - * 外部输入事件
- * 比如Windows平台,是由WindowProc函数传递过来的。 - * 本事件传递器会呼叫io::WindowEvent的对象指针,在本类中指向的是自己。
- * 注:仅当前类会如此设计,本身此Event是要放在外面的,不该在此级别。 - */ - io::EventDispatch input_event; - void OnResize(uint,uint) override; void OnActive(bool) override; void OnClose () override; @@ -71,4 +62,3 @@ namespace hgl void InitNativeWindowSystem(); }//namespace hgl -#endif//HGL_GRAPH_WINDOW_INCLUDE diff --git a/src/Win/WinWindow.cpp b/src/Win/WinWindow.cpp index 04d67e2..12b0677 100644 --- a/src/Win/WinWindow.cpp +++ b/src/Win/WinWindow.cpp @@ -83,7 +83,7 @@ namespace hgl } win_dc = GetDC(win_hwnd); - SetWindowLongPtrW(win_hwnd, GWLP_USERDATA, (LONG_PTR)&input_event); + SetWindowLongPtrW(win_hwnd, GWLP_USERDATA, (LONG_PTR)this); return(true); } diff --git a/src/Window.cpp b/src/Window.cpp index bf6120e..3a6b97a 100644 --- a/src/Window.cpp +++ b/src/Window.cpp @@ -10,8 +10,6 @@ namespace hgl active=false; is_close=true; is_min=false; - - input_event.RegisterEventDispatch(this); } void Window::OnResize(uint w,uint h) @@ -38,8 +36,7 @@ namespace hgl } void Window::OnClose() - { - input_event.UnregisterEventDispatch(this); + { is_close=true; }