resolution sets

This commit is contained in:
2023-07-08 11:49:47 +02:00
parent 73f06f458f
commit 6028c5770f
2 changed files with 39 additions and 2 deletions

View File

@@ -23,8 +23,8 @@ func (d *Domain) GetInitialConfig() *konstructor.Config {
return &konstructor.Config{ return &konstructor.Config{
Name: "Teletype Adventure", Name: "Teletype Adventure",
Screen: &konstructor.ScreenConfig{ Screen: &konstructor.ScreenConfig{
Width: 640, Width: konstructor.VGAResolutionSet.Width,
Height: 480, Height: konstructor.VGAResolutionSet.Height,
Scale: 2, Scale: 2,
}, },
Header: &konstructor.HeaderConfig{ Header: &konstructor.HeaderConfig{

View File

@@ -2,6 +2,38 @@ package konstructor
import "image/color" 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 { type KeyMap struct {
Up any Up any
Down any Down any
@@ -30,3 +62,8 @@ type Config struct {
Header *HeaderConfig Header *HeaderConfig
KeyMap KeyMap KeyMap KeyMap
} }
func (c *Config) SetResolution(set ResolutionSet) {
c.Screen.Width = set.Width
c.Screen.Height = set.Height
}