engine

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package engine is the implementation of the bouncing balls simulation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Engine

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

Engine is the simulation engine. Contains the model, controls the simulation and presents it on the screen (via the scene).

func NewEngine

func NewEngine(r *sdl.Renderer, w, h int) *Engine

NewEngine creates a new Engine.

func (*Engine) ChangeGravityAbs

func (e *Engine) ChangeGravityAbs(up bool)

ChangeGravityAbs changes the absolute value of the gravity. Adds +/- 100.

func (*Engine) ChangeMaxBalls

func (e *Engine) ChangeMaxBalls(up bool)

ChangeMaxBalls changes the max number of balls. Adds +/- 1.

func (*Engine) ChangeMinMaxBallRatio

func (e *Engine) ChangeMinMaxBallRatio(up bool)

ChangeMinMaxBallRatio changes the min-max ball ratio. Adds +/- 0.1.

func (*Engine) ChangeSpeed

func (e *Engine) ChangeSpeed(up bool)

ChangeSpeed changes the speed of the simulation. Doubles it if up is true, else halves it.

func (*Engine) Do

func (e *Engine) Do(f func())

Do executes f in the Engine's goroutine. Returns after f returned (waits for f to complete).

func (*Engine) Restart

func (e *Engine) Restart()

Restart restarts the simulation: removes all balls.

func (*Engine) RotateGravity

func (e *Engine) RotateGravity(counterClockwise bool)

RotateGravity rotates the gravity vector. Rotates +/- 10 degrees.

func (*Engine) Run

func (e *Engine) Run()

Run runs the simulation.

func (*Engine) Stop

func (e *Engine) Stop()

Stop stops the simulation and waits for Run to return.

func (*Engine) ToggleOSD

func (e *Engine) ToggleOSD()

ToggleOSD toggles the OSD.

Jump to

Keyboard shortcuts

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