structure

package
v0.0.0-...-923ccd2 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Abs

func Abs[T Number](value T) T

func ConvertNumberFloat64toInt32

func ConvertNumberFloat64toInt32(v float64) int32

func ConvertNumberInt32toFloat64

func ConvertNumberInt32toFloat64(v int32) float64

func Div

func Div[T Number](x T, y T) T

func Inv

func Inv[T Number](value T) T

func MinMax

func MinMax[T Number](values ...T) (T, T)

Types

type BinaryTreeDirection

type BinaryTreeDirection int8
const (
	BinaryTreeLeft BinaryTreeDirection = iota
	BinaryTreeRight
)

func (BinaryTreeDirection) Opposite

func (direction BinaryTreeDirection) Opposite() BinaryTreeDirection

type BinaryTreeNode

type BinaryTreeNode[T any] struct {
	// contains filtered or unexported fields
}

func NewBinaryTreeNode

func NewBinaryTreeNode[T any](value T) (node *BinaryTreeNode[T])

func (*BinaryTreeNode[T]) AddLeft

func (node *BinaryTreeNode[T]) AddLeft(value T) (result *BinaryTreeNode[T])

func (*BinaryTreeNode[T]) AddRight

func (node *BinaryTreeNode[T]) AddRight(value T) (result *BinaryTreeNode[T])

func (*BinaryTreeNode[T]) ChildAdd

func (node *BinaryTreeNode[T]) ChildAdd(value T, direction BinaryTreeDirection) (result *BinaryTreeNode[T])

func (*BinaryTreeNode[T]) ChildGet

func (node *BinaryTreeNode[T]) ChildGet(direction BinaryTreeDirection) (result optionals.Optional[*BinaryTreeNode[T]])

func (*BinaryTreeNode[T]) Init

func (node *BinaryTreeNode[T]) Init() *BinaryTreeNode[T]

func (*BinaryTreeNode[T]) IsRoot

func (node *BinaryTreeNode[T]) IsRoot() bool

func (*BinaryTreeNode[T]) Left

func (node *BinaryTreeNode[T]) Left() optionals.Optional[*BinaryTreeNode[T]]

func (*BinaryTreeNode[T]) Prev

func (node *BinaryTreeNode[T]) Prev() optionals.Optional[*BinaryTreeNode[T]]

func (*BinaryTreeNode[T]) Right

func (node *BinaryTreeNode[T]) Right() optionals.Optional[*BinaryTreeNode[T]]

func (*BinaryTreeNode[T]) SetValue

func (node *BinaryTreeNode[T]) SetValue(value T)

func (*BinaryTreeNode[T]) Value

func (node *BinaryTreeNode[T]) Value() T

type Box

type Box[T Number] struct {
	// contains filtered or unexported fields
}

func NewBox

func NewBox[T Number](position Vector2[T], size Vector2[T]) Box[T]

func (Box[T]) Center

func (box Box[T]) Center() Vector2[T]

func (Box[T]) CollisionPoint

func (box Box[T]) CollisionPoint(point Vector2[T]) (result bool)

func (Box[T]) H

func (box Box[T]) H() T

func (Box[T]) Position

func (box Box[T]) Position() Vector2[T]

func (Box[T]) Size

func (box Box[T]) Size() Vector2[T]

func (Box[T]) ToRaylibRectangle

func (box Box[T]) ToRaylibRectangle() rl.Rectangle

func (Box[T]) W

func (box Box[T]) W() T

func (Box[T]) X

func (box Box[T]) X() T

func (Box[T]) Y

func (box Box[T]) Y() T

type Cached

type Cached[T any] struct {
	// contains filtered or unexported fields
}

Cached is a generic struct used to keep track of data that evolves with time Cached.supply is called under a goroutine each time Cached.value has expired

func NewCached

func NewCached[T any](value T, supply func(T) (T, error), life int64) *Cached[T]

func (*Cached[T]) Alive

func (cached *Cached[T]) Alive() bool

func (*Cached[T]) Get

func (cached *Cached[T]) Get() (result T, err error)

func (*Cached[T]) GetMust

func (cached *Cached[T]) GetMust() (result T)

func (*Cached[T]) Init

func (cached *Cached[T]) Init() *Cached[T]

func (*Cached[T]) Now

func (cached *Cached[T]) Now() int64

func (*Cached[T]) Tick

func (cached *Cached[T]) Tick()

func (*Cached[T]) Update

func (cached *Cached[T]) Update()

