Documentation ¶
Index ¶
- Constants
- type Attractor
- type GVector
- type Mover
- func (m *Mover) ApplyForce(force *Vector)
- func (m *Mover) BounceOff()
- func (m *Mover) GetVelocity() *Vector
- func (m *Mover) PixelLoc() (int, int)
- func (m *Mover) Reset()
- func (m *Mover) SetLimit(limit float64)
- func (m *Mover) SetMass(mass float64)
- func (m *Mover) Update()
- func (m *Mover) UpdateSdl2()
- type Vector
- func (v *Vector) Add(u *Vector)
- func (v *Vector) Copy() *Vector
- func (v *Vector) Distance(u *Vector) float64
- func (v *Vector) Divide(n float64)
- func (v *Vector) Heading() (angle float64)
- func (v *Vector) Limit(mag float64)
- func (v *Vector) Magnitude() float64
- func (v *Vector) Multiply(n float64)
- func (v *Vector) Normalize()
- func (v *Vector) Rotate(deg float64)
- func (v *Vector) Subtract(u *Vector)
Constants ¶
const MoverDefMass = 1
MoverDefMass keeps the default mass of the Mover
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GVector ¶
type GVector interface { Add() Subtract() Multiply() Mangnitude() Normalize() Copy() }
GVector represents a geometric/Eucleadean vector
type Mover ¶
type Mover struct { Obj interface{} // contains filtered or unexported fields }
Mover describes a basic moveable object/particle
func (*Mover) ApplyForce ¶
ApplyForce adds the force vector the object's acceleration vector
func (*Mover) BounceOff ¶
func (m *Mover) BounceOff()
BounceOff keeps the mover within its container (bounces off) when it reaches an edge
func (*Mover) GetVelocity ¶
GetVelocity return the current velocity vector of the Mover
func (*Mover) PixelLoc ¶
PixelLoc returns the rounded values of location's X and Y which are ready for rendering
func (*Mover) Update ¶
func (m *Mover) Update()
Update modifies the object's location depending on the applied forces; Should be called on every rendering iteration
func (*Mover) UpdateSdl2 ¶
func (m *Mover) UpdateSdl2()
UpdateSdl2 performs Mover.Update() on SDL2-specific objects
type Vector ¶
Vector implements a GVector