fix: 修复InputManager中文注释警告和完善Update逻辑
- InputManager.h: 移除中文注释修复C4819警告 - InputManager.h: 添加缺失的vector和unordered_map头文件 - InputManager.cpp: Update()现正确清除m_keyDownThisFrame状态 - InputManager.cpp: ProcessKeyDown/Up添加修饰键参数 - WindowsInputModule: 传递alt/ctrl/shift修饰键状态
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#include "InputEvent.h"
|
||||
#include "InputAxis.h"
|
||||
#include "Math/Vector2.h"
|
||||
#include <vector>
|
||||
#include <unordered_map>
|
||||
|
||||
namespace XCEngine {
|
||||
namespace Input {
|
||||
@@ -16,8 +18,6 @@ public:
|
||||
void Shutdown();
|
||||
void Update(float deltaTime);
|
||||
|
||||
// ============ 轮询接口 ============
|
||||
|
||||
bool IsKeyDown(KeyCode key) const;
|
||||
bool IsKeyUp(KeyCode key) const;
|
||||
bool IsKeyPressed(KeyCode key) const;
|
||||
@@ -32,8 +32,6 @@ public:
|
||||
int GetTouchCount() const;
|
||||
TouchState GetTouch(int index) const;
|
||||
|
||||
// ============ 轴接口 (参考 Unity) ============
|
||||
|
||||
float GetAxis(const Containers::String& axisName) const;
|
||||
float GetAxisRaw(const Containers::String& axisName) const;
|
||||
|
||||
@@ -45,18 +43,14 @@ public:
|
||||
void RegisterButton(const Containers::String& name, KeyCode key);
|
||||
void ClearAxes();
|
||||
|
||||
// ============ 事件接口 ============
|
||||
|
||||
Core::Event<const KeyEvent&>& OnKeyEvent() { return m_onKeyEvent; }
|
||||
Core::Event<const MouseButtonEvent&>& OnMouseButton() { return m_onMouseButton; }
|
||||
Core::Event<const MouseMoveEvent&>& OnMouseMove() { return m_onMouseMove; }
|
||||
Core::Event<const MouseWheelEvent&>& OnMouseWheel() { return m_onMouseWheel; }
|
||||
Core::Event<const TextInputEvent&>& OnTextInput() { return m_onTextInput; }
|
||||
|
||||
// ============ 内部方法(供 PlatformInputModule 调用) ============
|
||||
|
||||
void ProcessKeyDown(KeyCode key, bool repeat);
|
||||
void ProcessKeyUp(KeyCode key);
|
||||
void ProcessKeyDown(KeyCode key, bool repeat, bool alt, bool ctrl, bool shift, bool meta);
|
||||
void ProcessKeyUp(KeyCode key, bool alt, bool ctrl, bool shift, bool meta);
|
||||
void ProcessMouseMove(int x, int y, int deltaX, int deltaY);
|
||||
void ProcessMouseButton(MouseButton button, bool pressed, int x, int y);
|
||||
void ProcessMouseWheel(float delta, int x, int y);
|
||||
|
||||
Reference in New Issue
Block a user