Wire the sliders into the config file
Not yet the game itself. That's still TODO.
This commit is contained in:
@@ -68,3 +68,36 @@ func (c *Config) Save() error {
|
||||
func (c *Config) DataFile(path string) string {
|
||||
return filepath.Join(c.DataDir, path)
|
||||
}
|
||||
|
||||
func (o *Options) ResolutionIndex() int {
|
||||
if o.XRes == 640 && o.YRes == 480 {
|
||||
return 1
|
||||
}
|
||||
|
||||
if o.XRes == 800 && o.YRes == 600 {
|
||||
return 2
|
||||
}
|
||||
|
||||
if o.XRes == 1024 && o.YRes == 768 {
|
||||
return 3
|
||||
}
|
||||
|
||||
return 4 // Magic value
|
||||
}
|
||||
|
||||
func (o *Options) SetResolutionIndex(value int) {
|
||||
switch value {
|
||||
case 1:
|
||||
o.XRes = 640
|
||||
o.YRes = 480
|
||||
case 2:
|
||||
o.XRes = 800
|
||||
o.YRes = 600
|
||||
case 3:
|
||||
o.XRes = 1024
|
||||
o.YRes = 768
|
||||
}
|
||||
|
||||
// If the value isn't recognised, silently ignore the request to avoid
|
||||
// overwriting options the resolution slider doesn't know about
|
||||
}
|
||||
|
Reference in New Issue
Block a user