11#include " SettingsManager.h"
22#include " SentCacheManager.h"
33
4+ using namespace geode ::prelude;
5+
46// First initialize all the parameters
57CustomStruct::DisplaySettings SettingsManager::Display = {
6- static_cast < int >( geode:: Mod::get ()->getSettingValue <int64_t >(" text-width-offset" ) ),
7- static_cast < int >( geode:: Mod::get ()->getSettingValue <int64_t >(" text-height-offset" ) ),
8- static_cast < float >( geode:: Mod::get ()->getSettingValue <double >(" text-size" ) ),
9- static_cast <int >(round (static_cast < double >( geode:: Mod::get ()->getSettingValue <int64_t >(" text-opacity" )) / 100 * 255 )),
10- geode:: Mod::get ()->getSettingValue <cocos2d:: ccColor3B>(" text-color" ),
11- geode:: Mod::get ()->getSettingValue <std::string>(" number-separator" )
8+ Mod::get ()->getSettingValue <int >(" text-width-offset" ),
9+ Mod::get ()->getSettingValue <int >(" text-height-offset" ),
10+ Mod::get ()->getSettingValue <float >(" text-size" ),
11+ static_cast <int >(round (Mod::get ()->getSettingValue <int >(" text-opacity" ) / 100 . f * 255 )),
12+ Mod::get ()->getSettingValue <ccColor3B>(" text-color" ),
13+ Mod::get ()->getSettingValue <std::string>(" number-separator" )
1214};
1315
1416CustomStruct::ToggleSettings SettingsManager::Toggles = {
15- geode:: Mod::get ()->getSettingValue <bool >(" show-requested-stars" ),
16- geode:: Mod::get ()->getSettingValue <bool >(" show-featured-rank" ),
17- geode:: Mod::get ()->getSettingValue <bool >(" show-object-count" ),
18- geode:: Mod::get ()->getSettingValue <bool >(" show-ldm-object-count" ),
19- geode:: Mod::get ()->getSettingValue <bool >(" show-game-version" ),
20- geode:: Mod::get ()->getSettingValue <bool >(" show-level-version" ),
21- geode:: Mod::get ()->getSettingValue <bool >(" show-ldm-existence" ),
22- geode:: Mod::get ()->getSettingValue <bool >(" show-sent" ),
23- geode:: Mod::get ()->getSettingValue <bool >(" show-level-id" ),
24- geode:: Mod::get ()->getSettingValue <bool >(" show-original-level-id" ),
25- geode:: Mod::get ()->getSettingValue <bool >(" show-two-player-mode" ),
26- geode:: Mod::get ()->getSettingValue <bool >(" show-editor-time" ),
27- geode:: Mod::get ()->getSettingValue <bool >(" show-editor-time-copies" ),
28- geode:: Mod::get ()->getSettingValue <bool >(" show-attempts" ),
29- geode:: Mod::get ()->getSettingValue <bool >(" show-jumps" ),
30- geode:: Mod::get ()->getSettingValue <bool >(" show-clicks" ),
31- geode:: Mod::get ()->getSettingValue <bool >(" show-attempt-time" )
17+ Mod::get ()->getSettingValue <bool >(" show-requested-stars" ),
18+ Mod::get ()->getSettingValue <bool >(" show-featured-rank" ),
19+ Mod::get ()->getSettingValue <bool >(" show-object-count" ),
20+ Mod::get ()->getSettingValue <bool >(" show-ldm-object-count" ),
21+ Mod::get ()->getSettingValue <bool >(" show-game-version" ),
22+ Mod::get ()->getSettingValue <bool >(" show-level-version" ),
23+ Mod::get ()->getSettingValue <bool >(" show-ldm-existence" ),
24+ Mod::get ()->getSettingValue <bool >(" show-sent" ),
25+ Mod::get ()->getSettingValue <bool >(" show-level-id" ),
26+ Mod::get ()->getSettingValue <bool >(" show-original-level-id" ),
27+ Mod::get ()->getSettingValue <bool >(" show-two-player-mode" ),
28+ Mod::get ()->getSettingValue <bool >(" show-editor-time" ),
29+ Mod::get ()->getSettingValue <bool >(" show-editor-time-copies" ),
30+ Mod::get ()->getSettingValue <bool >(" show-attempts" ),
31+ Mod::get ()->getSettingValue <bool >(" show-jumps" ),
32+ Mod::get ()->getSettingValue <bool >(" show-clicks" ),
33+ Mod::get ()->getSettingValue <bool >(" show-attempt-time" )
3234};
3335
3436// There is DEFINETELY a better way to do this but if it works it works
3537$execute {
3638 // Display Settings
37- geode:: listenForSettingChanges<int64_t >(" text-width-offset" , [](int64_t offset) {
38- SettingsManager::Display.widthOffset = static_cast < int >( offset) ;
39+ listenForSettingChanges<int >(" text-width-offset" , [](int offset) {
40+ SettingsManager::Display.widthOffset = offset;
3941 });
40- geode:: listenForSettingChanges<int64_t >(" text-height-offset" , [](int64_t offset) {
41- SettingsManager::Display.heightOffset = static_cast < int >( offset) ;
42+ listenForSettingChanges<int >(" text-height-offset" , [](int offset) {
43+ SettingsManager::Display.heightOffset = offset;
4244 });
43- geode:: listenForSettingChanges<double >(" text-size" , [](double size) {
44- SettingsManager::Display.size = static_cast < float >( size) ;
45+ listenForSettingChanges<float >(" text-size" , [](float size) {
46+ SettingsManager::Display.size = size;
4547 });
46- geode:: listenForSettingChanges<int64_t >(" text-opacity" , [](int64_t opacity) {
48+ listenForSettingChanges<int >(" text-opacity" , [](int opacity) {
4749 SettingsManager::Display.opacity = static_cast <int >(round (opacity / 100 .f * 255 ));
4850 });
49- geode:: listenForSettingChanges<cocos2d:: ccColor3B>(" text-color" , [](cocos2d:: ccColor3B color) {
51+ listenForSettingChanges<ccColor3B>(" text-color" , [](ccColor3B color) {
5052 SettingsManager::Display.color = color;
5153 });
52- geode:: listenForSettingChanges<std::string>(" number-separator" , [](std::string separator) {
54+ listenForSettingChanges<std::string>(" number-separator" , [](std::string_view separator) {
5355 SettingsManager::Display.separator = separator;
5456 });
5557
5658 // Toggles Settings
57- geode:: listenForSettingChanges<bool >(" show-requested-stars" , [](bool enabled) {
59+ listenForSettingChanges<bool >(" show-requested-stars" , [](bool enabled) {
5860 SettingsManager::Toggles.requestedStars = enabled;
5961 });
60- geode:: listenForSettingChanges<bool >(" show-featured-rank" , [](bool enabled) {
62+ listenForSettingChanges<bool >(" show-featured-rank" , [](bool enabled) {
6163 SettingsManager::Toggles.featuredRank = enabled;
6264 });
63- geode:: listenForSettingChanges<bool >(" show-object-count" , [](bool enabled) {
65+ listenForSettingChanges<bool >(" show-object-count" , [](bool enabled) {
6466 SettingsManager::Toggles.objectCount = enabled;
6567 });
66- geode:: listenForSettingChanges<bool >(" show-ldm-object-count" , [](bool enabled) {
68+ listenForSettingChanges<bool >(" show-ldm-object-count" , [](bool enabled) {
6769 SettingsManager::Toggles.ldmObjectCount = enabled;
6870 });
69- geode:: listenForSettingChanges<bool >(" show-game-version" , [](bool enabled) {
71+ listenForSettingChanges<bool >(" show-game-version" , [](bool enabled) {
7072 SettingsManager::Toggles.gameVersion = enabled;
7173 });
72- geode:: listenForSettingChanges<bool >(" show-level-version" , [](bool enabled) {
74+ listenForSettingChanges<bool >(" show-level-version" , [](bool enabled) {
7375 SettingsManager::Toggles.levelVersion = enabled;
7476 });
75- geode:: listenForSettingChanges<bool >(" show-ldm-existence" , [](bool enabled) {
77+ listenForSettingChanges<bool >(" show-ldm-existence" , [](bool enabled) {
7678 SettingsManager::Toggles.ldmExistence = enabled;
7779 });
78- geode:: listenForSettingChanges<bool >(" show-sent" , [](bool enabled) {
80+ listenForSettingChanges<bool >(" show-sent" , [](bool enabled) {
7981 if (!enabled)
8082 SentCacheManager::Clear ();
8183
8284 SettingsManager::Toggles.sent = enabled;
8385 });
84- geode:: listenForSettingChanges<bool >(" show-level-id" , [](bool enabled) {
86+ listenForSettingChanges<bool >(" show-level-id" , [](bool enabled) {
8587 SettingsManager::Toggles.levelID = enabled;
8688 });
87- geode:: listenForSettingChanges<bool >(" show-original-level-id" , [](bool enabled) {
89+ listenForSettingChanges<bool >(" show-original-level-id" , [](bool enabled) {
8890 SettingsManager::Toggles.originalLevel = enabled;
8991 });
90- geode:: listenForSettingChanges<bool >(" show-two-player-mode" , [](bool enabled) {
92+ listenForSettingChanges<bool >(" show-two-player-mode" , [](bool enabled) {
9193 SettingsManager::Toggles.twoPlayerMode = enabled;
9294 });
93- geode:: listenForSettingChanges<bool >(" show-editor-time" , [](bool enabled) {
95+ listenForSettingChanges<bool >(" show-editor-time" , [](bool enabled) {
9496 SettingsManager::Toggles.editorTime = enabled;
9597 });
96- geode:: listenForSettingChanges<bool >(" show-editor-time-copies" , [](bool enabled) {
98+ listenForSettingChanges<bool >(" show-editor-time-copies" , [](bool enabled) {
9799 SettingsManager::Toggles.editorTimeCopies = enabled;
98100 });
99- geode:: listenForSettingChanges<bool >(" show-attempts" , [](bool enabled) {
101+ listenForSettingChanges<bool >(" show-attempts" , [](bool enabled) {
100102 SettingsManager::Toggles.attempts = enabled;
101103 });
102- geode:: listenForSettingChanges<bool >(" show-jumps" , [](bool enabled) {
104+ listenForSettingChanges<bool >(" show-jumps" , [](bool enabled) {
103105 SettingsManager::Toggles.jumps = enabled;
104106 });
105- geode:: listenForSettingChanges<bool >(" show-clicks" , [](bool enabled) {
107+ listenForSettingChanges<bool >(" show-clicks" , [](bool enabled) {
106108 SettingsManager::Toggles.clicks = enabled;
107109 });
108- geode:: listenForSettingChanges<bool >(" show-attempt-time" , [](bool enabled) {
110+ listenForSettingChanges<bool >(" show-attempt-time" , [](bool enabled) {
109111 SettingsManager::Toggles.attemptTime = enabled;
110112 });
111113};
0 commit comments