component

package
v0.0.0-...-4142f2f Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

The component package has some basic structs that are common in games (e.g. velocity)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Coordinate

type Coordinate struct {
	X float32
	Y float32
}

func (Coordinate) Add

func (c Coordinate) Add(other Coordinate) Coordinate

func (Coordinate) GetDirection

func (c Coordinate) GetDirection(other Coordinate) float32

func (Coordinate) GetDistance

func (c Coordinate) GetDistance(other Coordinate) float32

func (*Coordinate) SetCoordinate

func (c *Coordinate) SetCoordinate(newCoord Coordinate)

func (Coordinate) String

func (c Coordinate) String() string

func (Coordinate) Subtract

func (c Coordinate) Subtract(other Coordinate) Coordinate

func (Coordinate) TranslateXY

func (c Coordinate) TranslateXY(offset Coordinate, pixelSize float32) (float32, float32)

type PixelSize

type PixelSize float64

type Position

type Position struct {
	X, Y float64
}

type Rotation

type Rotation float64

func (Rotation) Cos

func (r Rotation) Cos() float64

func (Rotation) Rad

func (r Rotation) Rad() float64

func (Rotation) Sin

func (r Rotation) Sin() float64

type Size

type Size struct {
	Width, Height float64
}

type UUID

type UUID uuid.UUID

func NewUUID

func NewUUID() UUID

type Velocity

type Velocity struct {
	VX float64
	VY float64
}

func (*Velocity) ClampVelocity

func (v *Velocity) ClampVelocity(limit float64)

func (*Velocity) DiminishVelocity

func (v *Velocity) DiminishVelocity(friction float64)

type Width

type Width float64

Jump to

Keyboard shortcuts

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