engine

package
v0.0.0-...-94da4f6 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2023 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(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) 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

func (e *Engine) RotateGravity(counterClockwise bool)

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

func (*Engine) ToggleOSD

func (e *Engine) ToggleOSD()

ToggleOSD toggles the OSD.

func (*Engine) Update

func (e *Engine) Update()

update updates (recalculates) the world. It does it incrementally until engine state reaches the current timestamp.

Jump to

Keyboard shortcuts

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