game

package
v0.0.0-...-d85e1bb Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2026 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const MIN_DRAW_SIZE = 3

Variables

This section is empty.

Functions

This section is empty.

Types

type ClientShip

type ClientShip struct {
	ID                                     uint64
	Position, RealPosition                 *util.Vector2D
	Size, RealSize, Rotation, RealRotation float64

	Name        string
	Color       color.Color
	Outline     color.Color
	Definition  *definitions.Ship
	HealthRatio float64
	// contains filtered or unexported fields
}

func (*ClientShip) Draw

func (s *ClientShip) Draw(game *Game, screen *ebiten.Image)

type Game

type Game struct {
	ServerTime, LocalTime int
	Camera                *PlayerCamera
	PlayerID              uint64
	Socket                *web.Socket

	Ships   map[uint64]*ClientShip
	ShipsMu sync.RWMutex

	MousePosition *util.Vector2D
	// contains filtered or unexported fields
}

func NewGame

func NewGame() (g *Game)

func (*Game) Draw

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

func (*Game) Layout

func (g *Game) Layout(_, _ int) (w, h int)

func (*Game) ParseIncomingShip

func (g *Game) ParseIncomingShip(reader *protocol.Reader, id uint64, isNew bool)

func (*Game) ParseViewUpdate

func (g *Game) ParseViewUpdate(reader *protocol.Reader)

func (*Game) Update

func (g *Game) Update() (err error)

type GameObject

type GameObject interface {
	Draw(screen *ebiten.Image)
}

type PlayerCamera

type PlayerCamera struct {
	Position            *util.Vector2D
	Width, Height, Zoom float64

	RealPosition *util.Vector2D
	RealZoom     float64
}

func (*PlayerCamera) IsInView

func (c *PlayerCamera) IsInView(position *util.Vector2D, radius float64) (inView bool)

func (*PlayerCamera) RealMousePosition

func (c *PlayerCamera) RealMousePosition() (realPos *util.Vector2D)

func (*PlayerCamera) Update

func (c *PlayerCamera) Update()

Jump to

Keyboard shortcuts

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