Documentation ¶
Index ¶
- func NewImage(data []byte) (any, error)
- func NewShader(data []byte) (any, error)
- type FS
- func (fsys *FS) Dispose()
- func (fsys *FS) Get(name string) (any, error)
- func (fsys *FS) GetImage(name string) (*ebiten.Image, error)
- func (fsys *FS) GetShader(name string) (*ebiten.Shader, error)
- func (fsys *FS) MustGet(name string) any
- func (fsys *FS) MustGetImage(name string) *ebiten.Image
- func (fsys *FS) MustGetShader(name string) *ebiten.Shader
- type LiveAsset
- type LoadRule
- type Loadable
- type Loader
- type NewFSOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type FS ¶
func NewFS ¶
func NewFS(fsys fs.FS, opts *NewFSOptions) *FS
NewFS returns a wrapper of an fs.FS with specific loading rules for assets. NewImage and NewShader can be used as loaders for *.ext files for example.
func (*FS) Get ¶
Get returns the object with the given name, returns an error if the file could not be accessed or if asset could not be loaded.
func (*FS) MustGetImage ¶
MustGetImage returns the image with the given name without error handling.
func (*FS) MustGetShader ¶
MustGetShader returns the shader with the given name without error handling.
type LiveAsset ¶
type LiveAsset[T any] struct { // contains filtered or unexported fields }
LiveAsset represents a self-reloading asset object, its content is accessible by calling the Value() method.
func NewLiveAsset ¶
NewLiveAsset creates an hot-reloadable asset for ebitengine common types. The default supported types are *ebiten.Shader and *ebiten.Image (png,bmp,jpg).
func NewLiveAssetFunc ¶
NewLiveAssetFunc is a convenience function to create a new LiveAsset with the given path and a custom load function.
func (*LiveAsset[T]) Dispose ¶
func (a *LiveAsset[T]) Dispose()
Dispose unregisters this asset from the file watcher
type Loadable ¶
Loadable defines an interface for assets that can handle their own loading / initialization based on the file's content. Deserialize should be implemented on any custom type that needs to be supported by asset.FS or LiveAsset objects.
type Loader ¶
func NewImageWithOptionsLoader ¶
func NewImageWithOptionsLoader(opts *ebiten.NewImageFromImageOptions) Loader