ui

package
v0.0.0-...-3135f88 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: GPL-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FindByte

func FindByte(s []byte, b byte) int

func GetCrusadeFlagImage

func GetCrusadeFlagImage() [][]rune

func GetDecisionFlagImage

func GetDecisionFlagImage() [][]rune

func GetPeopleRows

func GetPeopleRows() [][]rune

Types

type Animation

type Animation interface {
	Update()
	Done() bool
	Draw(screen *ebiten.Image)
}

func NewIconAnimation

func NewIconAnimation(mapView *MapView, icon lib.IconType, xy0, xy1 lib.MapCoords, frames int) Animation

func NewIconsAnimation

func NewIconsAnimation(mapView *MapView, icons []lib.IconType, xy lib.MapCoords) Animation

func NewUnitAnimation

func NewUnitAnimation(mapView *MapView, player *AudioPlayer, unit lib.Unit, xy0, xy1 lib.MapCoords, frames int) Animation

type AudioPlayer

type AudioPlayer struct {
	// contains filtered or unexported fields
}

A trivial player generating strictly rectangular waves of given frequency on 4 channels.

func NewAudioPlayer

func NewAudioPlayer(context *oto.Context) *AudioPlayer

func (*AudioPlayer) Close

func (p *AudioPlayer) Close()

func (*AudioPlayer) SetFrequency

func (p *AudioPlayer) SetFrequency(channel int, freq byte)

type Button

type Button struct {
	// contains filtered or unexported fields
}

func NewButton

func NewButton(text string, x, y float64, width, height int, font *lib.Font) *Button

func (*Button) Draw

func (b *Button) Draw(dst *ebiten.Image)

func (*Button) SetText

func (b *Button) SetText(text string)

func (*Button) Update

func (b *Button) Update() bool

type Command

type Command int
const (
	Freeze Command = iota
	StatusReport
	UnitInfo
	GeneralInfo
	CityInfo
	HideUnits
	ShowOverviewMap
	ShowFlashback
	Who
	DecreaseSpeed
	IncreaseSpeed
	SwitchUnitDisplay
	SwitchSides
	Quit
	ScrollDown
	ScrollDownFast
	ScrollUp
	ScrollUpFast
	ScrollLeft
	ScrollLeftFast
	ScrollRight
	ScrollRightFast
	Reserve
	Defend
	Attack
	Move
	SetObjective
	Save
	Load
	TurboMode
)

type CommandBuffer

type CommandBuffer struct {
	Commands chan Command
}

func NewCommandBuffer

func NewCommandBuffer(size uint) *CommandBuffer

func (*CommandBuffer) Update

func (b *CommandBuffer) Update()

type FinalResult

type FinalResult struct {
	// contains filtered or unexported fields
}

func NewFinalResult

func NewFinalResult(result, difficulty, rank int, font *lib.Font, onRestartGame func()) *FinalResult

func (*FinalResult) Draw

func (s *FinalResult) Draw(screen *ebiten.Image)

func (*FinalResult) Update

func (s *FinalResult) Update() error

type Flashback

type Flashback struct {
	// contains filtered or unexported fields
}

func NewFlashback

func NewFlashback(mapView *MapView, messageBox *MessageBox, flashback lib.FlashbackHistory, terrainTypeMap *lib.TerrainTypeMap) *Flashback

func (*Flashback) Draw

func (f *Flashback) Draw(screen *ebiten.Image)

func (*Flashback) Update

func (f *Flashback) Update() error

type Game

type Game struct {
	// contains filtered or unexported fields
}

func NewGame

func NewGame(fsys fs.FS, rand *rand.Rand) (*Game, error)

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Game) Update

func (g *Game) Update() error

type GameLoading

type GameLoading struct {
	// contains filtered or unexported fields
}

func NewGameLoading

func NewGameLoading(fsys fs.FS, onGameLoaded func(*lib.GameData)) *GameLoading

func (*GameLoading) Draw

func (l *GameLoading) Draw(screen *ebiten.Image)

func (*GameLoading) Update

func (l *GameLoading) Update() error

type IconAnimation

type IconAnimation struct {
	// contains filtered or unexported fields
}

func (*IconAnimation) Done

func (a *IconAnimation) Done() bool

func (*IconAnimation) Draw

func (a *IconAnimation) Draw(screen *ebiten.Image)

func (*IconAnimation) Update

func (a *IconAnimation) Update()

type IconsAnimation

type IconsAnimation struct {
	// contains filtered or unexported fields
}

func (*IconsAnimation) Done

func (a *IconsAnimation) Done() bool

func (*IconsAnimation) Draw

func (a *IconsAnimation) Draw(screen *ebiten.Image)

func (*IconsAnimation) Update

func (a *IconsAnimation) Update()

type InputBox

type InputBox struct {
	// contains filtered or unexported fields
}

func NewInputBox

