FCT
载入中...
搜索中...
未找到
InputStateEventHanndler.h
浏览该文件的文档.
1//
2// Created by Administrator on 2025/5/10.
3//
4
5#ifndef INPUTSTATEEVENTHANNDLER_H
6#define INPUTSTATEEVENTHANNDLER_H
7#include "./EventHandler.h"
8#include "./CallBackHandler.h"
9namespace FCT
10{
11 class Window;
12 using InputPosTransformCallback = std::function<bool(Vec2 pos,Vec2& ret)>;
14 {
15 protected:
18 void onResize(Window* wnd, int width, int height) override
19 {
20 m_resizeCallback(wnd, width, height);
21 }
22 void onMouseMove(Window* wnd, int x, int y) override
23 {
24
25 }
26 void onMouseWheel(Window* wnd, int delta) override
27 {
28
29 }
30 void onFileDrop(Window* wnd, const std::vector<std::string>& files) override
31 {
32
33 }
35 {
36 int delta;
40 char keyState[512];
41 InputState() : delta(0), mouseMove(0, 0),
42 mousePos(0, 0), mouseLastPos(0, 0),
43 keyState{}
44 {
45
46 }
47 void onSwap()
48 {
49 delta = 0;
50 }
52 char m_keyState[512];
55 public:
69 {
71 }
76 };
77}
78#endif //INPUTSTATEEVENTHANNDLER_H
InputPosTransformCallback getPosTransformCallback() const
void onResize(Window *wnd, int width, int height) override
void onMouseWheel(Window *wnd, int delta) override
void onMouseMove(Window *wnd, int x, int y) override
InputPosTransformCallback m_posTransformCallback
struct FCT::InputStateEventHandler::InputState m_inputState[2]
void setPosTransformCallback(const InputPosTransformCallback &cb)
void onFileDrop(Window *wnd, const std::vector< std::string > &files) override
void setResizeCallback(const ResizeCallBack &cb)
std::function< void(Window *wnd, int width, int height)> ResizeCallBack
std::function< bool(Vec2 pos, Vec2 &ret)> InputPosTransformCallback