simra

package
v0.0.0-...-3c69f0b Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2016 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogDebug

func LogDebug(format string, a ...interface{})

LogDebug prints logs. From simra, just call peer.LogDebug. This is disabled at Release Build.

func LogError

func LogError(format string, a ...interface{})

LogError prints logs. From simra, just call peer.LogError. This is never disabled even for Release build.

Types

type Driver

type Driver interface {
	// Initialize is called to initialize scene.
	Initialize()

	// Drive is called about 60 times per 1 sec.
	// It is the chance to update sprite information like
	// position, appear/disapper, and change scene.
	Drive()
}

Driver represents a scene driver.

type Simra

type Simra struct {
	// contains filtered or unexported fields
}

Simra is a struct that provides API interface of simra

func GetInstance

func GetInstance() *Simra

GetInstance returns instance of Simra. It is necessary to call this function to get Simra instance since Simra is single instance.

func (*Simra) AddSprite

func (simra *Simra) AddSprite(assetName string, rect image.Rectangle, s *Sprite)

AddSprite adds a sprite to current scene. To call this function, SetScene must be called in advance.

func (*Simra) AddTouchListener

func (simra *Simra) AddTouchListener(listener peer.TouchListener)

AddTouchListener registers a listener for notifying touch event. Event is notified when "screen" is touched.

func (*Simra) RemoveSprite

func (simra *Simra) RemoveSprite(s *Sprite)

RemoveSprite removes specified sprite from current scene. Removed sprite will be disappeared.

func (*Simra) RemoveTouchListener

func (simra *Simra) RemoveTouchListener(listener peer.TouchListener)

RemoveTouchListener unregisters a listener for notifying touch event.

func (*Simra) SetDesiredScreenSize

func (simra *Simra) SetDesiredScreenSize(w, h float32)

SetDesiredScreenSize configures virtual screen size. This function must be called at least once before calling Start.

func (*Simra) SetScene

func (simra *Simra) SetScene(driver Driver)

SetScene sets a driver as a scene. If a driver is already set, it is replaced with new one.

func (*Simra) Start

func (simra *Simra) Start(onStart, onStop chan bool)

Start needs to call to enable all function belong to simra package.

type Sprite

type Sprite struct {
	peer.Sprite
}

Sprite represents a sprite object.

func (*Sprite) AddTouchListener

func (sprite *Sprite) AddTouchListener(listener peer.TouchListener)

AddTouchListener registers a listener for touch event. Touch event will be notified when "sprite" is touched.

func (*Sprite) RemoveAllTouchListener

func (sprite *Sprite) RemoveAllTouchListener()

RemoveAllTouchListener removes all listeners already registered.

func (*Sprite) ReplaceTexture

func (sprite *Sprite) ReplaceTexture(assetName string, rect image.Rectangle)

ReplaceTexture replaces sprite's texture with specified image resource.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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