application

– import “gomatcha.io/matcha/application”

Package application provides access to application resources. Image assets must be in the app’s .xcassets file (iOS) or res/drawable folder (Android). Disable “Compress PNG Files” and “Remove Text Metadata from PNG Files” in Xcode if loading image resources is not working. Android does not allow uppercase image names or folders and this restriction carries over to Matcha as well.

// Display an image.
img, err := application.LoadImage("example")
if err != nil {
    imageview.Image = img
}

// or
imageview.Image = application.MustLoadImage("example")
var OrientationNotifier comm.IntNotifier

In order to receive orientation notification on android you may need to set android:configChanges="orientation|keyboardHidden|screenSize" in your activity’s manifest (https://stackoverflow.com/a/6005624).

var ShakeNotifier comm.Notifier

func OpenURL

func OpenURL(url string) error

func Orientation

func Orientation() layout.Edge

layout.EdgeTop is portrait. EdgeRight and EdgeLeft are landscape and EdgeBottom is upside down.

type ImageResource

type ImageResource struct {
}

ImageResource represents a static image asset and implements the image.Image interface.

func LoadImage

func LoadImage(path string) (*ImageResource, error)

MustLoadImage loads the image at path.

func MustLoadImage

func MustLoadImage(path string) *ImageResource

MustLoadImage loads the image at path, or panics on error.

func (*ImageResource) At

func (res *ImageResource) At(x, y int) color.Color

At implements the image.Image interface.

func (*ImageResource) Bounds

func (res *ImageResource) Bounds() image.Rectangle

Bounds implements the image.Image interface.

func (*ImageResource) ColorModel

func (res *ImageResource) ColorModel() color.Model

ColorModel implements the image.Image interface.

func (*ImageResource) MarshalProtobuf

func (res *ImageResource) MarshalProtobuf() *env.ImageResource

MarshalProtobuf encodes res into a Protobuf object.

func (*ImageResource) Path

func (res *ImageResource) Path() string

Path returns the path to the image.

func (*ImageResource) Scale

func (res *ImageResource) Scale() float64

Scale returns the scale factor of the image.