func NewInputBox(x, y float64, width int, font *lib.Font, onEnter func(string)) *InputBox

func (*InputBox) Draw

func (i *InputBox) Draw(screen *ebiten.Image)

func (*InputBox) SetBackgroundColor

func (i *InputBox) SetBackgroundColor(backgroundColor int)

func (*InputBox) SetTextColor

func (i *InputBox) SetTextColor(textColor int)
func (i *InputBox) SetText(text string) {
	i.text = text
	i.cursorPosition = len(i.text)
}

func (*InputBox) Update

func (i *InputBox) Update()

type Intro

type Intro struct {
	// contains filtered or unexported fields
}

func NewIntro

func NewIntro(font *lib.Font) *Intro

func (*Intro) Draw

func (i *Intro) Draw(screen *ebiten.Image)

type Label

type Label struct {
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel(text string, x, y float64, width, height int, font *lib.Font) *Label

func (*Label) Clear

func (l *Label) Clear()

func (*Label) ContainsPoint

func (l *Label) ContainsPoint(x, y int) bool

func (*Label) Draw

func (l *Label) Draw(screen *ebiten.Image)

func (*Label) SetBackgroundColor

func (l *Label) SetBackgroundColor(color int)

func (*Label) SetCharInverted

func (l *Label) SetCharInverted(x int, inverted bool)

func (*Label) SetText

func (l *Label) SetText(text string, x int)

func (*Label) SetTextColor

func (l *Label) SetTextColor(color int)

type ListBox

type ListBox struct {
	// contains filtered or unexported fields
}

func NewListBox

func NewListBox(x, y float64, width, height int, items []string, font *lib.Font, onEnter func(string)) *ListBox

func (*ListBox) Draw

func (l *ListBox) Draw(screen *ebiten.Image)

func (*ListBox) SetBackgroundColor

func (l *ListBox) SetBackgroundColor(backgroundColor int)

func (*ListBox) SetTextColor

func (l *ListBox) SetTextColor(textColor int)

func (*ListBox) Update

func (l *ListBox) Update()

type MainScreen

type MainScreen struct {
	// contains filtered or unexported fields
}

func NewMainScreen

func NewMainScreen(g *Game, options *lib.Options, audioPlayer *AudioPlayer, rand *rand.Rand, onGameOver func(int, int, int)) *MainScreen

func (*MainScreen) Draw

func (s *MainScreen) Draw(screen *ebiten.Image)

func (*MainScreen) Update

func (s *MainScreen) Update() error

type MapDrawer

type MapDrawer struct {
	// contains filtered or unexported fields
}

func NewMapDrawer

func NewMapDrawer(
	terrainMap *lib.Map,
	minX, minY, maxX, maxY int,
	tiles *[48]*image.Paletted,
	colors *lib.ColorSchemes) *MapDrawer

func (*MapDrawer) GetMapImage

func (d *MapDrawer) GetMapImage(isNight bool) *ebiten.Image

func (*MapDrawer) GetSpriteFromTileNum

func (d *MapDrawer) GetSpriteFromTileNum(tileNum byte, isNight bool) *ebiten.Image

func (*MapDrawer) MapCoordsToImageCoords

func (d *MapDrawer) MapCoordsToImageCoords(mapXY lib.MapCoords) (x, y int)

type MapView

type MapView struct {
	// contains filtered or unexported fields
}

func NewMapView

func NewMapView(
	x, y float64,
	width, height int,
	terrainMap *lib.Map,
	terrainTypeMap *lib.TerrainTypeMap,
	units *lib.Units,
	minMapX, minMapY, maxMapX, maxMapY int,
	tiles *[48]*image.Paletted,
	unitSymbols *[16]*image.Paletted,
	unitIcons *[16]*image.Paletted,
	icons *[24]*image.Paletted,
	daytimePalette *[8]byte,
	nightPalette *[8]byte) *MapView

func (*MapView) AreMapCoordsVisible

func (v *MapView) AreMapCoordsVisible(mapXY lib.MapCoords) bool

func (*MapView) AreScreenCoordsVisible

func (v *MapView) AreScreenCoordsVisible(x, y float64) bool

func (*MapView) Draw

func (v *MapView) Draw(screen *ebiten.Image)

func (*MapView) DrawSpriteBetween

func (v *MapView) DrawSpriteBetween(sprite *ebiten.Image, mapXY0, mapXY1 lib.MapCoords, alpha float64, screen *ebiten.Image)

func (*MapView) GetCursorPosition

func (v *MapView) GetCursorPosition() lib.MapCoords

func (*MapView) GetSpriteForUnit

func (v *MapView) GetSpriteForUnit(unit lib.Unit) *ebiten.Image

func (*MapView) GetSpriteFromIcon

func (v *MapView) GetSpriteFromIcon(icon lib.IconType) *ebiten.Image

func (*MapView) HideIcon

func (v *MapView) HideIcon()

func (*MapView) MapCoordsToScreenCoords

func (v *MapView) MapCoordsToScreenCoords(mapXY lib.MapCoords) (x, y float64)

func (*MapView) ScreenCoordsToUnitCoords

func (v *MapView) ScreenCoordsToUnitCoords(screenX, screenY int) lib.UnitCoords

func (*MapView) SetCursorPosition

func (v *MapView) SetCursorPosition(xy lib.MapCoords)

func (*MapView) SetIsNight

func (v *MapView) SetIsNight(isNight bool)

func (*MapView) SetUnitDisplay

func (v *MapView) SetUnitDisplay(unitDisplay lib.UnitDisplay)

func (*MapView) ShowAnimatedIcon

func (v *MapView) ShowAnimatedIcon(icons []lib.IconType, xy lib.MapCoords, dx, dy float64)

func (*MapView) ShowIcon

func (v *MapView) ShowIcon(icon lib.IconType, xy lib.MapCoords, dx, dy float64)

type MessageBox

type MessageBox struct {
	// contains filtered or unexported fields
}

func NewMessageBox

func NewMessageBox(x, y float64, width, height int, font *lib.Font) *MessageBox

func (*MessageBox) Clear

func (b *MessageBox) Clear()

func (*MessageBox) ClearRow

func (b *MessageBox) ClearRow(y int)

func (*MessageBox) Draw

func (b *MessageBox) Draw(screen *ebiten.Image)

func (*MessageBox) Print

func (b *MessageBox) Print(str string, x, y int)

func (*MessageBox) SetRowBackground

func (b *MessageBox) SetRowBackground(y, color int)

func (*MessageBox) SetTextColor

func (b *MessageBox) SetTextColor(color int)

type OptionSelection

type OptionSelection struct {
	// contains filtered or unexported fields
}

func NewOptionSelection

func NewOptionSelection(game lib.Game, font *lib.Font, onOptionsSelected func(*lib.Options)) *OptionSelection

func (*OptionSelection) Draw

func (s *OptionSelection) Draw(screen *ebiten.Image)

func (*OptionSelection) Update

func (s *OptionSelection) Update() error

type OverviewMap

type OverviewMap struct {
	// contains filtered or unexported fields
}

func NewOverviewMap

func NewOverviewMap(terrainMap *lib.Map, units *lib.Units, generic *lib.Generic, scenarioData *lib.Data, isUnitVisible func(lib.Unit) bool) *OverviewMap

func (*OverviewMap) Draw

func (m *OverviewMap) Draw(screen *ebiten.Image, opts *ebiten.DrawImageOptions)

func (*OverviewMap) Update

func (m *OverviewMap) Update()

type Rectangle

type Rectangle struct {
	// contains filtered or unexported fields
}

func NewRectangle

func NewRectangle(x, y float64, width, height int) *Rectangle

func (*Rectangle) Draw

func (r *Rectangle) Draw(screen *ebiten.Image)

func (*Rectangle) SetColor

func (r *Rectangle) SetColor(color int)

type ScenarioLoading

type ScenarioLoading struct {
	// contains filtered or unexported fields
}

func NewScenarioLoading

func NewScenarioLoading(fsys fs.FS, scenario lib.Scenario, font *lib.Font, onScenarioLoaded func(*lib.ScenarioData)) *ScenarioLoading

func (*ScenarioLoading) Draw

func (l *ScenarioLoading) Draw(screen *ebiten.Image)

func (*ScenarioLoading) Update

func (l *ScenarioLoading) Update() error

type ScenarioSelection

type ScenarioSelection struct {
	// contains filtered or unexported fields
}

func NewScenarioSelection

func NewScenarioSelection(scenarios []lib.Scenario, font *lib.Font, onScenarioSelected func(int)) *ScenarioSelection

func (*ScenarioSelection) Draw

func (s *ScenarioSelection) Draw(screen *ebiten.Image)

func (*ScenarioSelection) Update

func (s *ScenarioSelection) Update() error

type SubGame

type SubGame interface {
	Update() error
	Draw(screen *ebiten.Image)
}

type UnitAnimation

type UnitAnimation struct {
	// contains filtered or unexported fields
}

func (*UnitAnimation) Done

func (a *UnitAnimation) Done() bool

func (*UnitAnimation) Draw

func (a *UnitAnimation) Draw(screen *ebiten.Image)

func (*UnitAnimation) Update

func (a *UnitAnimation) Update()

type VariantSelection

type VariantSelection struct {
	// contains filtered or unexported fields
}

func NewVariantSelection

func NewVariantSelection(variants []lib.Variant, font *lib.Font, onVariantSelected func(int)) *VariantSelection

func (*VariantSelection) Draw

func (s *VariantSelection) Draw(screen *ebiten.Image)

func (*VariantSelection) Update

func (s *VariantSelection) Update() error

Jump to

Keyboard shortcuts

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