Consolodated config, added portals, etc.
This commit is contained in:
@@ -15,9 +15,10 @@ type FPSCapSetting interface {
|
||||
}
|
||||
|
||||
type SettingsScreen struct {
|
||||
selectedIndex int
|
||||
fpsMonitorValue *bool
|
||||
fpsCapValue FPSCapSetting
|
||||
selectedIndex int
|
||||
fpsMonitorValue *bool
|
||||
fpsCapValue FPSCapSetting
|
||||
portalVisibilityValue *bool
|
||||
}
|
||||
|
||||
func NewSettingsScreen() *SettingsScreen {
|
||||
@@ -34,12 +35,16 @@ func (s *SettingsScreen) SetFPSCap(cap FPSCapSetting) {
|
||||
s.fpsCapValue = cap
|
||||
}
|
||||
|
||||
func (s *SettingsScreen) SetPortalVisibility(enabled *bool) {
|
||||
s.portalVisibilityValue = enabled
|
||||
}
|
||||
|
||||
func (s *SettingsScreen) Update() bool {
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyEscape) {
|
||||
return true
|
||||
}
|
||||
|
||||
settingsCount := 2
|
||||
settingsCount := 3
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyArrowUp) || inpututil.IsKeyJustPressed(ebiten.KeyW) {
|
||||
s.selectedIndex--
|
||||
if s.selectedIndex < 0 {
|
||||
@@ -58,6 +63,8 @@ func (s *SettingsScreen) Update() bool {
|
||||
*s.fpsMonitorValue = !*s.fpsMonitorValue
|
||||
} else if s.selectedIndex == 1 && s.fpsCapValue != nil {
|
||||
s.fpsCapValue.Cycle()
|
||||
} else if s.selectedIndex == 2 && s.portalVisibilityValue != nil {
|
||||
*s.portalVisibilityValue = !*s.portalVisibilityValue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,6 +116,23 @@ func (s *SettingsScreen) Draw(screen *ebiten.Image, screenWidth, screenHeight in
|
||||
s.drawText(screen, fpsCapText, color.RGBA{R: 180, G: 180, B: 200, A: 255}, leftMargin, capY)
|
||||
}
|
||||
|
||||
// Portal visibility toggle
|
||||
portalVisText := "Portal Visibility: "
|
||||
if s.portalVisibilityValue != nil && *s.portalVisibilityValue {
|
||||
portalVisText += "ON"
|
||||
} else {
|
||||
portalVisText += "OFF"
|
||||
}
|
||||
|
||||
portalY := startY + 80
|
||||
if s.selectedIndex == 2 {
|
||||
indicatorX := leftMargin - 20
|
||||
s.drawText(screen, ">", color.RGBA{R: 255, G: 200, B: 0, A: 255}, indicatorX, portalY)
|
||||
s.drawText(screen, portalVisText, color.RGBA{R: 255, G: 255, B: 100, A: 255}, leftMargin, portalY)
|
||||
} else {
|
||||
s.drawText(screen, portalVisText, color.RGBA{R: 180, G: 180, B: 200, A: 255}, leftMargin, portalY)
|
||||
}
|
||||
|
||||
// Instructions
|
||||
hintText := "Enter/Space to toggle, ESC to go back"
|
||||
hintX := (screenWidth / 2) - (len(hintText) * 7 / 2)
|
||||
|
||||
Reference in New Issue
Block a user