Documentation ¶
Overview ¶
Package resource handles resources
Index ¶
- func ReadTexture(rd io.Reader) (*gorge.TextureData, error)
- func Register(v any, ext string, fn LoaderFunc)
- func System(g *gorge.Context)
- func TextureDataFromImage(im image.Image) (*gorge.TextureData, error)
- func TextureFromImage(im image.Image) (*gorge.Texture, error)
- type Context
- type EventLoadComplete
- type EventLoadStart
- type EventOpen
- type FileFS
- type HTTPFS
- type LoaderFunc
- type Resource
- func (r *Resource) AddFS(prefix string, fs fs.FS)
- func (r *Resource) Error(err error)
- func (r *Resource) Gorge() *gorge.Context
- func (r *Resource) Load(v any, name string, opts ...any) error
- func (r *Resource) LoadBytes(name string) ([]byte, error)
- func (r *Resource) LoadString(name string) (string, error)
- func (r *Resource) MustLoad(v any, path string, opts ...any)
- func (r *Resource) Open(name string) (io.ReadCloser, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ReadTexture ¶
func ReadTexture(rd io.Reader) (*gorge.TextureData, error)
ReadTexture reads an image from the reader and returns a textureData.
func Register ¶
func Register(v any, ext string, fn LoaderFunc)
Register registers a loader for a type and extension.
func TextureDataFromImage ¶
func TextureDataFromImage(im image.Image) (*gorge.TextureData, error)
TextureDataFromImage converts a go image.Image to gorge.TextureData.
Types ¶
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
Context to be used in gorge systems
func FromContext ¶
FromContext returns a Context from a gorge Context
type EventLoadComplete ¶
EventLoadComplete is triggered when a resource finished loading.
type EventLoadStart ¶
EventLoadStart is trigger in gorge when a resource starts loading.
type EventOpen ¶
type EventOpen struct {
Name string
}
EventOpen is triggered when a resource is opened which differs from LoadStart it was meant to create some kind of progress bar while loading resources.
type FileFS ¶
type FileFS struct {
BasePath string
}
FileFS file system implementation opened files will be prefixed with BasePath
type LoaderFunc ¶
LoaderFunc is the type of a loader func
type Resource ¶
type Resource struct {
// contains filtered or unexported fields
}
Resource the resource manager.
func (*Resource) AddFS ¶
AddFS adds a new file system with the prefix if a path exists it will overlay the existing file system.
func (*Resource) LoadString ¶
LoadString returns asset as a string