Documentation
¶
Index ¶
- Constants
- Variables
- func AppDataDir() (string, error)
- func CollectFloats(values []interface{}, buff []float64) int
- func ParseRGBA(values []interface{}) (c mat.RGBA, ln int)
- type Loader
- type OSFS
- type RawStyle
- func (r RawStyle) AABB(key string, def mat.AABB) (m mat.AABB)
- func (r RawStyle) Bool(key string, def bool) (v bool)
- func (r RawStyle) Float(key string, def float64) (v float64)
- func (r RawStyle) Ident(key, def string) string
- func (r RawStyle) Int(key string, def int) (v int)
- func (r RawStyle) RGBA(key string, def mat.RGBA) (c mat.RGBA)
- func (r RawStyle) Region(key string, regions map[string]mat.AABB, def mat.AABB) mat.AABB
- func (r RawStyle) Sub(key string, def RawStyle) (v RawStyle)
- func (r RawStyle) Vec(key string, def mat.Vec) (u mat.Vec)
- type Util
- func (l Util) Json(p string, dest interface{}) error
- func (l Util) List(root string, buff []string, rec bool, ext string) (r []string, err error)
- func (l Util) LoadImage(p string) (*image.NRGBA, error)
- func (l Util) LoadTTF(p string, size float64) (font.Face, error)
- func (l Util) SaveJson(p string, value interface{}) error
- func (l Util) Walk(root string, fn func(path string, d fs.DirEntry, err error) error)
Constants ¶
const Fill float64 = 100000.767898765556788777667787666
Fill is constant important to ui, it is also redeclare here so check it out
Variables ¶
var (
ErrNotOnDisc = sterr.New("%s file not found on disc")
)
errors
var OS = Util{Loader: OSFS{}}
OS is default os loader
Functions ¶
func AppDataDir ¶ added in v0.4.3
AppDataDir returns directory where the app data is located
func CollectFloats ¶
CollectFloats collects consecutive floating point numbers and returns how match was collected
func ParseRGBA ¶
ParseRGBA parses slice if interfaces into color and returns how big the color was
syntax:
name - simple name of color can be enough if its contained in map in mlok/mat/rgba package a - specify only one float/int channel and mat.Alpha(alpha) will be returned r, g, b - specify threes floats/ints and mat.RGB(r, g, b) will be returned r, g, b, a - specify four floats/ints and mat.RGBA{r, g, b, a} will be returned hex - hex color notation
Types ¶
type Loader ¶ added in v0.2.14
Loader can be a OSFS or embed.FS, so writing generic asset loading where it does not matter where you load from
type OSFS ¶ added in v0.2.14
type OSFS struct{}
OSFS uses os as source of data
type RawStyle ¶
RawStyle is wrapper of goss.RawStyle and adds extra functionality
func (RawStyle) AABB ¶
AABB parser margin under the key, if parsing fails or margin is not present, default is returned
func (RawStyle) RGBA ¶
RGBA returns a color under the key, if color parsing fails or color is not present, def is returned this also accepts names mapped in mlok/mat/rgba.Colors
type Util ¶ added in v0.2.14
Util brings some utility for Loader, if you specify root it will be prepended to path you input
func AppData ¶ added in v0.4.3
AppData returns AppData access, the root is usually the name of your app
func (Util) List ¶ added in v0.2.14
List lists all paths in given directory. If rec == true, function will go recursively. If ext == "" they any extencion is valid, ext does not include dot ("go" not ".go")