GigaPasjans
Loading...
Searching...
No Matches
Common.h
1// Wykonane przez Piotra ChudziƄskiego w dniu 10.04.2025
2#pragma once
3
4#include "DataTypes.h"
5#include "Log.h"
6#include "Macro.h"
7#include "OOPHelper.h"
8#include "String/StringUtil.h"
9#include "WindowsKeycode.h"
10
11
12#include <memory>
13
14/*
15 * @brief Represents a mouse button.
16 **/
17enum class MouseButton : uint8
18{
19 None = 0,
20 Left = 1,
21 Right = 2,
22 Middle = 3
23};
24
25template<typename T>
26using UniqueRef = std::unique_ptr<T>;
27
28template<typename T>
29using SharedRef = std::shared_ptr<T>;
30
31template<typename T>
32using WeakRef = std::weak_ptr<T>;
33
34template<typename T>
35using EnableSharedFromThis = std::enable_shared_from_this<T>;
36
37static bool IsPtrValid(void *ptr)
38{
39 if (ptr == nullptr)
40 return false;
41
42 auto value = (reinterpret_cast<uint64>(ptr)) >> (64 - 8);
43
44 switch (value)
45 {
46 case 0xCD:
47 return false;
48 case 0xDD:
49 return false;
50 case 0xED:
51 case 0xBD:
52 return false;
53 case 0xFD:
54 return false;
55 case 0xFE:
56 return false;
57 case 0xCC:
58 return false;
59 default:
60 break;
61 }
62}