Skip to content

Commit

Permalink
add experimental Steam Deck specific resolution support
Browse files Browse the repository at this point in the history
  • Loading branch information
quasilyte committed Mar 29, 2024
1 parent 9bffd23 commit d56189a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions src/gamedata/display.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var SupportedDisplayRatios = []DisplayRatio{
{Name: "19:9", Width: 1140, Height: 540},
{Name: "20:9", Width: 1200, Height: 540},
{Name: "21:9", Width: 1260, Height: 540},
{Name: "Steam Deck", Width: 1280, Height: 800},
}

func FindDisplayRatio(name string) int {
Expand Down
31 changes: 18 additions & 13 deletions src/scenes/menus/options_graphicsmenu.go
Original file line number Diff line number Diff line change
Expand Up @@ -177,20 +177,25 @@ func (c *OptionsGraphicsMenuController) initUI() {
}

if runtime.GOARCH != "wasm" {
values := []string{
gamedata.SupportedDisplayRatios[0].Name,
gamedata.SupportedDisplayRatios[1].Name,
gamedata.SupportedDisplayRatios[2].Name,
gamedata.SupportedDisplayRatios[3].Name,
gamedata.SupportedDisplayRatios[4].Name,
gamedata.SupportedDisplayRatios[5].Name,
}
if c.state.Device.IsSteamDeck() {
// Steam Deck Native display.
values = append(values, gamedata.SupportedDisplayRatios[6].Name)
}
b := eui.NewSelectButton(eui.SelectButtonConfig{
PlaySound: true,
Resources: uiResources,
Input: c.state.MenuInput,
Value: &options.Graphics.AspectRatio,
Label: d.Get("menu.options.graphics.aspect_ratio"),
ValueNames: []string{
gamedata.SupportedDisplayRatios[0].Name,
gamedata.SupportedDisplayRatios[1].Name,
gamedata.SupportedDisplayRatios[2].Name,
gamedata.SupportedDisplayRatios[3].Name,
gamedata.SupportedDisplayRatios[4].Name,
gamedata.SupportedDisplayRatios[5].Name,
},
PlaySound: true,
Resources: uiResources,
Input: c.state.MenuInput,
Value: &options.Graphics.AspectRatio,
Label: d.Get("menu.options.graphics.aspect_ratio"),
ValueNames: values,
OnPressed: func() {
displayRatio := gamedata.SupportedDisplayRatios[options.Graphics.AspectRatio]
ctx := c.scene.Context()
Expand Down

0 comments on commit d56189a

Please sign in to comment.