utilz

package
v0.0.0-...-54c8723 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

============================================================= log.go ------------------------------------------------------------- Various logging functions =============================================================

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clamp

func Clamp(value, min, max float64) float64

Clamp restricts a number to a certain range. If a value is too high, it’s reduced to the maximum. If it’s too low, it’s increased to the minimum.

func Debug

func Debug(msg string, vars ...interface{})

func DebugPxPoint

func DebugPxPoint(x, y float64, renderer pixel.Target)

func Error

func Error(msg string, vars ...interface{})

func GetAlpha

func GetAlpha(f float64) uint8

func HexToColor

func HexToColor(hex string) (c color.RGBA)

HexToColor("#E53935")

func LoadAnimationsFromCSV

func LoadAnimationsFromCSV(descPath string, spriteFrames []pixel.Rect) map[string][]pixel.Rect

LoadAnimationFromCSV to set image sprite frames to good use, load them as set of animations csv file: Front,0,0 FrontBlink,1,1 LookUp,2,2 Left,3,7 LeftRight,4,6 LeftBlink,7,7 Walk,8,15 Run,16,23 Jump,24,26

e.g. animations = LoadAnimationFromCSV("./animations.csv", LoadAsFrames())

func LoadAsFrames

func LoadAsFrames(imgSprite pixel.Picture, w, h float64) []pixel.Rect

func LoadAsFramesFromTop

func LoadAsFramesFromTop(imgSprite pixel.Picture, w, h float64) []pixel.Rect

func LoadPicture

func LoadPicture(path string) (pixel.Picture, error)

func LoadSprite

func LoadSprite(path string) (*pixel.Sprite, *pixel.PictureData)

LoadSprite load TMX tile image source

func LoadTTF

func LoadTTF(path string, size float64) (font.Face, error)

func MaxInt

func MaxInt(a, b int) int

func MinInt

func MinInt(a, b int) int

func PanicIfErr

func PanicIfErr(err error)

func PrintMemoryUsage

func PrintMemoryUsage()

func RandFloat

func RandFloat(min, max float64) float64

func RandInt

func RandInt(min, max int) int

func Warning

func Warning(msg string, vars ...interface{})

Types

type UV

type UV struct {
	// contains filtered or unexported fields
}

func GenerateUVs

func GenerateUVs(tileWidth, tileHeight float64, texture pixel.Picture) []UV

Jump to

Keyboard shortcuts

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