-
Notifications
You must be signed in to change notification settings - Fork 21
/
menusettings.cpp
85 lines (67 loc) · 4.64 KB
/
menusettings.cpp
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
#include "menusettings.h"
#include <simpleini/SimpleIni.h>
#include "menucontrols.h"
#include "menukeyboard.h"
#include "menu.h"
#pragma warning(push)
#pragma warning(disable: 4244)
namespace NativeMenu {
MenuSettings::MenuSettings() { }
MenuSettings::~MenuSettings() { }
void MenuSettings::SetFiles(const std::string &menu) {
settingsMenuFile = menu;
}
void MenuSettings::ReadSettings(MenuControls *control, Menu *menuOpts) {
CSimpleIniA settingsMenu;
settingsMenu.SetUnicode();
settingsMenu.LoadFile(settingsMenuFile.c_str());
control->ControlKeys[MenuControls::ControlType::MenuKey] =
GetKeyFromName(settingsMenu.GetValue("MENU", "MenuKey", "VK_OEM_4"));
control->ControlKeys[MenuControls::ControlType::MenuUp] =
GetKeyFromName(settingsMenu.GetValue("MENU", "MenuUp", "UP"));
control->ControlKeys[MenuControls::ControlType::MenuDown] =
GetKeyFromName(settingsMenu.GetValue("MENU", "MenuDown", "DOWN"));
control->ControlKeys[MenuControls::ControlType::MenuLeft] =
GetKeyFromName(settingsMenu.GetValue("MENU", "MenuLeft", "LEFT"));
control->ControlKeys[MenuControls::ControlType::MenuRight] =
GetKeyFromName(settingsMenu.GetValue("MENU", "MenuRight", "RIGHT"));
control->ControlKeys[MenuControls::ControlType::MenuSelect] =
GetKeyFromName(settingsMenu.GetValue("MENU", "MenuSelect", "RETURN"));
control->ControlKeys[MenuControls::ControlType::MenuCancel] =
GetKeyFromName(settingsMenu.GetValue("MENU", "MenuCancel", "BACKSPACE"));
control->ControllerButton1 = settingsMenu.GetLongValue("MENU", "ControllerButton1", -1);
control->ControllerButton2 = settingsMenu.GetLongValue("MENU", "ControllerButton2", -1);
menuOpts->cheatString = settingsMenu.GetValue("MENU", "CheatString", "");
menuOpts->menuX = settingsMenu.GetDoubleValue("MENU", "MenuX", 0.0);
menuOpts->menuY = settingsMenu.GetDoubleValue("MENU", "MenuY", 0.0);
menuOpts->useSmoothScroll = settingsMenu.GetBoolValue("Navigation", "Smooth Scrolling", false);
menuOpts->smoothFactor = settingsMenu.GetDoubleValue("Navigation", "Smooth Factor", 0.00001);
// Title Text
menuOpts->titleTextColor.R = settingsMenu.GetLongValue("Title Text", "Red" , 255);
menuOpts->titleTextColor.G = settingsMenu.GetLongValue("Title Text", "Green", 255);
menuOpts->titleTextColor.B = settingsMenu.GetLongValue("Title Text", "Blue" , 255);
menuOpts->titleTextColor.A = settingsMenu.GetLongValue("Title Text", "Alpha", 255);
menuOpts->titleFont = settingsMenu.GetLongValue("Title Text", "Font" , 1);
menuOpts->titleBackgroundColor.R = settingsMenu.GetLongValue("Title Rect", "Red" , 255);
menuOpts->titleBackgroundColor.G = settingsMenu.GetLongValue("Title Rect", "Green", 255);
menuOpts->titleBackgroundColor.B = settingsMenu.GetLongValue("Title Rect", "Blue" , 255);
menuOpts->titleBackgroundColor.A = settingsMenu.GetLongValue("Title Rect", "Alpha", 255);
menuOpts->optionsBackgroundSelectColor.R = settingsMenu.GetLongValue("Scroller", "Red" , 255);
menuOpts->optionsBackgroundSelectColor.G = settingsMenu.GetLongValue("Scroller", "Green", 255);
menuOpts->optionsBackgroundSelectColor.B = settingsMenu.GetLongValue("Scroller", "Blue" , 255);
menuOpts->optionsBackgroundSelectColor.A = settingsMenu.GetLongValue("Scroller", "Alpha", 255);
menuOpts->optionsTextColor.R = settingsMenu.GetLongValue("Options Text", "Red" , 255);
menuOpts->optionsTextColor.G = settingsMenu.GetLongValue("Options Text", "Green", 255);
menuOpts->optionsTextColor.B = settingsMenu.GetLongValue("Options Text", "Blue" , 255);
menuOpts->optionsTextColor.A = settingsMenu.GetLongValue("Options Text", "Alpha", 255);
menuOpts->optionsFont = settingsMenu.GetLongValue("Options Text", "Font" , 0);
menuOpts->optionsBackgroundColor.R = settingsMenu.GetLongValue("Options Rect", "Red" , 0);
menuOpts->optionsBackgroundColor.G = settingsMenu.GetLongValue("Options Rect", "Green", 0);
menuOpts->optionsBackgroundColor.B = settingsMenu.GetLongValue("Options Rect", "Blue" , 0);
menuOpts->optionsBackgroundColor.A = settingsMenu.GetLongValue("Options Rect", "Alpha", 255);
}
void MenuSettings::SaveSettings() {
// Make an issue or do a PR or something when you want to have this implemented...
}
}
#pragma warning(pop)