-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathSettings.cpp
95 lines (76 loc) · 1.76 KB
/
Settings.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
86
87
88
89
90
91
92
93
94
95
#include "Settings.h"
#include <fstream>
const char* SettingFileName = "MapTool.setting";
Settings::Settings()
{
m_fpsMilliSeconds = 100;
LoadSetting();
}
Settings::~Settings()
{
//dtor
}
Settings Settings::TheSetting = Settings();
void Settings::LoadSetting()
{
std::ifstream file(SettingFileName);
if(file.is_open())
{
file >> m_fpsMilliSeconds;
if(!file.eof())
{
file >> MapToolX;
file >> MapToolY;
file >> MapToolWidth;
file >> MapToolHeight;
file >> NpcDialogX;
file >> NpcDialogY;
file >> NpcDialogWidth;
file >> NpcDialogHeight;
file >> ObjDialogX;
file >> ObjDialogY;
file >> ObjDialogWidth;
file >> ObjDialogHeight;
}
if(!file.eof())
{
file >> NpcDetailDescBoxHeight;
file >> NpcDetailSpliterPos;
file >> ObjDetailDescBoxHeight;
file >> ObjDetailSpliterPos;
}
}
}
void Settings::SaveSetting()
{
std::ofstream file(SettingFileName);
if(file.is_open())
{
file << m_fpsMilliSeconds << "\n";
file << MapToolX << "\n";
file << MapToolY << "\n";
file << MapToolWidth << "\n";
file << MapToolHeight << "\n";
file << NpcDialogX << "\n";
file << NpcDialogY << "\n";
file << NpcDialogWidth << "\n";
file << NpcDialogHeight << "\n";
file << ObjDialogX << "\n";
file << ObjDialogY << "\n";
file << ObjDialogWidth << "\n";
file << ObjDialogHeight << "\n";
file << NpcDetailDescBoxHeight << "\n";
file << NpcDetailSpliterPos << "\n";
file << ObjDetailDescBoxHeight << "\n";
file << ObjDetailSpliterPos << "\n";
}
}
int Settings::GetFpsMilliseconds()
{
return m_fpsMilliSeconds;
}
void Settings::SetFpsMilliseconds(int milliSeconds)
{
m_fpsMilliSeconds = milliSeconds;
SaveSetting();
}