This repository has been archived by the owner on Jan 9, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetting.py
73 lines (56 loc) · 2.11 KB
/
setting.py
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
import file
#List of resolution options, list of tuples
resolutionoptions = ((320, 240), (640, 480), (1280, 960))
#Current resolution setting, defaults to 1, (640, 480)
resolutionsetting = 1
def resolution():
'''
Returns the current resolution setting (Tuple (width, height))
'''
return resolutionoptions[resolutionsetting]
def changeResolution():
'''
Increases the current resolution setting option by 1, when it reaches the limit it resets
'''
#Use the global render quality setting variable
global resolutionsetting
#Add 1 to current resolution setting
resolutionsetting += 1
#If the resolution setting is out of the option range, reset to 0
if resolutionsetting >= len(resolutionoptions):
resolutionsetting = 0
#List of resolution options, list of integers
renderqualityoptions = (1, 2, 4)
#Current resolution setting, defaults to 1, (2)
renderqualitysetting = 1
def renderquality():
'''
Returns the current render quality setting (Integer)
'''
return renderqualityoptions[renderqualitysetting]
def changeRenderquality():
'''
Increases the current render quality setting option by 1, when it reaches the limit it resets
'''
#Use the global render quality setting variable
global renderqualitysetting
#Add 1 to current render quality setting
renderqualitysetting += 1
#If the render quality setting is out of the option range, reset to 0
if renderqualitysetting >= len(renderqualityoptions):
renderqualitysetting = 0
def saveSettings():
'''
Saves the resolution and render quality setting to core/Settings.json
'''
file.saveJson("core/Settings.json", {'resolution' : resolutionsetting, 'renderquality' : renderqualitysetting})
def loadSettings():
'''
Loads the resolution and render quality setting from core/Settings.json
'''
global resolutionsetting
global renderqualitysetting
data = file.loadJson("core/Settings.json")
if data is not None:
resolutionsetting = data['resolution']
renderqualitysetting = data['renderquality']