type Number

type Number interface {
	constraints.Integer | constraints.Float
}

type Pair

type Pair[A any, B any] struct {
	// contains filtered or unexported fields
}

func NewPair

func NewPair[A any, B any](a A, b B) Pair[A, B]

func (Pair[A, B]) A

func (pair Pair[A, B]) A() A

func (Pair[A, B]) B

func (pair Pair[A, B]) B() B

type Vector2

type Vector2[T Number] struct {
	// contains filtered or unexported fields
}

func MapVector2

func MapVector2[T Number, U Number](vector Vector2[T], fn func(T) U) Vector2[U]

func NewVector2

func NewVector2[T Number, V Number](x V, y V) Vector2[T]

func NewVector2FromRaylib

func NewVector2FromRaylib[T Number](value rl.Vector2) Vector2[T]

func NewVector2Random

func NewVector2Random[T Number](n int) Vector2[T]

func (Vector2[T]) Abs

func (vector Vector2[T]) Abs() Vector2[T]

func (Vector2[T]) Add

func (vector Vector2[T]) Add(value Vector2[T]) Vector2[T]

func (Vector2[T]) Copy

func (vector Vector2[T]) Copy() Vector2[T]

func (Vector2[T]) Div

func (vector Vector2[T]) Div(value Vector2[T]) Vector2[T]

func (Vector2[T]) Inv

func (vector Vector2[T]) Inv() Vector2[T]

func (Vector2[T]) Max

func (vector Vector2[T]) Max() T

func (Vector2[T]) Min

func (vector Vector2[T]) Min() T

func (Vector2[T]) Mul

func (vector Vector2[T]) Mul(value Vector2[T]) Vector2[T]

func (Vector2[T]) Order

func (vector Vector2[T]) Order(reversed bool) Vector2[T]

func (Vector2[T]) Rev

func (vector Vector2[T]) Rev() Vector2[T]

func (Vector2[T]) Sub

func (vector Vector2[T]) Sub(value Vector2[T]) Vector2[T]

func (Vector2[T]) ToFloat32

func (vector Vector2[T]) ToFloat32() Vector2[float32]

func (Vector2[T]) ToFloat64

func (vector Vector2[T]) ToFloat64() Vector2[float64]

func (Vector2[T]) ToInt32

func (vector Vector2[T]) ToInt32() Vector2[int32]

func (Vector2[T]) ToRaylib

func (vector Vector2[T]) ToRaylib() rl.Vector2

func (Vector2[T]) X

func (vector Vector2[T]) X() T

func (Vector2[T]) Y

func (vector Vector2[T]) Y() T

type Vector3

type Vector3[T Number] struct {
	// contains filtered or unexported fields
}

func MapVector3

func MapVector3[T Number, U Number](vector Vector3[T], fn func(T) U) Vector3[U]

func NewVector3

func NewVector3[T Number, V Number](x V, y V, z V) Vector3[T]

func NewVector3Random

func NewVector3Random[T Number](n int) Vector3[T]

func (Vector3[T]) Add

func (vector Vector3[T]) Add(value Vector3[T]) Vector3[T]

func (Vector3[T]) Copy

func (vector Vector3[T]) Copy() Vector3[T]

func (Vector3[T]) Div

func (vector Vector3[T]) Div(value Vector3[T]) Vector3[T]

func (Vector3[T]) Mul

func (vector Vector3[T]) Mul(value Vector3[T]) Vector3[T]

func (Vector3[T]) Sub

func (vector Vector3[T]) Sub(value Vector3[T]) Vector3[T]

func (Vector3[T]) ToColor

func (vector Vector3[T]) ToColor() color.RGBA

func (Vector3[T]) ToFloat32

func (vector Vector3[T]) ToFloat32() Vector3[float32]

func (Vector3[T]) ToFloat64

func (vector Vector3[T]) ToFloat64() Vector3[float64]

func (Vector3[T]) ToInt32

func (vector Vector3[T]) ToInt32() Vector3[int32]

func (Vector3[T]) ToRaylib

func (vector Vector3[T]) ToRaylib() rl.Vector3

func (Vector3[T]) ToUint8

func (vector Vector3[T]) ToUint8() Vector3[uint8]

func (Vector3[T]) X

func (vector Vector3[T]) X() T

func (Vector3[T]) Y

func (vector Vector3[T]) Y() T

func (Vector3[T]) Z

func (vector Vector3[T]) Z() T

Jump to

Keyboard shortcuts

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