ui

package
v0.1.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2024 License: MIT Imports: 7 Imported by: 0

README

UI

This is the ui part of end_of_eden.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var About = `` /* 473-byte string literal not displayed */

About is the about text.

View Source
var Numbers = []string{
	` ██████  
██  ████ 
██ ██ ██ 
████  ██ 
 ██████`,
	` ██ 
███ 
 ██ 
 ██ 
 ██ `,
	`██████  
     ██ 
 █████  
██      
███████ `,
	`██████  
     ██ 
 █████  
     ██ 
██████  `,
	`██   ██ 
██   ██ 
███████ 
     ██ 
     ██`,
	`███████ 
██      
███████ 
     ██ 
███████`,
	` ██████  
██       
███████  
██    ██ 
 ██████`,
	`███████ 
     ██ 
    ██  
   ██   
   ██`,
	` █████  
██   ██ 
 █████  
██   ██ 
 █████`,
	` █████  
██   ██ 
 ██████ 
     ██ 
 █████`,
}

Numbers is a slice of strings that represent the numbers 0-9 in a 5x5 grid.

View Source
var Title = `` /* 652-byte string literal not displayed */

Title is the title of the game.

Functions

func GetNumber added in v0.0.5

func GetNumber(number int) string

GetNumber returns a string representation of a number.

func InsertString added in v0.1.6

func InsertString(s string, insert string, n int) string

InsertString inserts a string into another string at a given index.

func Max added in v0.1.6

func Max(x, y int) int

func Min added in v0.1.6

func Min(x, y int) int

Types

type Menu interface {
	tea.Model
	HasSize() bool
}

Menu is a tea.Model that keeps track of its size. It is intended to trigger the re-distribution of the tea.WindowSizeMsg for nested models. It also contains some common functionality for menus.

type MenuBase struct {
	Size      tea.WindowSizeMsg
	LastMouse tea.MouseMsg
	Zones     *zone.Manager
}

MenuBase is the base Menu implementation.

func NewMenuBase added in v0.1.8

func NewMenuBase() MenuBase

NewMenuBase returns a new MenuBase.

func (m MenuBase) HasSize() bool

HasSize returns true if the menu has a saved size.

func (m MenuBase) WithSize(size tea.WindowSizeMsg) MenuBase

WithSize returns a new MenuBase with the given size.

func (m MenuBase) WithZones(zones *zone.Manager) MenuBase

WithZones returns a new MenuBase with the given zone manager.

func (m MenuBase) ZoneBackground(zone string, hover lipgloss.Color, normal lipgloss.Color) lipgloss.Color

ZoneBackground returns the background color for a zone.

func (m MenuBase) ZoneInBounds(zone string) bool

ZoneInBounds returns true if the last mouse position is in the bounds of the given zone.

func (m MenuBase) ZoneMark(zone string, str string) string

ZoneMark returns the given string marked with the given zone.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL