forked from leftspace89/pPlat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathComponentBase.hpp
85 lines (68 loc) · 1.61 KB
/
ComponentBase.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
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
#pragma once
#ifndef COMPONENTBASE
#define COMPONENTBASE
//team
extern std::vector<DWORD>pComponents;
extern std::vector<DWORD>teamheroes;
extern std::vector<DWORD>teaminions;
extern std::vector<DWORD>teamturrets;
extern std::vector<DWORD>teaminhibs;
// enemy
extern std::vector<DWORD>enemyheroes;
extern std::vector<DWORD>enemyminions;
extern std::vector<DWORD>enemyturrets;
extern std::vector<DWORD>enemyinhibs;
class pComponent
{
public:
pComponent(){};
~pComponent() {};
virtual void onStart() = 0;
virtual void onUpdate() = 0;
virtual void onRender() = 0;
virtual void onMenu() = 0;
virtual void onProcessSpell(SpellData*spelldata,SpellCastInfo*spellcastinfo) = 0;
void Add()
{
pComponents.push_back(reinterpret_cast<DWORD>(this));
}
static void ComponentsEvent_onRender()
{
for (DWORD pPtr : pComponents)
{
pComponent*component = reinterpret_cast<pComponent*>(pPtr);
component->onRender();
}
}
static void ComponentsEvent_onUpdate()
{
for (DWORD pPtr : pComponents)
{
pComponent*component = reinterpret_cast<pComponent*>(pPtr);
component->onUpdate();
}
}
static void ComponentEvents_onStart()
{
Obj_AI_Base::ApplyHooks();
Spellbook::ApplyHooks();
for (DWORD pPtr : pComponents)
{
pComponent*component = reinterpret_cast<pComponent*>(pPtr);
component->onStart();
}
}
static void ComponentEvents_onMenu()
{
for (DWORD pPtr : pComponents)
{
pComponent*component = reinterpret_cast<pComponent*>(pPtr);
component->onMenu();
}
}
char classname[255];
char Heroname[255];
char version[255];
private:
};
#endif // ! COMPONENTBASE