utils

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SignUpRoute         = "sign_up"
	RootRoute           = "root"
	GameRoute           = "game"
	Vs6WaitingRoomRoute = "vs6_waiting_room"
	Vs1WaitingRoomRoute = "vs1_waiting_room"
	LobbiesRoute        = "lobbies"
	NewLobbyRoute       = "new_lobby"
	ShowLobbyRoute      = "show_lobby"
)

Variables

This section is empty.

Functions

func ClosestMultiple added in v1.0.3

func ClosestMultiple(a, b int) int

ClosestMultiple finds the closest multiple of 'b' for the number 'a'

func DirectionStrings

func DirectionStrings() []string

DirectionStrings returns a slice of all String values of the enum

func LogTime added in v1.0.3

func LogTime(l *slog.Logger, b time.Time, msg string, args ...any)

func PreviousMultiple added in v1.0.3

func PreviousMultiple(a, b int) int

PreviousMultiple find the previous multiple of 'b' for the number 'a'

Types

type Direction

type Direction int
const (
	Up Direction = iota
	Down
	Left
	Right
)

func DirectionString

func DirectionString(s string) (Direction, error)

DirectionString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func DirectionValues

func DirectionValues() []Direction

DirectionValues returns all values of the enum

func (Direction) IsADirection

func (i Direction) IsADirection() bool

IsADirection returns "true" if the value is listed in the enum definition. "false" otherwise

func (Direction) String

func (i Direction) String() string

type MovingObject

type MovingObject struct {
	Object

	Facing      Direction
	MovingCount int
}

type Object

type Object struct {
	X, Y float64
	W, H int
}

func (Object) IsColliding

func (o Object) IsColliding(c Object) bool

IsColliding will check if Object c is colliding with Object o

func (Object) IsCollidingCircle added in v1.2.0

func (o Object) IsCollidingCircle(c Object, r float64) bool

func (Object) IsInside

func (o Object) IsInside(c Object) bool

IsInside will check if Object c is inside (all of it) of Object o

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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