diff --git a/domain/init.go b/domain/init.go index 04cef21..04755e3 100644 --- a/domain/init.go +++ b/domain/init.go @@ -23,8 +23,8 @@ func (d *Domain) GetInitialConfig() *konstructor.Config { return &konstructor.Config{ Name: "Teletype Adventure", Screen: &konstructor.ScreenConfig{ - Width: 640, - Height: 480, + Width: konstructor.VGAResolutionSet.Width, + Height: konstructor.VGAResolutionSet.Height, Scale: 2, }, Header: &konstructor.HeaderConfig{ diff --git a/konstructor/config.go b/konstructor/config.go index bba0ed5..6c15920 100644 --- a/konstructor/config.go +++ b/konstructor/config.go @@ -2,6 +2,38 @@ package konstructor import "image/color" +type ResolutionSet struct { + Width int + Height int +} + +var QVGAResolutionSet = ResolutionSet{ + Width: 320, + Height: 240, +} + +var VGAResolutionSet = ResolutionSet{ + Width: 640, + Height: 480, +} + +var SVGAResolutionSet = ResolutionSet{ + Width: 800, + Height: 600, +} + +var XGAResolutionSet = ResolutionSet{ + Width: 1024, + Height: 768, +} + +var ResolutionSets = []ResolutionSet{ + QVGAResolutionSet, + VGAResolutionSet, + SVGAResolutionSet, + XGAResolutionSet, +} + type KeyMap struct { Up any Down any @@ -30,3 +62,8 @@ type Config struct { Header *HeaderConfig KeyMap KeyMap } + +func (c *Config) SetResolution(set ResolutionSet) { + c.Screen.Width = set.Width + c.Screen.Height = set.Height +}