forked from Ilyaki/ProtoInput
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFakeCursor.h
More file actions
95 lines (73 loc) · 1.87 KB
/
Copy pathFakeCursor.h
File metadata and controls
95 lines (73 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#pragma once
#include <mutex>
#include <windows.h>
namespace Proto
{
class FakeCursor
{
std::mutex mutex{};
std::condition_variable conditionvar{};
HWND pointerWindow = nullptr;
HDC hdc;
HBRUSH transparencyBrush;
HCURSOR hCursor;
static constexpr auto transparencyKey = RGB(0, 0, 1);
int oldX, oldY;
bool oldHadShowCursor = true;
//TODO: width/height probably needs to change
// DrawFakeCursorFix. cursor offset scan and cursor size fix
int cursoroffsetx, cursoroffsety;
int offsetSET; //0:sizing 1:offset 2:done
int cursorWidth = 40;
int cursorHeight = 40;
// This is either on or off for a given game (ie. it doesn't change)
bool drawingEnabled = false;
// This changes when the hook detects SetCursor/ShowCursor
bool showCursor = true;
bool toggleVisilbityShorcutEnabled = false;
unsigned int toggleVisibilityVkey = VK_HOME;
void DrawCursor();
public:
static FakeCursor state;
bool DrawFakeCursorFix;
void StartInternal();
void StartDrawLoopInternal();
void UpdatePointerWindowLoopInternal(); // Checks the selected window dimensions.
void GetWindowDimensions(HWND hWnd); // For pointerWindow
static bool& GetToggleVisilbityShorcutEnabled()
{
return state.toggleVisilbityShorcutEnabled;
}
static unsigned int& GetToggleVisibilityVkey()
{
return state.toggleVisibilityVkey;
}
static void NotifyUpdatedCursorPosition()
{
state.conditionvar.notify_one();
}
static bool IsDrawingEnabled()
{
return state.drawingEnabled;
}
static HWND GetPointerWindow()
{
return state.pointerWindow;
}
static void SetCursorVisibility(bool visible)
{
state.showCursor = visible;
NotifyUpdatedCursorPosition();
}
static bool GetCursorVisibility()
{
return state.showCursor;
}
static void SetCursorHandle(HCURSOR newCursor)
{
state.hCursor = newCursor;
}
static void EnableDisableFakeCursor(bool enable);
static void Initialise();
};
}