ui

package
v0.0.0-...-c9dfc42 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ColorBackground = color.RGBA{28, 28, 30, 255}
	ColorGrid       = color.RGBA{70, 70, 70, 255}
	ColorWhite      = color.RGBA{230, 230, 230, 255}
	ColorBlack      = color.RGBA{20, 20, 20, 255}
	ColorValid      = color.RGBA{100, 200, 100, 128}
	ColorLabelText  = color.RGBA{200, 200, 200, 255}
	ColorLastMove   = color.RGBA{255, 200, 50, 255} // Bright orange/yellow highlight for last move
)

Game colors

Functions

func RunUI

func RunUI()

RunUI runs the UI

Types

type AISelectionScreen

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

AISelectionScreen represents the screen for selecting an AI opponent

func NewAISelectionScreen

func NewAISelectionScreen(ui *UI) *AISelectionScreen

NewAISelectionScreen creates a new AI selection screen

func (*AISelectionScreen) Draw

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

Draw renders the AI selection screen

func (*AISelectionScreen) Layout

func (s *AISelectionScreen) Layout(outsideWidth, outsideHeight int) (int, int)

Layout implements the Screen interface

func (*AISelectionScreen) Update

func (s *AISelectionScreen) Update() error

Update handles input on the AI selection screen

type AppState

type AppState int

AppState represents the current state/screen of the application

const (
	StateHome AppState = iota
	StateAISelection
	StateDualAISelection
	StateGame
	StateEnd
)

type DualAISelectionScreen

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

DualAISelectionScreen represents the screen for selecting two AI players

func NewDualAISelectionScreen

func NewDualAISelectionScreen(ui *UI) *DualAISelectionScreen

NewDualAISelectionScreen creates a new dual AI selection screen

func (*DualAISelectionScreen) Draw

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

Draw renders the dual AI selection screen

func (*DualAISelectionScreen) Layout

func (s *DualAISelectionScreen) Layout(outsideWidth, outsideHeight int) (int, int)

Layout implements the Screen interface

func (*DualAISelectionScreen) Update

func (s *DualAISelectionScreen) Update() error

Update handles input on the dual AI selection screen

type EndScreen

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

EndScreen represents the game over screen

func NewEndScreen

func NewEndScreen(ui *UI) *EndScreen

NewEndScreen creates a new end screen

func (*EndScreen) Draw

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

Draw renders the end screen

func (*EndScreen) Layout

func (s *EndScreen) Layout(outsideWidth, outsideHeight int) (int, int)

Layout implements ebiten.Game

func (*EndScreen) Update

func (s *EndScreen) Update() error

Update handles input on the end screen

type Game

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

Game implements ebiten.Game interface

func (*Game) Draw

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

func (*Game) Layout

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

func (*Game) Update

func (g *Game) Update() error

type GameScreen

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

GameScreen manages the main game UI

func NewGameScreen

func NewGameScreen(ui *UI) *GameScreen

NewGameScreen creates a new game screen

func (*GameScreen) AddMoveToHistory

func (s *GameScreen) AddMoveToHistory(pos game.Position, playerColor game.Piece, pass bool)

AddMoveToHistory adds a move to the history table

func (*GameScreen) Draw

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

Draw renders the game screen

func (*GameScreen) Layout

func (s *GameScreen) Layout(outsideWidth, outsideHeight int) (int, int)

Layout implements the Screen interface

func (*GameScreen) Update

func (s *GameScreen) Update() error

Update updates the game state

type HomeScreen

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

HomeScreen represents the home/entry screen of the application

func NewHomeScreen

func NewHomeScreen(ui *UI) *HomeScreen

NewHomeScreen creates a new home screen

func (*HomeScreen) Draw

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

Draw renders the home screen

func (*HomeScreen) Layout

func (s *HomeScreen) Layout(outsideWidth, outsideHeight int) (int, int)

Layout implements the Screen interface

func (*HomeScreen) Update

func (s *HomeScreen) Update() error

Update handles input on the home screen

type MoveRecord

type MoveRecord struct {
	Position game.Position
	Pass     bool
}

MoveRecord represents a single move made by a player

type ResultScreen

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

ResultScreen shows the game results

func NewResultScreen

func NewResultScreen(ui *UI) *ResultScreen

NewResultScreen creates a new result screen

func (*ResultScreen) Draw

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

Draw renders the result screen

func (*ResultScreen) Layout

func (s *ResultScreen) Layout(outsideWidth, outsideHeight int) (int, int)

Layout implements ebiten.Game

func (*ResultScreen) Update

func (s *ResultScreen) Update() error

Update handles input on the result screen

type Screen

type Screen interface {
	Update() error
	Draw(screen *ebiten.Image)
	Layout(outsideWidth, outsideHeight int) (int, int)
}

Screen interface for different game screens

type StartScreen

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

StartScreen represents the game's start screen

func NewStartScreen

func NewStartScreen(ui *UI) *StartScreen

NewStartScreen creates a new start screen

func (*StartScreen) Draw

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

Draw renders the start screen

func (*StartScreen) Layout

func (s *StartScreen) Layout(outsideWidth, outsideHeight int) (int, int)

Layout implements ebiten.Game

func (*StartScreen) Update

func (s *StartScreen) Update() error

Update handles input for the start screen

type UI

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

UI manages the game UI

func NewUI

func NewUI(g *game.Game) *UI

NewUI creates a new UI

func (*UI) EndGame

func (ui *UI) EndGame()

EndGame switches to the result screen

func (*UI) NewGame

func (ui *UI) NewGame()

NewGame starts a new game

func (*UI) StartAIVsAIGame

func (s *UI) StartAIVsAIGame(ai1Version, ai2Version int)

StartAIVsAIGame starts a game with two AI players

func (*UI) StartGame

func (s *UI) StartGame(player1, player2 string)

StartGame initializes a new game with the specified player names

func (*UI) StartPlayerVsAIGame

func (s *UI) StartPlayerVsAIGame(aiVersion int)

StartPlayerVsAIGame starts a game with a human player against the selected AI

func (*UI) SwitchToAISelectionScreen

func (s *UI) SwitchToAISelectionScreen()

SwitchToAISelectionScreen switches to the AI selection screen

func (*UI) SwitchToDualAISelectionScreen

func (s *UI) SwitchToDualAISelectionScreen()

SwitchToDualAISelectionScreen switches to the dual AI selection screen

func (*UI) SwitchToHomeScreen

func (s *UI) SwitchToHomeScreen()

SwitchToHomeScreen switches to the home screen

Jump to

Keyboard shortcuts

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