engine

package
v0.0.0-...-faf1d8f Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Close

type Close func(*Engine)

type Config

type Config interface {
	Order() int
	Configure(*Engine) error
}

func DefaultConfig

func DefaultConfig(fn ConfigFn) Config

func NewConfig

func NewConfig(order int, fn ConfigFn) Config

func SetDebug

func SetDebug(b bool) Config

func SetInner

func SetInner(fn MakeInner) Config

func SetLastTick

func SetLastTick(v float64) Config

func SetLogger

func SetLogger(l log.Logger) Config

func SetReportFrame

func SetReportFrame(b bool) Config

func SetReportStep

func SetReportStep(b bool) Config

func SetTickDuration

func SetTickDuration(d string) Config

func SetTickValue

func SetTickValue(v float64) Config

type ConfigFn

type ConfigFn func(*Engine) error

type Configuration

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

func (*Configuration) Add

func (c *Configuration) Add(conf ...Config)

func (*Configuration) AddFn

func (c *Configuration) AddFn(fns ...ConfigFn)

func (*Configuration) Configure

func (c *Configuration) Configure() error

func (*Configuration) Configured

func (c *Configuration) Configured() bool

func (*Configuration) Init

func (c *Configuration) Init(e *Engine, conf ...Config)

type Engine

type Engine struct {
	log.Logger
	ErrorHandler
	Configuration
	Settings
	*State
	// contains filtered or unexported fields
}

func New

func New(cnf ...Config) (*Engine, error)

func (*Engine) Close

func (e *Engine) Close() int

Handles closing, returns an exit code only unless settings.HardExit is true

func (*Engine) DebugReport

func (e *Engine) DebugReport(f Frame, s *step.Step)

func (*Engine) Run

func (e *Engine) Run()

func (*Engine) SignalHandler

func (e *Engine) SignalHandler(s os.Signal) int

Handle the provided os.Signal, clsoing if necessary and returning an integer.

type ErrorHandler

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

func (*ErrorHandler) HandleError

func (e *ErrorHandler) HandleError(r error)

func (*ErrorHandler) HandleWarning

func (e *ErrorHandler) HandleWarning(w ...error)

func (*ErrorHandler) Init

func (e *ErrorHandler) Init(n *Engine)

func (*ErrorHandler) SetHandleError

func (e *ErrorHandler) SetHandleError(fn HandleErrorFunc)

type FPSFunc

type FPSFunc func(*frame, time.Duration) (float64, float64, bool)

type Frame

type Frame interface {
	Start()
	End()
	FPS(time.Duration) (float64, float64, bool)
}

Frame is an interface for managing and detailing engine timing information.

func DebugFrame

func DebugFrame() Frame

func MaxLimitFrame

func MaxLimitFrame(target uint) Frame

type FrameFunc

type FrameFunc func(*frame)

type HandleErrorFunc

type HandleErrorFunc func(*Engine, error)

type Inner

type Inner func()

func DebugInner

func DebugInner(e *Engine, w core.World) Inner

func DefaultInner

func DefaultInner(e *Engine, w core.World) Inner

func NoDurationLimitInner

func NoDurationLimitInner(e *Engine, w core.World) Inner

type MakeInner

type MakeInner func(e *Engine, w core.World) Inner

type Settings

type Settings struct {
	HardExit                    bool
	TickDuration                time.Duration
	TickIncr, TickInit, TickEnd float64
	DebugReportStep             bool
	DebugReportFrame            bool
}

type State

type State struct {
	ChKill chan struct{}
	ChSys  chan os.Signal

	LastTick float64
	// contains filtered or unexported fields
}

func (*State) Debug

func (s *State) Debug() bool

func (*State) Kill

func (s *State) Kill()

func (*State) Pause

func (s *State) Pause()

func (*State) Restart

func (s *State) Restart()

func (*State) SetClose

func (s *State) SetClose(c ...Close)

func (*State) Unpause

func (s *State) Unpause()

Jump to

Keyboard shortcuts

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