forked from rainmeter/rainmeter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGameMode.h
95 lines (69 loc) · 2.57 KB
/
GameMode.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
/* Copyright (C) 2021 Rainmeter Project Developers
*
* This Source Code Form is subject to the terms of the GNU General Public
* License; either version 2 of the License, or (at your option) any later
* version. If a copy of the GPL was not distributed with this file, You can
* obtain one at <https://www.gnu.org/licenses/gpl-2.0.html>. */
#ifndef __RAINMETER_GAMEMODE_H__
#define __RAINMETER_GAMEMODE_H__
class GameMode
{
public:
static GameMode& GetInstance();
void Initialize();
void OnTimerEvent(WPARAM wParam);
bool IsDisabled() { return m_State == State::Disabled; }
bool IsEnabled() { return m_State == State::Enabled; }
bool IsLayoutEnabled() { return m_State == State::LayoutEnabled; }
bool IsForcedExit() { return m_State == State::ForcedExit; }
std::wstring& GetOnStartAction() { return m_OnStartAction; }
void SetOnStartAction(const std::wstring& action);
void SetOnStartAction(UINT index);
std::wstring& GetOnStopAction() { return m_OnStopAction; }
void SetOnStopAction(const std::wstring& action);
void SetOnStopAction(UINT index);
bool GetFullScreenMode() { return m_FullScreenMode; }
void SetFullScreenMode(bool mode);
bool GetProcessListMode() { return m_ProcessListMode; }
void SetProcessListMode(bool mode);
std::wstring& GetProcessList() { return m_ProcessListOriginal; }
void SetProcessList(const std::wstring& list);
void ChangeStateManual(bool disable);
void ForceExit();
void ValidateActions();
bool HasBangOverride(LPCWSTR str);
static const std::vector<LPCWSTR>& GetBangOverrideList();
private:
enum class State : UINT
{
Disabled = 0U,
Enabled,
LayoutEnabled,
ForcedExit = 999U
};
GameMode();
~GameMode();
GameMode(const GameMode& other) = delete;
GameMode& operator=(GameMode other) = delete;
void StartTimer();
void StopTimer();
void SetSettings(const std::wstring& onStart, const std::wstring& onStop, bool fullScreenMode,
bool processListMode, std::wstring processList, bool init = false);
void ReadSettings();
void WriteSettings();
void EnterGameMode();
void ExitGameMode(bool force = false);
void LoadLayout(const std::wstring& layout);
State m_State;
std::wstring m_OnStartAction;
std::wstring m_OnStopAction;
bool m_FullScreenMode;
bool m_ProcessListMode;
std::vector<std::wstring> m_ProcessList;
std::wstring m_ProcessListOriginal;
static const UINT s_TimerInterval;
static const UINT_PTR s_TimerEventID;
};
// Convenience function.
inline GameMode& GetGameMode() { return GameMode::GetInstance(); }
#endif