components

package
v0.0.0-...-65675ae Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const AllLayers = 8

Variables

This section is empty.

Functions

func BoundsFromSprite

func BoundsFromSprite(sprite engine.Sprite) engine.Rect

Types

type Area

type Area struct {
	Occupants int
	Overlay   DrawableOwner
}

type AreaOccupant

type AreaOccupant struct {
	OccupiedArea engine.Entity
	NextArea     engine.Entity
	Occupying    bool
}

TODO This should be a "has" relation, not "is"

type AreaOccupantOwner

type AreaOccupantOwner interface {
	GetAreaOccupant() *AreaOccupant
}

type AreaOwner

type AreaOwner interface {
	GetArea() *Area
}

type Builder

type Builder struct {
	Options []BuilderOption
	Queue   []BuilderOption
	Timer   *engine.CountdownTimer
}

func (*Builder) AddToQueue

func (b *Builder) AddToQueue(option BuilderOption)

func (*Builder) PopFromQueue

func (b *Builder) PopFromQueue() (BuilderOption, bool)

type BuilderOption

type BuilderOption struct {
	BuildingType BuildingType
	SpawnTime    time.Duration
}

type BuilderOwner

type BuilderOwner interface {
	GetBuilder() *Builder
}

type BuildingType

type BuildingType int
const (
	BuildingSettlement BuildingType = iota
	BuildingBarracks
	BuildingChapel
	BuildingForge
	BuildingTower
)

type Button

type Button struct {
	Action  func()
	Pressed bool

	SpriteTop      engine.Sprite
	SpriteReleased engine.Sprite
	SpritePressed  engine.Sprite
}

type ButtonOwner

type ButtonOwner interface {
	GetButton() *Button
}

type Citizen

type Citizen struct {
	Team  Team
	Class Class
}

type Class

type Class int
const (
	ClassWorker Class = iota
	ClassWarrior
	ClassKnight
	ClassPriest
	ClassKing
)

type Clickable

type Clickable struct {
	// Bounds defines position relative to WorldSpace
	Bounds engine.Rect

	Disabled bool

	ByOverlay bool
}

func (*Clickable) Disable

func (c *Clickable) Disable()

func (*Clickable) Enable

func (c *Clickable) Enable()

type ClickableOwner

type ClickableOwner interface {
	GetClickable() *Clickable
}

type Collider

type Collider struct {
	Bounds  engine.Rect
	Layer   CollisionLayer
	Overlay DrawableOwner
	// contains filtered or unexported fields
}

func (*Collider) AddCollision

func (c *Collider) AddCollision(other engine.Entity)

func (Collider) HasCollision

func (c Collider) HasCollision(other engine.Entity) bool

func (*Collider) RemoveCollision

func (c *Collider) RemoveCollision(other engine.Entity)

type ColliderOwner

type ColliderOwner interface {
	GetCollider() *Collider
}

type CollisionLayer

type CollisionLayer int
const (
	CollisionLayerGround CollisionLayer = iota
	CollisionLayerUnits
	CollisionLayerBuildings
)

type Drawable

type Drawable struct {
	Sprite engine.Sprite
	Layer  DrawingLayer

	Disabled bool
}

func (*Drawable) Disable

func (d *Drawable) Disable()

func (*Drawable) Enable

func (d *Drawable) Enable()

type DrawableOwner

type DrawableOwner interface {
	GetDrawable() *Drawable
}

type DrawingLayer

type DrawingLayer int
const (
	LayerBackground DrawingLayer = iota
	LayerGround
	LayerObjects
	LayerUnits
	LayerForeground
	LayerUI
	LayerUIPanel
	LayerUIButton
)
const (
	UILayerBackground DrawingLayer = iota
	UILayerText
)

type Movable

type Movable struct {
	Target   *engine.Vector
	Disabled bool
}

func (*Movable) ClearTarget

func (m *Movable) ClearTarget()

func (*Movable) Disable

func (m *Movable) Disable()

func (*Movable) Enable

func (m *Movable) Enable()

func (*Movable) SetTarget

func (m *Movable) SetTarget(target engine.Vector)

type MovableOwner

type MovableOwner interface {
	GetMovable() *Movable
}

