Documentation ¶
Overview ¶
Package engine is the implementation of the bouncing balls simulation.
Index ¶
- type Engine
- func (e *Engine) ChangeGravityAbs(up bool)
- func (e *Engine) ChangeMaxBalls(up bool)
- func (e *Engine) ChangeMinMaxBallRatio(up bool)
- func (e *Engine) ChangeSpeed(up bool)
- func (e *Engine) Present(screen *ebiten.Image)
- func (e *Engine) Restart()
- func (e *Engine) RotateGravity(counterClockwise bool)
- func (e *Engine) ToggleOSD()
- func (e *Engine) Update()
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 (*Engine) ChangeGravityAbs ¶
ChangeGravityAbs changes the absolute value of the gravity. Adds +/- 100.
func (*Engine) ChangeMaxBalls ¶
ChangeMaxBalls changes the max number of balls. Adds +/- 1.
func (*Engine) ChangeMinMaxBallRatio ¶
ChangeMinMaxBallRatio changes the min-max ball ratio. Adds +/- 0.1.
func (*Engine) ChangeSpeed ¶
ChangeSpeed changes the speed of the simulation. Doubles it if up is true, else halves it.
func (*Engine) Present ¶
func (e *Engine) Present(screen *ebiten.Image)
update updates (recalculates) the world. It does it incrementally until engine state reaches the current timestamp.
func (*Engine) Restart ¶
func (e *Engine) Restart()
Restart restarts the simulation: removes all balls.
func (*Engine) RotateGravity ¶
RotateGravity rotates the gravity vector. Rotates +/- 10 degrees.