MCPcopy Create free account
hub / github.com/ChiyukiGana/Quickinput / RecordInput

Function RecordInput

source/src/input.cpp:5–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3QiMouseTrack mouseTrack;
4clock_t mouseTrack_prev = 0;
5void RecordInput(BYTE vk, bool state, POINT pt)
6{
7 if (Input::isMouse(vk) && InRect(Window::rect((HWND)Qi::widget.record->winId()), Input::pos())) return;
8 if (Qi::recordWindow && !IsWindowVisible(Qi::recordWindow))
9 {
10 Qi::widget.recordClose();
11 Qi::popText->Popup(2000, "窗口已失效", RGB(255, 64, 64));
12 }
13
14 if (vk)
15 {
16 // delay
17 if (Qi::recordClock)
18 {
19 clock_t nowClock = clock();
20 if (mouseTrack.s.empty())
21 {
22 QiDelay delay;
23 delay.max = delay.min = nowClock - Qi::recordClock;
24 Qi::record.append(std::move(delay));
25 }
26 else
27 {
28 Qi::record.append(std::move(mouseTrack));
29 mouseTrack.reset();
30 }
31 Qi::recordClock = nowClock;
32 }
33 else
34 {
35 Qi::recordClock = clock();
36 mouseTrack.reset();
37 }
38 // mouse
39 if (Input::isMouse(vk))
40 {
41 QiMouse mouse;
42 POINT position;
43 if (Qi::recordWindow)
44 {
45 POINT wpt = Window::pos(Qi::recordWindow);
46 position = QiCvt::WP_RtA({ pt.x - wpt.x, pt.y - wpt.y }, Qi::recordWindow);
47 }
48 else
49 {
50 position = QiCvt::SP_RtA(pt);
51 }
52 mouse.x = position.x;
53 mouse.y = position.y;
54 Qi::record.append(std::move(mouse));
55 }
56 // key
57 {
58 QiKey key;
59 key.vk = vk;
60 if (state) key.state = QiKey::down;
61 else key.state = QiKey::up;
62 Qi::record.append(std::move(key));

Callers 1

InputTaskFunction · 0.85

Calls 7

InRectFunction · 0.85
WP_RtAFunction · 0.85
SP_RtAFunction · 0.85
recordCloseMethod · 0.80
PopupMethod · 0.80
appendMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected