diff options
Diffstat (limited to 'src/LivingVillage.Desktop/TitleScreen.fs')
| -rw-r--r-- | src/LivingVillage.Desktop/TitleScreen.fs | 33 |
1 files changed, 31 insertions, 2 deletions
diff --git a/src/LivingVillage.Desktop/TitleScreen.fs b/src/LivingVillage.Desktop/TitleScreen.fs index 8b1c5d5..00cf5b8 100644 --- a/src/LivingVillage.Desktop/TitleScreen.fs +++ b/src/LivingVillage.Desktop/TitleScreen.fs @@ -24,7 +24,31 @@ module TitleScreen = PanelX: int PanelY: int PanelWidth: int - PanelHeight: int } + PanelHeight: int + HeadingY: int + FirstItemY: int + CursorX: int + CursorWidth: int + TextX: int } + + type TextRect = + { X: int + Y: int + Width: int + Height: int } + + let rectsDisjoint (a: TextRect) (b: TextRect) : bool = + a.X + a.Width <= b.X + || b.X + b.Width <= a.X + || a.Y + a.Height <= b.Y + || b.Y + b.Height <= a.Y + + /// Cursor and label rectangles for one menu row. The cursor is drawn in its own + /// column; the label always starts to the right of it, so they can never overprint. + let selectionRects (layout: TitleLayout) (rowIndex: int) : TextRect * TextRect = + let y = layout.FirstItemY + rowIndex * layout.MenuLineHeight + { X = layout.CursorX; Y = y; Width = layout.CursorWidth; Height = 16 }, + { X = layout.TextX; Y = y; Width = layout.PanelX + layout.PanelWidth - layout.TextX - 24; Height = 16 } // Palette mirrors the VillageArt atlas: roof (45,49,57)/(30,33,38), water (54,116,145), // lantern paper (212,92,74). Purely decorative reuse of existing art colors. @@ -82,4 +106,9 @@ module TitleScreen = PanelX = (width - panelWidth) / 2 PanelY = height / 2 - 64 PanelWidth = panelWidth - PanelHeight = min 360 (height - height / 2 - 40) } + PanelHeight = min 360 (height - height / 2 - 40) + HeadingY = height / 2 - 64 + 20 + FirstItemY = height / 2 - 64 + 60 + CursorX = (width - panelWidth) / 2 + 24 + CursorWidth = 20 + TextX = (width - panelWidth) / 2 + 24 + 20 + 12 } |
