engine

package
v0.0.0-...-d4a0833 Latest Latest
Warning

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

Go to latest
Published: May 10, 2021 License: Unlicense Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

type Engine struct {
	Managers []IManager
	// contains filtered or unexported fields
}

Engine Game engine Only 1 should be initialised

func NewEngine

func NewEngine() *Engine

NewEngine returns a new engine instance

func (*Engine) AddManager

func (engine *Engine) AddManager(manager IManager)

AddManager Adds a new manager to the engine

func (*Engine) Close

func (engine *Engine) Close()

Close marks the engine to exit at the end of the current loop

func (*Engine) Initialise

func (engine *Engine) Initialise()

Initialise the engine, and attached managers

func (*Engine) Run

func (engine *Engine) Run()

Run the engine

func (*Engine) SetSimulationSpeed

func (engine *Engine) SetSimulationSpeed(multiplier float64)

SetSimulationSpeed allows for speeding up and slowing down the game clock

type IManager

type IManager interface {
	Register()
	RunConcurrent()
	Update(float64)
	Unregister()
	PostUpdate()
}

IManager Generic game manager. Different systems should implement these methods

type Manager

type Manager struct {
}

Manager Managers exist to create and handle behaviour.

func (*Manager) PostUpdate

func (manager *Manager) PostUpdate()

PostUpdate Called at the end of each loop.

func (*Manager) Register

func (manager *Manager) Register()

Register this manager in the engine. This is called by the engine when the system is attached.

func (*Manager) RunConcurrent

func (manager *Manager) RunConcurrent()

RunConcurrent If this manager is supported to run concurrently, custom concurrency function should be defined here

func (*Manager) Unregister

func (manager *Manager) Unregister()

Unregister Called when this manager is detached and destroyed by the engine

func (*Manager) Update

func (manager *Manager) Update(dt float64)

Update Called every update loop. dt is the time elapsed since last called

Jump to

Keyboard shortcuts

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