Documentation
¶
Overview ¶
Package menu provides various ways to draw a main menu and handle user input.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Button ¶
type Button struct { Text string Rect *sdl.Rect // Handler is executed when the user presses a submit key with this Button // selected. Handler func() error }
Button stores the state and logic for a menu button.
type Menu ¶
type Menu interface { Font() *ttf.Font Buttons() []*Button CursorPos() int ResetCursor() CursorUp() CursorDown() CursorRect() (*sdl.Rect, error) AddButton(string, func() error) ClearButtons() }
Menu represents a basic main menu with buttons aligned vertically. Other layouts may be supported later.
func NewMenu ¶
func NewMenu(p NewMenuParams) (Menu, error)
NewMenu creates a game menu with a font and a set of buttons.
Click to show internal directories.
Click to hide internal directories.