Documentation
¶
Index ¶
- Constants
- func AngleFromDirection(vector t.Vector2) float64
- func AngleFromTwoDirections(from, to t.Vector2) float64
- func AngleFromTwoDirectionsReversed(to, from t.Vector2) float64
- func CheckCollisionRecs(rect1, rect2 image.Rectangle) bool
- func ClerpAngle(from, to float64) float64
- func ClerpDegrees(from, to float64) float64
- func DegreesFromRadians(radians float64) float64
- func DirectionFromDegrees(angleDegrees float64) t.Vector2
- func DirectionFromRadians(angle float64) t.Vector2
- func GetRandom[L any](list []L) L
- func GetRandomNumberFrom1ToMaxIncluded(max int) int
- func GetRandomNumberMinMaxIncluded(min, max int) int
- func GetRandomNumberZeroToMaxMinusOne(max int) int
- func Min(a, b int) int
- func OriginFromEbitenImage(rect *t.Rectangle) t.Vector2
- func OriginFromRectangle(r image.Rectangle) t.Vector2
- func RadiansFromDegrees(degrees float64) float64
- func RectFromRLRect(rlRect t.RLRectangle) image.Rectangle
- func RoundTo3[N ~float32 | ~float64](value N) N
- func RoundTo4[N ~float32 | ~float64](value N) N
- func Vector2Subtract(v1, v2 t.Vector2) t.Vector2
- func VectorToDegrees(vector t.Vector2) float64
- func WrapAngle(angle float64) float64
- func WrapDegrees(angle float64) float64
Constants ¶
const (
SMOOTHNESS = 0.20
)
Variables ¶
This section is empty.
Functions ¶
func AngleFromDirection ¶
AngleFromDirection converts a vector to an angle x and y will move from -1 to 1, which shows the angle
func AngleFromTwoDirections ¶
AngleFromTwoDirections calculates the angle between two vectors
func AngleFromTwoDirectionsReversed ¶
AngleFromTwoDirectionsReversed calculates the angle between two vectors (reversed order)
func CheckCollisionRecs ¶
CheckCollisionRecs checks collision between two rectangles
func ClerpAngle ¶
ClerpAngle performs a linear interpolation to smooth transitions between angles It normalizes the angle to the range −𝜋 to π by repeatedly adding or subtracting 2𝜋 until the angle falls within the desired range.
func ClerpDegrees ¶
func DegreesFromRadians ¶
degrees=radians×(180/π) DegreesFromRadians converts an angle from radians to degrees
func DirectionFromDegrees ¶
AngleToVector converts an angle in degrees to a vector
func DirectionFromRadians ¶
DirectionFromRadians converts an angle to a vector
func GetRandomNumberMinMaxIncluded ¶
GetRandomNumber returns a random integer between min and max (inclusive)
func GetRandomNumberZeroToMaxMinusOne ¶
GetRandomNumberZeroToMaxMinusOne returns a random integer between 0 and max (inclusive)
func OriginFromRectangle ¶
gets middle of rectangle (size/2) for rotating. X and Y added to the position(upper left) of the rectangle
func RadiansFromDegrees ¶
RadiansFromDegrees converts an angle from degrees to radians
func RectFromRLRect ¶
func RectFromRLRect(rlRect t.RLRectangle) image.Rectangle
CheckCollisionRecs checks collision between two rectangles deprecated use rlRect.ToImageRectangle
func Vector2Subtract ¶
t.Vector2Subtract - Subtract two vectors (v1 - v2)
func VectorToDegrees ¶
func WrapAngle ¶
WrapAngle reduces the given angle to a value between -pi and pi The Clerp function calls WrapAngle to ensure the angle difference is normalized before performing the linear interpolation.
func WrapDegrees ¶
WrapAngle reduces the given angle to a value between -180° and 180° The Clerp function calls WrapAngle to ensure the angle difference is normalized before performing the linear interpolation.
Types ¶
This section is empty.