-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFriendlyReminders.h
100 lines (82 loc) · 2.95 KB
/
FriendlyReminders.h
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
96
97
98
99
100
#pragma once
#include "bakkesmod/plugin/bakkesmodplugin.h"
#include "bakkesmod/plugin/pluginwindow.h"
#include "version.h"
constexpr auto plugin_version = stringify(VERSION_MAJOR) "." stringify(VERSION_MINOR) "." stringify(VERSION_PATCH) "." stringify(VERSION_BUILD);
// CVars declaration
extern const std::string CVAR_SHOW_GOAL_MESSAGES;
extern const std::string CVAR_SHOW_GAME_FINISHED_MESSAGES;
extern const std::string CVAR_COMBINE_MESSAGES;
extern const std::string CVAR_PICK_MESSAGE_METHOD;
extern const std::string CVAR_DISPLAY_MESSAGE_METHOD;
extern const std::string CVAR_DISPLAY_METHOD_CONFIGURABLE;
extern const std::string CVAR_GOAL_MESSAGES;
extern const std::string CVAR_GAME_FINISHED_MESSAGES;
extern const std::string CVAR_MESSAGE_SCALE;
extern const std::string CVAR_MESSAGE_POSITION_X;
extern const std::string CVAR_MESSAGE_POSITION_Y;
extern const std::string CVAR_MESSAGE_ANCHOR_X;
extern const std::string CVAR_MESSAGE_ANCHOR_Y;
enum class EventType
{
GoalScored,
GameFinished
};
class FriendlyReminders: public BakkesMod::Plugin::BakkesModPlugin, public BakkesMod::Plugin::PluginWindow
{
// BakkesModPlugin methods
virtual void onLoad();
virtual void onUnload();
private:
// CVars
std::shared_ptr<bool> show_goal_messages;
std::shared_ptr<bool> show_game_finished_messages;
std::shared_ptr<bool> combine_messages;
std::shared_ptr<std::string> pick_message_method;
std::shared_ptr<std::string> display_message_method;
std::shared_ptr<float> message_scale;
std::shared_ptr<float> message_position_x;
std::shared_ptr<float> message_position_y;
std::shared_ptr<float> message_anchor_x;
std::shared_ptr<float> message_anchor_y;
// CVar post-process results
std::vector<std::string> goalMessages = { "Drink some water!", "Check your posture!" };
std::vector<std::string> gameFinishedMessages = { "Do some push-ups!", "Do some sit-ups!" };
// Plugin flags
bool pluginLoaded = false;
bool isInMatch = false;
bool isInGoalReplay = false;
int goalMessageIndex = 0;
int gameFinishedMessageIndex = 0;
int combinedMessageIndex = 0;
std::string currentMessage = "";
int currentMessageIndex = 0;
// Canvas interface rendering
void RenderCanvas(CanvasWrapper);
// Hooks
void HookGoalScored();
void HookGoalReplayBegin();
void HookGoalReplayEnd();
void HookCountdownBegin();
void HookMatchEnded();
void HookLeaveMatch();
// Plugin methods
void UpdateDisplayMethod();
void OnEvent(EventType);
std::string GetNextMessage(EventType);
void DisplayExampleMessage(bool);
void DisplayMessage(std::string&, float);
// Utility methods
void SplitString(std::string&, char, std::vector<std::string>&);
// ImGui interface rendering
ImFont* menuFont;
std::string menuName = "friendlyreminders";
std::string GetMenuName() override;
std::string GetMenuTitle() override;
void SetImGuiContext(uintptr_t ctx) override;
bool ShouldBlockInput() override;
bool IsActiveOverlay() override;
void OnOpen() override;
void OnClose() override;
void Render() override;
};