/
Config.de
98 lines (84 loc) · 3.03 KB
/
Config.de
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
96
97
98
# The Doomsday Engine Project -- libdeng2
#
# Copyright (c) 2012 Jaakko Keränen <jaakko.keranen@iki.fi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
#----------------------------------------------------------------------------
# MAIN CONFIGURATION FOR LIBDENG2
#
# This module is the special Config namespace, reserved for the engine's
# configuration variables and routines. The namespace is stored persistently
# (persist.pack/modules/Config). The script is executed only when it has
# been updated or when __version__ has changed.
# Cleanup: this is a persistent namespace so old stuff may be hanging around.
for name in ['setDefaults', 'updateWithDefaults']
if name in locals(): del locals()[name]
end
del name
def setDefaults(d = None)
# Applies the default configuration.
# - d: Record where to set the values. If not specified, the
# Config namespace is used.
if d == None
print "Defaults are set in the main Config namespace."
import Config
d = Config
end
d.importPath = ['', '/modules']
# The default audio and video subsystems.
d.video = 'opengl'
d.audio = 'fmod'
# Window manager defaults.
record d.window
record d.window.main
d.window.fsaa = True
d.window.main.rect = [0, 0, 640, 480]
d.window.main.colorDepth = 32
d.window.main.center = True
d.window.main.maximize = False
d.window.main.fullscreen = True
# Log parameters.
record d.log
# Log message levels.
const d.log.TRACE = 0
const d.log.DEBUG = 1
const d.log.VERBOSE = 2
const d.log.MESSAGE = 3
const d.log.INFO = 4
const d.log.WARNING = 5
const d.log.ERROR = 6
const d.log.CRITICAL = 7
d.log.file = '/home/doomsday.out'
d.log.level = d.log.MESSAGE
d.log.bufferSize = 1000
end
def updateWithDefaults()
record defaults
setDefaults(defaults)
# Anything that is not already in Config should be added.
import recutil, Config
recutil.copyMissingMembers(defaults, Config)
end
updateWithDefaults()
# Check the previous version and decide what to do.
if '__oldversion__' in locals()
if __version__[3] > __oldversion__[3]
# Current build number is newer.
print 'Detected new build:', __oldversion__[3], '=>', __version__[3]
end
if __version__[0:2] > __oldversion__[0:2]
# Current version is newer.
print 'Detected new release:', __oldversion__, '=>', __version__
end
end