Documentation ¶
Index ¶
- Constants
- func GetScreenSize() size.Event
- func LogDebug(format string, a ...interface{})
- func LogError(format string, a ...interface{})
- func SetDesiredScreenSize(w, h float32)
- func SetScreenSize(s size.Event)
- type GLPeer
- func (glpeer *GLPeer) Finalize()
- func (glpeer *GLPeer) Initialize(glctx gl.Context)
- func (glpeer *GLPeer) LoadTexture(assetName string, rect image.Rectangle) sprite.SubTex
- func (glpeer *GLPeer) LoadTextureFromImage(img image.Image, rect image.Rectangle) sprite.SubTex
- func (glpeer *GLPeer) Reset()
- func (glpeer *GLPeer) Update()
- type Sprite
- type SpriteContainer
- func (spritecontainer *SpriteContainer) AddSprite(s *Sprite, subTex sprite.SubTex)
- func (spritecontainer *SpriteContainer) Initialize()
- func (spritecontainer *SpriteContainer) OnTouchBegin(x, y float32)
- func (spritecontainer *SpriteContainer) OnTouchEnd(x, y float32)
- func (spritecontainer *SpriteContainer) OnTouchMove(x, y float32)
- func (spritecontainer *SpriteContainer) RemoveSprite(remove *Sprite)
- func (spritecontainer *SpriteContainer) RemoveSprites()
- func (spritecontainer *SpriteContainer) ReplaceTexture(sprite *Sprite, subTex sprite.SubTex)
- type SpriteNodePair
- type TouchListener
- type TouchPeer
- func (touchpeer *TouchPeer) AddTouchListener(listener TouchListener)
- func (touchpeer *TouchPeer) OnTouchBegin(pxx, pxy float32)
- func (touchpeer *TouchPeer) OnTouchEnd(pxx, pxy float32)
- func (touchpeer *TouchPeer) OnTouchMove(pxx, pxy float32)
- func (touchpeer *TouchPeer) RemoveAllTouchListener()
- func (touchpeer *TouchPeer) RemoveTouchListener(listener TouchListener)
Constants ¶
const ( // FitHeight indicates screen should fit to height length FitHeight = iota // FitWidth indicates screen should fit to width length FitWidth )
Variables ¶
This section is empty.
Functions ¶
func GetScreenSize ¶
GetScreenSize returns screen size of device. This value is set by SetScreenSize in advance.
func LogDebug ¶
func LogDebug(format string, a ...interface{})
LogDebug prints logs. This is disabled at Release Build.
func LogError ¶
func LogError(format string, a ...interface{})
LogError prints logs. This is never disabled even for Release build.
func SetDesiredScreenSize ¶
func SetDesiredScreenSize(w, h float32)
SetDesiredScreenSize sets virtual screen size. Any positive value can be specified to arguments. like, w=1920, h=1080
func SetScreenSize ¶
SetScreenSize sets screen size of device. This will be called only from gomobile.go.
Types ¶
type GLPeer ¶
type GLPeer struct {
// contains filtered or unexported fields
}
GLPeer represents gl context. Singleton.
func GetGLPeer ¶
func GetGLPeer() *GLPeer
GetGLPeer returns a instance of GLPeer. Since GLPeer is singleton, it is necessary to call this function to get GLPeer instance.
func (*GLPeer) Finalize ¶
func (glpeer *GLPeer) Finalize()
Finalize finalizes GLPeer. This is called at termination of application.
func (*GLPeer) Initialize ¶
Initialize initializes GLPeer. This function must be called inadvance of using GLPeer
func (*GLPeer) LoadTexture ¶
LoadTexture return texture that is loaded by the information of arguments. Loaded texture can assign using AddSprite function.
func (*GLPeer) LoadTextureFromImage ¶
LoadTextureFromImage return texture that is loaded by the information of arguments. Loaded texture can assign using AddSprite function.
type Sprite ¶
type Sprite struct { // W = width of sprite W float32 // H = height of sprite H float32 // X = x position of sprite X float32 // Y = y position of sprite Y float32 // R = radius of sprite (use for rotation) R float32 // contains filtered or unexported fields }
Sprite represents a sprite.
func (*Sprite) AddTouchListener ¶
func (sprite *Sprite) AddTouchListener(listener TouchListener)
AddTouchListener registers a listener to notify touch event.
func (*Sprite) RemoveAllTouchListener ¶
func (sprite *Sprite) RemoveAllTouchListener()
RemoveAllTouchListener removes all registered listeners from sprite.
type SpriteContainer ¶
type SpriteContainer struct {
// contains filtered or unexported fields
}
SpriteContainer represents array of SpriteNodePair.
func GetSpriteContainer ¶
func GetSpriteContainer() *SpriteContainer
GetSpriteContainer returns SpriteContainer. Since SpriteContainer is singleton, use this function to get instance of SpriteContainer.
func (*SpriteContainer) AddSprite ¶
func (spritecontainer *SpriteContainer) AddSprite(s *Sprite, subTex sprite.SubTex)
AddSprite adds a sprite to SpriteContainer.
func (*SpriteContainer) Initialize ¶
func (spritecontainer *SpriteContainer) Initialize()
Initialize initializes SpriteContainer object. This must be called to use all SpriteContainer's function in advance.
func (*SpriteContainer) OnTouchBegin ¶
func (spritecontainer *SpriteContainer) OnTouchBegin(x, y float32)
OnTouchBegin is called when screen is started to touch. This function calls listener's OnTouchBegin if the touched position is contained by sprite's rectangle.
func (*SpriteContainer) OnTouchEnd ¶
func (spritecontainer *SpriteContainer) OnTouchEnd(x, y float32)
OnTouchEnd is called when touch is ended (released). This function calls listener's OnTouchEnd if the touched position is contained by sprite's rectangle.
func (*SpriteContainer) OnTouchMove ¶
func (spritecontainer *SpriteContainer) OnTouchMove(x, y float32)
OnTouchMove is called when touch is moved (dragged). This function calls listener's OnTouchMove if the touched position is contained by sprite's rectangle.
func (*SpriteContainer) RemoveSprite ¶
func (spritecontainer *SpriteContainer) RemoveSprite(remove *Sprite)
RemoveSprite removes a spcified sprite from SpriteContainer. Since Unregister of Node is not implemented by gomobile, this function just marks the specified sprite as "not in use". The sprite marked as "not in use" will be reused at AddSprite.
func (*SpriteContainer) RemoveSprites ¶
func (spritecontainer *SpriteContainer) RemoveSprites()
RemoveSprites removes all registered sprites from SpriteContainer.
func (*SpriteContainer) ReplaceTexture ¶
func (spritecontainer *SpriteContainer) ReplaceTexture(sprite *Sprite, subTex sprite.SubTex)
ReplaceTexture replaces sprite's texture to specified one.
type SpriteNodePair ¶
type SpriteNodePair struct {
// contains filtered or unexported fields
}
SpriteNodePair represents pair of Sprite and sprite.Node. This is used for calculate affine transformation of Node from Sprite's property.
type TouchListener ¶
type TouchListener interface { OnTouchBegin(x, y float32) OnTouchMove(x, y float32) OnTouchEnd(x, y float32) }
TouchListener is interface to be notifed touch event.
type TouchPeer ¶
type TouchPeer struct {
// contains filtered or unexported fields
}
TouchPeer represents a Touch object. Singleton.
func GetTouchPeer ¶
func GetTouchPeer() *TouchPeer
GetTouchPeer returns instance of TouchPeer. Since TouchPeer is singleton, it is necessary to call this function to get instance of TouchPeer.
func (*TouchPeer) AddTouchListener ¶
func (touchpeer *TouchPeer) AddTouchListener(listener TouchListener)
AddTouchListener registeres a listener to notify touch event.
func (*TouchPeer) OnTouchBegin ¶
OnTouchBegin is called when touch is started. This event is notified to all registered listeners despite of the touched position.
func (*TouchPeer) OnTouchEnd ¶
OnTouchEnd is called when touch is ended (released). This event is notified to all registered listeners despite of the touched position.
func (*TouchPeer) OnTouchMove ¶
OnTouchMove is called when touch is moved (dragged). This event is notified to all registered listeners despite of the touched position.
func (*TouchPeer) RemoveAllTouchListener ¶
func (touchpeer *TouchPeer) RemoveAllTouchListener()
RemoveAllTouchListener removes all registered listeners.
func (*TouchPeer) RemoveTouchListener ¶
func (touchpeer *TouchPeer) RemoveTouchListener(listener TouchListener)
RemoveTouchListener removes specified listener.