-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApplication.hpp
55 lines (42 loc) · 1.23 KB
/
Application.hpp
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
#pragma once
#include "Vector.hpp"
#include <Windows.h>
#include <vector>
#include <unordered_map>
#include <memory>
#include <future>
class Application {
public:
int Initialize();
void Tick();
void Finalize();
inline bool Quit() const { return m_Quit; }
Application& DrawLines(const std::vector<Vec2>& lines);
Application& DrawLine(const Vec2& from, const Vec2& to) {
return DrawLines({from, to});
}
Application& MoveCursor(const Vec2& pos);
Vec2 GetCursor() const;
bool IsBilliardRun() const {
return GetDeskWindow();
}
const std::vector<uint8_t>& GetDeskImage() {
return m_DeskImage;
}
template <typename Func>
Application& AddCallback(int hotKeyId, Func&& func) {
m_CallBackFunc.emplace(hotKeyId, std::forward<Func>(func));
return *this;
}
private:
void UpdateCapture(HWND hwnd);
HWND GetDeskWindow() const;
static LRESULT CALLBACK WindowProc(HWND, UINT, WPARAM, LPARAM);
bool m_Init = false;
bool m_Quit = false;
int m_HotKeyD = 1;
int m_HotKeyF = 2;
HWND m_Window = 0;
std::unordered_map<int, std::function<void()>> m_CallBackFunc;
std::vector<uint8_t> m_DeskImage;
};