type MovementArea

type MovementArea struct {
	// TODO ?
	Speed float64
}

type ProgressBar

type ProgressBar struct {
	Background ProgressBarSprites
	Foreground ProgressBarSprites
	Progress   float64
}

func (*ProgressBar) SetProgress

func (p *ProgressBar) SetProgress(progress float64)

type ProgressBarOwner

type ProgressBarOwner interface {
	GetProgressBar() *ProgressBar
}

type ProgressBarSprites

type ProgressBarSprites struct {
	Left  engine.Sprite
	Mid   engine.Sprite
	Right engine.Sprite

	Full engine.Sprite
}

type Resources

type Resources struct {
	Food  int
	Wood  int
	Stone int
	Gold  int
	Iron  int
}

func (*Resources) Update

func (r *Resources) Update(update Resources)

type ResourcesCollector

type ResourcesCollector struct {
	CurrentResources Resources
	Collecting       bool
}

type ResourcesCollectorOwner

type ResourcesCollectorOwner interface {
	GetResourcesCollector() *ResourcesCollector
}

type ResourcesSource

type ResourcesSource struct {
	Resources Resources
}

type ResourcesSourceOwner

type ResourcesSourceOwner interface {
	GetResourcesSource() *ResourcesSource
}

type Selectable

type Selectable struct {
	Selected bool
	Overlay  DrawableOwner
}

func (*Selectable) Select

func (s *Selectable) Select()

func (*Selectable) Unselect

func (s *Selectable) Unselect()

type SelectableOwner

type SelectableOwner interface {
	GetSelectable() *Selectable
}

type SettlementType

type SettlementType int
const (
	SettlementColony SettlementType = iota
	SettlementVillage
	SettlementCastle
)

type Size

type Size struct {
	Width  int
	Height int
}

func (*Size) Set

func (s *Size) Set(w int, h int)

type SizeOwner

type SizeOwner interface {
	GetSize() *Size
}

type Team

type Team int
const (
	TeamBlue Team = iota
	TeamRed
	TeamGreen
	TeamGray
)

type TimeActions

type TimeActions struct {
	Timers []*engine.CountdownTimer
}

func (*TimeActions) AddTimer

func (t *TimeActions) AddTimer(timer *engine.CountdownTimer)

type TimeActionsOwner

type TimeActionsOwner interface {
	GetTimeActions() *TimeActions
}

type UIColor

type UIColor int
const (
	UIColorBeige UIColor = iota
	UIColorBrown
)

type UnitSpawner

type UnitSpawner struct {
	Options []UnitSpawnerOption
	Queue   []UnitSpawnerOption
	Timer   *engine.CountdownTimer
}

func (*UnitSpawner) AddToQueue

func (u *UnitSpawner) AddToQueue(option UnitSpawnerOption)

func (*UnitSpawner) PopFromQueue

func (u *UnitSpawner) PopFromQueue() (UnitSpawnerOption, bool)

type UnitSpawnerOption

type UnitSpawnerOption struct {
	Class     Class
	SpawnTime time.Duration
}

type UnitSpawnerOwner

type UnitSpawnerOwner interface {
	GetUnitSpawner() *UnitSpawner
}

type WorldSpace

type WorldSpace struct {
	Parent   *WorldSpace
	Children []WorldSpaceOwner
	// contains filtered or unexported fields
}

func (*WorldSpace) AddChild

func (w *WorldSpace) AddChild(child WorldSpaceOwner)

func (WorldSpace) HasParent

func (w WorldSpace) HasParent() bool

func (WorldSpace) LocalPosition

func (w WorldSpace) LocalPosition() engine.Vector

func (*WorldSpace) SetInWorld

func (w *WorldSpace) SetInWorld(x float64, y float64)

func (*WorldSpace) SetLocal

func (w *WorldSpace) SetLocal(x float64, y float64)

func (*WorldSpace) Translate

func (w *WorldSpace) Translate(x float64, y float64)

func (WorldSpace) WorldPosition

func (w WorldSpace) WorldPosition() engine.Vector

type WorldSpaceOwner

type WorldSpaceOwner interface {
	GetWorldSpace() *WorldSpace
}

Jump to

Keyboard shortcuts

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