systems

package
v0.0.0-...-7004f9a Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ControllerSystem

type ControllerSystem struct{}

func NewControllerSystem

func NewControllerSystem() *ControllerSystem

func (*ControllerSystem) ShouldTrack

func (c *ControllerSystem) ShouldTrack(object object.GameObject) bool

ShouldTrack returns whether

func (*ControllerSystem) Update

func (c *ControllerSystem) Update(dT time.Duration, worldMap cartography.Map, objects map[uint64]object.GameObject) error

type GameSystem

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

GameSystem wraps an abstract system in a well-composed system object.

func NewGameSystem

func NewGameSystem(sys System) *GameSystem

NewGameSystem returns a game system from the provided struct implementing the system interface.

func (*GameSystem) Update

func (b *GameSystem) Update(dT time.Duration, currentMap cartography.Map, gameObjects map[uint64]object.GameObject) error

type InitiativeSystem

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

func NewInitiativeSystem

func NewInitiativeSystem() *InitiativeSystem

NewInitiativeSystem initializes and returns an initiative system.

func (*InitiativeSystem) ShouldTrack

func (s *InitiativeSystem) ShouldTrack(obj object.GameObject) bool

func (*InitiativeSystem) Update

func (s *InitiativeSystem) Update(dT time.Duration, worldMap cartography.Map, objects map[uint64]object.GameObject) error

type MovementSystem

type MovementSystem struct {
}

func NewMovementSystem

func NewMovementSystem() *MovementSystem

func (*MovementSystem) ShouldTrack

func (s *MovementSystem) ShouldTrack(object object.GameObject) bool

func (*MovementSystem) Update

func (s *MovementSystem) Update(dT time.Duration, worldMap cartography.Map, objects map[uint64]object.GameObject) error

type Renderer

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

A Renderer renders components.

func NewRenderer

func NewRenderer(engine RenderingEngine) (*Renderer, error)

NewRenderer returns a new rendering system.

func (*Renderer) ShouldTrack

func (r *Renderer) ShouldTrack(object object.GameObject) bool

func (*Renderer) Update

func (r *Renderer) Update(dT time.Duration, worldMap cartography.Map, objects map[uint64]object.GameObject) error

Update updates the system state.

type RenderingEngine

type RenderingEngine interface {
	Clear()
	Draw()

	Rectangle(x, y int, bgColor color.Color)
	Text(x, y int, text string, fgColor color.Color)
}

RenderingEngine abstracts a rendering engine.

type SightSystem

type SightSystem struct {
	RayCount int
	RayStep  int

	DefaultVisibility float64
}

func NewSightSystem

func NewSightSystem(defaultVisibility float64) *SightSystem

func (*SightSystem) ShouldTrack

func (s *SightSystem) ShouldTrack(object object.GameObject) bool

ShouldTrack returns whether this system should track the object.

func (*SightSystem) Update

func (s *SightSystem) Update(dT time.Duration, worldMap cartography.Map, objects map[uint64]object.GameObject) error

type System

type System interface {
	ShouldTrack(object object.GameObject) bool
	Update(dT time.Duration, worldMap cartography.Map, objects map[uint64]object.GameObject) error
}

System represents a system.

type Viewport

type Viewport interface {
	Move(x, y int)
	SetZoom(amount float64)
}

type ViewportSystem

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

func NewViewportSystem

func NewViewportSystem(camera Viewport) *ViewportSystem

func (*ViewportSystem) ShouldTrack

func (c *ViewportSystem) ShouldTrack(object object.GameObject) bool

func (*ViewportSystem) Update

func (c *ViewportSystem) Update(dT time.Duration, worldMap cartography.Map, objects map[uint64]object.GameObject) error

Jump to

Keyboard shortcuts

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