loader

package
v0.0.0-...-d623aaa Latest Latest
Warning

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

Go to latest
Published: May 28, 2018 License: ISC Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BundleSequence resources.BundleSequence

BundleSequence is the bundle sequence that's used for opening/loading data If you need to use your own bundles, just override it

Functions

func Bytes

func Bytes(path string) ([]byte, error)

Bytes opens a file from the bundle sequence and tries to read all of its contents immediately

func Image

func Image(path string) (*image.RGBA, error)

Image loads an image and returns it as a image.RGBA

func Open

func Open(path string) (io.ReadCloser, error)

Open wraps resources.Open so it uses our custom bundle instead of the default one

func String

func String(path string) (string, error)

String calls Bytes(..) but returns the result as a string

Types

type Resource

type Resource struct {
	io.ReadCloser
}

Resource is a wrapper for a ReadCloser with some extra sugar

func Load

func Load(path string) (Resource, error)

Load tries to open a file and returns a Resource when successful

func (Resource) Bytes

func (r Resource) Bytes() ([]byte, error)

Bytes tries to read the file data as bytes Warning: once used, the reader underneath will be closed!

func (Resource) Image

func (r Resource) Image() (*image.RGBA, error)

Image tries to decode the file as an image Warning: once used, the reader underneath will be closed! Image loads an image and returns it as a image.RGBA

func (Resource) String

func (r Resource) String() (string, error)

String tries to read the file data as a string Warning: once used, the reader underneath will be closed!

Jump to

Keyboard shortcuts

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