-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMicroIcon.cpp
More file actions
76 lines (62 loc) · 1.79 KB
/
MicroIcon.cpp
File metadata and controls
76 lines (62 loc) · 1.79 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
//
// by Weikton 05.09.23
//
#include "main.h"
#include "game/common.h"
#include "game/util.h"
#include "MicroIcon.h"
#include "PluginConfig.h"
bool MicroIcon::Init() noexcept
{
if(MicroIcon::initStatus)
return false;
try
{
MicroIcon::tPassiveIcon = (RwTexture*)LoadTextureFromDB("samp", "voice_off");
MicroIcon::tActiveIcon = (RwTexture*)LoadTextureFromDB("samp", "voice_on");
MicroIcon::tMutedIcon = (RwTexture*)LoadTextureFromDB("samp", "voice_off");
LogVoice("[sv:suc:microicon:init] [MicroIcon::Init]: create icons success");
}
catch(const std::exception& exception)
{
LogVoice("[sv:err:microicon:init] : failed to create icons");
MicroIcon::tPassiveIcon = nullptr;
MicroIcon::tActiveIcon = nullptr;
MicroIcon::tMutedIcon = nullptr;
return false;
}
if(!PluginConfig::IsMicroLoaded())
{
PluginConfig::SetMicroLoaded(true);
}
MicroIcon::initStatus = true;
return true;
}
void MicroIcon::Free() noexcept
{
if(!MicroIcon::initStatus)
return;
MicroIcon::tPassiveIcon = nullptr;
MicroIcon::tActiveIcon = nullptr;
MicroIcon::tMutedIcon = nullptr;
MicroIcon::initStatus = false;
}
void MicroIcon::Show() noexcept
{
MicroIcon::hasShowed = true;
MicroIcon::showStatus = true;
}
bool MicroIcon::IsShowed() noexcept
{
return MicroIcon::showStatus;
}
void MicroIcon::Hide() noexcept
{
MicroIcon::showStatus = false;
}
bool MicroIcon::initStatus { false };
bool MicroIcon::showStatus { false };
bool MicroIcon::hasShowed { false };
RwTexture* MicroIcon::tPassiveIcon { nullptr };
RwTexture* MicroIcon::tActiveIcon { nullptr };
RwTexture* MicroIcon::tMutedIcon { nullptr };