spike

package module
v0.0.0-...-e7bc4dc Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2015 License: MIT Imports: 23 Imported by: 0

README

Spike

Multi Platform (android, iOS, desktop) Game Engine in golang See this http://godoc.org/github.com/pyros2097/spike for more information

Documentation

Overview

Copyright 2015 pyros2097. All rights reserved.
Use of this source code is governed by the MIT
license that can be found in the LICENSE file.

Spike Game Framework is a built on top of golang mobile with all the batteries included. It is a lot similar to libgdx but has lesser abstractions and easier integration and setup. It favors composition over inheritance and also has a declarative interface. It has all configuration for assets, sound, music, textures, animations already setup. You can directly start coding your game without initializing complicated things. It follows the Rails design of convention over configuration. It consists of Scenes and you can control which scenes are to displayed when. Be sure to see the examples source code as it can help you a lot in understanding the framework.

Requires

1.Go >= 1.5
2.OpenGL >= 2.0
3.OpenAL >= 1.1
4.Linux

Assets

Note: All asset files must be lowercase only.. otherwise it causes problems with android. All Assets are to be stored in the assets directory. For Automatic Asset Loading the directory Structure should be like this

assets/icons/icon.png - your game icon which is loaded by the framework
assets/atlas/ --- all your Texture Atlas files .atlas and .png go here
assets/fonts/ --- all your BitmapFont files .fnt and .png go here
assets/musics/ --- all your Music files .mp3 go here
assets/sounds/ --- all your Music files .mp3 go here
assets/particles/ --- all your Particle files .part go here
assets/maps/ --- all your TMX map files .tmx go here

Usage

menu := &spike.Scene{
  Name:    "Menu",
  BGColor: graphics.Color{0, 0, 1, 1},
  Children: []*spike.Actor{
    {
      X: 43,
      OnInput: func(self *spike.Actor, event spike.InputEvent) {
        println(event.Type.String())
      },
      OnAct: func(self *spike.Actor, delta float32) {
        self.X = 111
      },
    },
  },
}
options := &spike.Scene{Name: "Options", BGColor: graphics.Color{0, 0, 0, 1}}
spike.Init("Example", 800, 480)
spike.AddScene(menu)
spike.AddScene(options)
spike.PlaySound("boing")
spike.Run()

Index

Constants

View Source
const (
	MUSIC            = "music"
	SOUND            = "sound"
	VOLUME_MUSIC     = "volumeMusic"
	VOLUME_SOUND     = "volumeSOUND"
	VIBRATION        = "vibration"
	BATTLE_ANIMATION = "battleanimation"
	SEMI_AUTOMATIC   = "semiautomatic"
	FIRST_LAUNCH     = "firstLaunch"
	LEVELS           = "levels"
	CURRENT_LEVEL    = "currentlevel"
	SAVEDATA         = "savedata"
	TOTAL_TIME       = "totaltime"
	PANSPEED         = "panspeed"
	DRAGSPEED        = "dragspeed"
	KEYBOARD         = "keyboard"
	SCORE            = "score"
)

Variables

View Source
var (
	CLEAR = NewColor(0, 0, 0, 0)
	BLACK = NewColor(0, 0, 0, 1)

	WHITE      = NewColorHex(0xffffffff)
	LIGHT_GRAY = NewColorHex(0xbfbfbfff)
	GRAY       = NewColorHex(0x7f7f7fff)
	DARK_GRAY  = NewColorHex(0x3f3f3fff)
	SLATE      = NewColorHex(0x708090ff)

	BLUE  = NewColor(0, 0, 1, 1)
	NAVY  = NewColor(0, 0, 0.5, 1)
	ROYAL = NewColorHex(0x4169e1ff)
	SKY   = NewColorHex(0x87ceebff)
	CYAN  = NewColor(0, 1, 1, 1)
	TEAL  = NewColor(0, 0.5, 0.5, 1)

	GREEN      = NewColorHex(0x00ff00ff)
	CHARTREUSE = NewColorHex(0x7fff00ff)
	LIME       = NewColorHex(0x32cd32ff)
	FOREST     = NewColorHex(0x228b22ff)
	OLIVE      = NewColorHex(0x6b8e23ff)

	YELLOW    = NewColorHex(0xffff00ff)
	GOLD      = NewColorHex(0xffd700ff)
	GOLDENROD = NewColorHex(0xdaa520ff)

	BROWN     = NewColorHex(0x8b4513ff)
	TAN       = NewColorHex(0xd2b48cff)
	FIREBRICK = NewColorHex(0xb22222ff)

	RED     = NewColorHex(0xff0000ff)
	CORAL   = NewColorHex(0xff7f50ff)
	ORANGE  = NewColorHex(0xffa500ff)
	SALMON  = NewColorHex(0xfa8072ff)
	PINK    = NewColorHex(0xff69b4ff)
	MAGENTA = NewColor(1, 0, 1, 1)

	PURPLE = NewColorHex(0xa020f0ff)
	VIOLET = NewColorHex(0xee82eeff)
	MAROON = NewColorHex(0xb03060ff)
)

* A color class, holding the r, g, b and alpha component as floats in the range [0,1]. All methods perform clamping on the

  • internal values after execution.
View Source
var (
	HasMusic     bool
	HasSound     bool
	UseKeyboard  bool
	HasVibration bool
	VolMusic     float32
	VolSound     float32
	SpeedPan     float32
	SpeedDrag    float32
	Score        int
)
View Source
var (
	TapSquareSize float32 = 20

	LongPressSeconds float32 = 1.1
	MaxFlingDelay    int64   = 0 //0.15

	InputChannel = make(chan InputEvent, 100)
)
View Source
var Camera2d = &Camera{
	Position:          NewVector3Empty(),
	Direction:         NewVector3(0, 0, -1),
	Up:                NewVector3(0, 1, 0),
	Projection:        NewMatrix4Empty(),
	View:              NewMatrix4Empty(),
	Combined:          NewMatrix4Empty(),
	InvProjectionView: NewMatrix4Empty(),
	Near:              0,
	Far:               100,
	ViewportWidth:     800,
	ViewportHeight:    480,
	tmpVec:            NewVector3Empty(),
	tmp:               NewVector3Empty(),
	Ray:               NewRay(NewVector3Empty(), NewVector3Empty()),
	Zoom:              1,
	FieldOfView:       67,
	frustum:           NewFrustumEmpty(),
	UpdateFrustum: func(self *Camera, updateFrustum bool) {
		self.Projection.SetToOrtho2DNear(self.Zoom*-self.ViewportWidth/2, self.Zoom*(self.ViewportWidth/2), self.Zoom*-(self.ViewportHeight/2),
			self.Zoom*self.ViewportHeight/2, self.Near, self.Far)
		self.View.SetToLookAtPos(self.Position, self.tmp.SetV(self.Position).AddV(self.Direction), self.Up)
		self.Combined.SetM4(self.Projection)

		if updateFrustum {
			self.InvProjectionView.SetM4(self.Combined)

			self.frustum.Update(self.InvProjectionView)
		}
	},
}

An OrthographicCamera, using the given viewport width and height. For pixel perfect 2D rendering just supply the screen size, for other unit scales (e.g. meters for box2d) proceed accordingly. The camera will show the region [-viewportWidth/2, -(viewportHeight/2-1)] - [(viewportWidth/2-1), viewportHeight/2]

View Source
var Camera3d = &Camera{
	Position:          NewVector3Empty(),
	Direction:         NewVector3(0, 0, -1),
	Up:                NewVector3(0, 1, 0),
	Projection:        NewMatrix4Empty(),
	View:              NewMatrix4Empty(),
	Combined:          NewMatrix4Empty(),
	InvProjectionView: NewMatrix4Empty(),
	Near:              1,
	Far:               100,
	ViewportWidth:     800,
	ViewportHeight:    480,
	tmpVec:            NewVector3Empty(),
	tmp:               NewVector3Empty(),
	Ray:               NewRay(NewVector3Empty(), NewVector3Empty()),
	Zoom:              1,
	FieldOfView:       67,
	frustum:           NewFrustumEmpty(),
	UpdateFrustum: func(self *Camera, updateFrustum bool) {
		aspect := self.ViewportWidth / self.ViewportHeight
		self.Projection.SetToProjectionNear(float32(math.Abs(float64(self.Near))), float32(math.Abs(float64(self.Far))),
			self.FieldOfView, aspect)
		self.View.SetToLookAtPos(self.Position, self.tmp.SetV(self.Position).AddV(self.Direction), self.Up)
		self.Combined.SetM4(self.Projection)

		if updateFrustum {
			self.InvProjectionView.SetM4(self.Combined)

			self.frustum.Update(self.InvProjectionView)
		}
	},
}

A PerspectiveCamera with the given field of view and viewport size. The aspect ratio is derived from the viewport size. @param fieldOfViewY the field of view of the height, in degrees, the field of view for the width will be calculated

according to the aspect ratio.

@param viewportWidth the viewport width @param viewportHeight the viewport height

View Source
var (
	LastTime int64
)
View Source
var (
	PauseState bool
)

Functions

func ARGB8888

func ARGB8888(a, r, g, b float32) uint32

func ARGB8888Color

func ARGB8888Color(color *Color) uint32

func ARGB8888ToColor

func ARGB8888ToColor(color *Color, value uint32)

* Sets the Color components using the specified integer value in the format ARGB8888. This is the inverse to the aRGB8888(a,

  • r, g, b) method *
  • @param color The Color to be modified.
  • @param value An integer color value in ARGB8888 format.

func AddScene

func AddScene(scene *Scene)

func Alpha

func Alpha(alpha float32) uint32

func Cancel

func Cancel()

No further gesture events will be triggered for the current touch, if any.

func EnableKeyboard

func EnableKeyboard(enable bool)

func EnableMusic

func EnableMusic(enable bool)

func EnableSound

func EnableSound(enable bool)

func Font

func Font()

func GetColors

func GetColors() map[string]*Color

Returns the color map.

func GetTouchX

func GetTouchX() float32

func GetTouchY

func GetTouchY() float32

func Init

func Init(title string, width, height float32)

Important:

  • The Target Width and Target Height refer to the nominal width and height of the game for the
  • graphics which are created for this width and height, this allows for the Stage to scale this
  • graphics for all screen width and height. Therefore your game will work on all screen sizes
  • but maybe blurred or look awkward on some devices.
  • ex:
  • My Game targetWidth = 800 targetHeight = 480
  • Then my game works perfectly for SCREEN_WIDTH = 800 SCREEN_HEIGHT = 480
  • and on others screen sizes it is just zoomed/scaled but works fine thats all

func InitAssets

func InitAssets(config *AssetConfig)

func InvalidateTapSquare

func InvalidateTapSquare()

The tap square will not longer be used for the current touch

func IsLongPressed

func IsLongPressed() bool

return whether the user touched the screen long enough to trigger a long press event.

func IsPanning

func IsPanning() bool

func LoadSaveData

func LoadSaveData() string

func LoadTmx

func LoadTmx()

func LuminanceAlpha

func LuminanceAlpha(luminance, alpha float32) uint32

func PlayMusic

func PlayMusic()

func PlaySound

func PlaySound(name string)

func PutColor

func PutColor(name string, color *Color)

* Convenience method to add a {@code color} with its {@code name}. The invocation of this method is equivalent to the

  • expression {@code Colors.getColors().put(name, color)} *
  • @param name the name of the color
  • @param color the color
  • @return the previous {@code color} associated with {@code name}, or {@code null} if there was no mapping for {@code name}.

func RGB565

func RGB565(r, g, b float32) uint32

func RGB565Color

func RGB565Color(color *Color) uint32

func RGB565ToColor

func RGB565ToColor(color *Color, value uint32)

* Sets the Color components using the specified integer value in the format RGB565. This is inverse to the RGB565(r, g, b)

  • method. *
  • @param color The Color to be modified.
  • @param value An integer color value in RGB565 format.

func RGB888

func RGB888(r, g, b float32) uint32

func RGB888Colot

func RGB888Colot(color *Color) uint32

func RGB888ToColor

func RGB888ToColor(color *Color, value uint32)

* Sets the Color components using the specified integer value in the format RGB888. This is inverse to the RGB888(r, g, b)

  • method. *
  • @param color The Color to be modified.
  • @param value An integer color value in RGB888 format.

func RGBA4444

func RGBA4444(r, g, b, a float32) uint32

func RGBA4444Color

func RGBA4444Color(color *Color) uint32

func RGBA4444ToColor

func RGBA4444ToColor(color *Color, value uint32)

* Sets the Color components using the specified integer value in the format RGBA4444. This is inverse to the RGBa4444(r, g, b,

  • a) method. *
  • @param color The Color to be modified.
  • @param value An integer color value in RGBA4444 format.

func RGBA8888

func RGBA8888(r, g, b, a float32) uint32

func RGBA8888Color

func RGBA8888Color(color *Color) uint32

func RGBA8888ToColor

func RGBA8888ToColor(color *Color, value uint32)

* Sets the Color components using the specified integer value in the format RGBA8888. This is inverse to the RGBa8888(r, g, b,

  • a) method. *
  • @param color The Color to be modified.
  • @param value An integer color value in RGBA8888 format.

func ReadTotalTime

func ReadTotalTime() float32

func RemoveScene

func RemoveScene(name string)

func Reset

func Reset()

func ResetColor

func ResetColor()

Resets the color map to the predefined colors.

func Run

func Run()

It sets up a window and rendering surface and manages the different aspects of your application, namely {@link Graphics}, {@link Audio}, {@link Input} and {@link Files}. This is the main entry point of your project. Note that all Music instances will be automatically paused when the current scene's OnPause() method is called, and automatically resumed when the OnResume() method is called.

func SetMusicVolume

func SetMusicVolume(volume float32)

func SetScene

func SetScene(name string)

Sets the current scene to be displayed

func SetSceneWithDelay

func SetSceneWithDelay(name string, duration time.Duration)

Set the current scene to be displayed with an amount of delay

func SetSoundVolume

func SetSoundVolume(volume float32)

func SetTapCountInterval

func SetTapCountInterval(tapCountInterval float32)

tapCountInterval time in seconds that must pass for two touch down/up sequences to be detected as consecutive taps

func StopMusic

func StopMusic()

func StopSound

func StopSound(name string)

func Tex

func Tex()

func ToFloatBits

func ToFloatBits(r, g, b, a int) float32

* Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float. Note that no range

  • checking is performed for higher performance.
  • @param r the red component, 0 - 255
  • @param g the green component, 0 - 255
  • @param b the blue component, 0 - 255
  • @param a the alpha component, 0 - 255
  • @return the packed color as a float
  • @see NumberUtils#intToFloatColoruint32

func ToFloatBitsF

func ToFloatBitsF(r, g, b, a float32) float32

* Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float.

  • @return the packed color as a 32-bit float
  • @see NumberUtils#intToFloatColoruint32

func ToIntBits

func ToIntBits(r, g, b, a uint32) uint32

* Packs the color components into a 32-bit integer with the format ABGR. Note that no range checking is performed for higher

  • performance.
  • @param r the red component, 0 - 255
  • @param g the green component, 0 - 255
  • @param b the blue component, 0 - 255
  • @param a the alpha component, 0 - 255
  • @return the packed color as a 32-bit int

func UnloadAll

func UnloadAll()

func UnloadTmx

func UnloadTmx()

func ValueOf

func ValueOf(hex string)

TODO: Must be static * Returns a new color from a hex string with the format RRGGBBAA.

  • @see #toString()

func WriteSaveData

func WriteSaveData(data string)

func WriteTotalTime

func WriteTotalTime(secondstime float32)

Types

type Action

type Action struct {
	// The actor this action is attached to, or nil if it is not attached.
	Actor *Actor

	// The actor this action targets, or nil if a target has not been set.
	// Sets the actor this action will manipulate. If no target actor is set, {@link #setActor(Actor)} will set the target actor
	// when the action is added to an actor.
	Target *Actor

	// Updates the action based on time. Typically this is called each frame by {@link Actor#act(float)}.
	// delta Time in seconds since the last frame.
	// returns true if the action is done. This method may continue to be called after the action is done.
	Act func(a *Action, delta float32) bool

	// Sets the state of the action so it can be run again.
	Restart func(a *Action)

	// Resets the optional state of this action to as if it were newly created, allowing the action to be pooled and reused. State
	// required to be set for every usage of this action or computed during the action does not need to be reset.
	// The default implementation calls {@link #restart()}.
	// If a subclass has optional state, it must override this method, call super, and reset the optional state. */
	Reset func(a *Action)
}

Action is used to modify the actor's parameters over time

func NewAction

func NewAction() *Action

NewAction creates a new empty action

type Actor

type Actor struct {
	Name     string  // Name of the Actor
	X, Y     float32 // X, Y position of the actor's left edge.
	W, H     float32 // Width and Height
	Z        uint32  // zindex
	OX, OY   float32 // origin
	SX, SY   float32 // scale
	Rotation float32

	// If false, the actor will not be drawn and will not receive touch events. Default is true.
	Visible bool

	Debug bool

	Actions []*Action

	// Called by the framework when an actor is added to or removed from a group.
	// param parent May be null if the actor has been removed from the parent.
	Parent *Actor

	// Determines how touch events are distributed to a actor. Default is {@link Touchable#enabled}.
	TouchState Touchable

	// An application specific object for convenience.
	UserObject interface{}

	// The color the actor will be tinted when drawn.
	Color *Color // make this 1 1 1 1

	Init func(a *Actor)

	// Called on the update cycle
	Act func(a *Actor, delta float32)

	// Draws the actor. The batch is configured to draw in the parent's coordinate system.
	// {@link Batch#draw(com.badlogic.gdx.graphics.g2d.TextureRegion, float, float, float, float, float, float, float, float, float)
	// This draw method} is convenient to draw a rotated and scaled TextureRegion. {@link Batch#begin()} has already been called on
	// the batch. If {@link Batch#end()} is called to draw without the batch then {@link Batch#begin()} must be called before the
	// method returns.
	// <p>
	// The default implementation does nothing.
	// param parentAlpha Should be multiplied with the actor's alpha, allowing a parent's alpha to affect all children.
	Draw func(a *Actor, batch g2d.Batch, parentAlpha float32)

	// Called when an input event occurrs
	Input func(a *Actor, event InputEvent)

	Children []*Actor
	// contains filtered or unexported fields
}

Actor is a 2D scene graph node that may contain other actors. Actors have a z-order equal to the order they were inserted. Actors inserted later will be drawn on top of actors added earlier. Touch events that hit more than one actor are distributed to topmost actors first. An actor has a position, rectangular size, origin, scale, rotation, Z index, and color. The position corresponds to the unrotated, unscaled bottom left corner of the actor. The position is relative to the actor's parent. The origin is relative to the position and is used for scale and rotation.

An actor has a list of in progress {@link Action actions} that are applied to the actor (often over time). These are generally used to change the presentation of the actor (moving it, resizing it, etc).

An actor has two kinds of listeners associated with it: "capture" and regular. The listeners are notified of events the actor or its children receive. The regular listeners are designed to allow an actor to respond to events that have been delivered. The capture listeners are designed to allow a parent or container actor to handle events before child actors. See {@link #fire} for more details.

func (*Actor) ActionAlpha

func (a *Actor) ActionAlpha(alphaValue, duration float32, interp Interpolation) *Actor

ActionAlpha sets the alpha for an actor's color (or a specified color), from the current alpha to the new alpha. Note this action transitions from the alpha at the time the action starts to the specified alpha. Transitions from the alpha at the time this action starts to the specified alpha.

func (*Actor) ActionColor

func (a *Actor) ActionColor(end *Color, duration float32, interp Interpolation) *Actor

ActionColor sets the actor's color (or a specified color), from the current to the new color. Note this action transitions from the color at the time the action starts to the specified color.

func (*Actor) ActionMoveBy

func (a *Actor) ActionMoveBy(amountX, amountY, duration float32, interp Interpolation) *Actor

ActionMoveBy moves an actor to a relative position.

func (*Actor) ActionMoveTo

func (a *Actor) ActionMoveTo(endX, endY, duration float32, interp Interpolation) *Actor

ActionMoveTo moves an actor from its current position to a specific position.

func (*Actor) ActionMoveToAligned

func (a *Actor) ActionMoveToAligned(endX, endY float32, alignment utils.Alignment, duration float32, interp Interpolation) *Actor

ActionMoveToAligned moves an actor from its current position to a specific position with a alignment.

func (*Actor) ActionRotateBy

func (a *Actor) ActionRotateBy(amount, duration float32, interp Interpolation) *Actor

ActionRotateBy Sets the actor's rotation from its current value to a relative value.

func (*Actor) ActionRotateTo

func (a *Actor) ActionRotateTo(end, duration float32, interp Interpolation) *Actor

ActionRotateTo sets the actor's rotation from its current value to a specific value.

func (*Actor) ActionScaleBy

func (a *Actor) ActionScaleBy(amountX, amountY, duration float32, interp Interpolation) *Actor

ActionScaleBy scales an actor's scale to a relative size.

func (*Actor) ActionScaleTo

func (a *Actor) ActionScaleTo(endX, endY, duration float32, interp Interpolation) *Actor

ActionScaleTo sets the actor's scale from its current value to a specific value.

func (*Actor) ActionSizeBy

func (a *Actor) ActionSizeBy(amountW, amountH, duration float32, interp Interpolation) *Actor

ActionSizeBy moves an actor from its current size to a relative size.

func (*Actor) ActionSizeTo

func (a *Actor) ActionSizeTo(endW, endH, duration float32, interp Interpolation) *Actor

ActionSizeTo moves an actor from its current size to a specific size.

func (*Actor) ActionTouchable

func (a *Actor) ActionTouchable(touchable Touchable) *Actor

Sets the actor's Actor#setTouchable(Touchable) touchability.

func (*Actor) ActionVisible

func (a *Actor) ActionVisible(visible bool) *Actor

func (*Actor) AddAction

func (a *Actor) AddAction(action *Action)

func (*Actor) AddActor

func (a *Actor) AddActor(actor *Actor)

Adds an actor as a child of this group. The actor is first removed from its parent group, if any.

func (*Actor) AddActorAt

func (a *Actor) AddActorAt(index int, actor *Actor)

Adds an actor as a child of this group, at a specific index. The actor is first removed from its parent group, if any. @param index May be greater than the number of children.

func (*Actor) ChildrenChanged

func (a *Actor) ChildrenChanged()

Called when actors are added to or removed from the group.

func (*Actor) Clear

func (a *Actor) Clear()

Removes all children, actions, and listeners from this group.

func (*Actor) ClearActions

func (a *Actor) ClearActions()

Removes all actions on a actor.

func (*Actor) ClearChildren

func (a *Actor) ClearChildren()

Removes all actors from this group.

func (*Actor) Collides

func (a *Actor) Collides(other *Actor) bool

func (*Actor) CollidesXY

func (a *Actor) CollidesXY(x, y float32) bool

func (*Actor) Delay

func (a *Actor) Delay(duration float32) *Actor

func (*Actor) EffectFadeIn

func (a *Actor) EffectFadeIn(duration float32, interp Interpolation) *Actor

EffectFadeIn transitions from the alpha at the time this action starts to an alpha of 1.

func (*Actor) EffectFadeOut

func (a *Actor) EffectFadeOut(duration float32, interp Interpolation) *Actor

EffectFadeOut transitions from the alpha at the time this action starts to an alpha of 0.

func (*Actor) EffectScaleAndShake

func (a *Actor) EffectScaleAndShake(scaleRatioX, scaleRatioY, shakeAngle, duration float32) *Actor

EffectScaleAndShake sets the actors scale to 0 and

func (*Actor) EffectScaleAndShakeFadeOut

func (a *Actor) EffectScaleAndShakeFadeOut(scaleRatioX, scaleRatioY, fadeBeforeDuration, duration float32) *Actor

EffectScaleAndShakeFadeOut Scale effect, Back To Normal, Fade Out (SC, BTN, FO)

func (*Actor) EffectScaleIn

func (a *Actor) EffectScaleIn(duration float32, interp Interpolation) *Actor

EffectScaleIn sets the actors scale to 0 and

func (*Actor) EffectScaleOut

func (a *Actor) EffectScaleOut(duration float32, interp Interpolation) *Actor

EffectScaleOut sets the actors scale to 0 and

func (*Actor) EffectShakeInOut

func (a *Actor) EffectShakeInOut(value, duration float32, interp Interpolation) *Actor

EffectShakeInOut sets the actors scale to 0 and

func (*Actor) Forever

func (a *Actor) Forever(callback func())

Forever Executes an action always unless removed

func (*Actor) GetBounds

func (a *Actor) GetBounds() *shape.Rectangle

func (*Actor) GetRight

func (a *Actor) GetRight() float32

Returns x plus width.

func (*Actor) GetRotation

func (a *Actor) GetRotation() float32

func (*Actor) GetTop

func (a *Actor) GetTop() float32

Returns y plus height.

func (*Actor) GetXAlign

func (a *Actor) GetXAlign(alignment utils.Alignment) float32

Returns the X position of the specified {@link Align alignment}

func (*Actor) GetYAlign

func (a *Actor) GetYAlign(alignment utils.Alignment) float32

Returns the Y position of the specified {@link Align alignment}

func (*Actor) GetZIndex

func (a *Actor) GetZIndex() int32

Returns the z-index of a actor.

func (*Actor) HasActions

func (a *Actor) HasActions() bool

Returns true if the actor has one or more

func (*Actor) IsTouchable

func (a *Actor) IsTouchable() bool

Returns true if input events are processed by a actor.

func (*Actor) MoveBy

func (a *Actor) MoveBy(x, y float32)

Add x and y to current position.

func (*Actor) Parallel

func (a *Actor) Parallel(actions ...*Action) *Actor

Parallel Executes a number of actions at the same time.

func (*Actor) RemoveAction

func (a *Actor) RemoveAction(action *Action)

func (*Actor) RemoveActor

func (a *Actor) RemoveActor(actor *Actor) bool

Removes an actor from this group. If the actor will not be used again and has actions, they should be {@link Actor#clearActions() cleared} so the actions will be returned to their {@link Action#setPool(com.badlogic.gdx.utils.Pool) pool}, if any. This is not done automatically. returns true if the actor was removed from this group.

func (*Actor) Repeat

func (a *Actor) Repeat(n int, callback func())

Repeat an action n number of times.

func (*Actor) RotateBy

func (a *Actor) RotateBy(amountInDegrees float32)

Adds the specified rotation to the current rotation.

func (*Actor) Run

func (a *Actor) Run(callback func()) *Actor

func (*Actor) ScaleBy

func (a *Actor) ScaleBy(scaleX, scaleY float32)

Adds the specified scale to the current scale.

func (*Actor) Sequence

func (a *Actor) Sequence(actions ...*Action) *Actor

Sequence executes a number of actions one at a time.

func (*Actor) SetBounds

func (a *Actor) SetBounds(x, y, w, h float32)

Set bounds the x, y, width, and height.

func (*Actor) SetHeight

func (a *Actor) SetHeight(height float32)

func (*Actor) SetOriginAlign

func (a *Actor) SetOriginAlign(alignment utils.Alignment)

Sets the origin position to the specified {@link Align alignment}.

func (*Actor) SetPosition

func (a *Actor) SetPosition(x, y float32)

Sets the position of the actor's bottom left corner.

func (*Actor) SetPositionAlign

func (a *Actor) SetPositionAlign(x, y float32, alignment utils.Alignment)

Sets the position using the specified alignment. Note this may set the position to non-integer coordinates.

func (*Actor) SetRotation

func (a *Actor) SetRotation(degrees float32)

func (*Actor) SetScale

func (a *Actor) SetScale(scaleX, scaleY float32)

Sets the scale X and scale Y.

func (*Actor) SetSize

func (a *Actor) SetSize(w, h float32)

Sets the width and height.

func (*Actor) SetWidth

func (a *Actor) SetWidth(width float32)

func (*Actor) SetX

func (a *Actor) SetX(x float32)

func (*Actor) SetY

func (a *Actor) SetY(y float32)

func (*Actor) SetZIndex

func (a *Actor) SetZIndex(index uint32)

Sets the z-index of a actor. The z-index is the index into the parent's {@link Group#getChildren() children}, where a lower index is below a higher index. Setting a z-index higher than the number of children will move the child to the front. Setting a z-index less than zero is invalid.

func (*Actor) SizeBy

func (a *Actor) SizeBy(w, h float32)

Adds the specified size to the current size.

func (*Actor) String

func (a *Actor) String() string

func (*Actor) ToBack

func (a *Actor) ToBack()

Changes the z-order for a actor so it is in back of all siblings.

func (*Actor) ToFront

func (a *Actor) ToFront()

Changes the z-order for a actor so it is in front of all siblings.

type AssetConfig

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

type Button

type Button uint8

The type of Mouse buttons

const (
	ButtonLeft Button = iota
	ButtonRight
	ButtonMiddle
	ButtonBack
	ButtonForward
)

type Camera

type Camera struct {
	// the position of the camera
	Position *Vector3
	// the unit length direction vector of the camera
	Direction *Vector3
	// the unit length up vector of the camera
	Up *Vector3

	// the projection matrix
	Projection *Matrix4
	// the view matrix
	View *Matrix4
	// the combined projection and view matrix
	Combined *Matrix4
	// the inverse combined projection and view matrix
	InvProjectionView *Matrix4

	// the near clipping plane distance, has to be positive
	Near float32
	// the far clipping plane distance, has to be positive
	Far float32

	// the viewport width
	ViewportWidth float32
	// the viewport height
	ViewportHeight float32

	Ray *Ray

	// the field of view of the height, in degrees for Perspective
	FieldOfView float32
	// the zoom of the camera for Orthographic
	Zoom float32

	// Recalculates the projection and view matrix of this camera and the {@link Frustum} planes if <code>updateFrustum</code> is
	// true. Use this after you've manipulated any of the attributes of the camera.
	UpdateFrustum func(self *Camera, updateFrustum bool)
	// contains filtered or unexported fields
}

Base class for OrthographicCamera and PerspectiveCamera

func (*Camera) GetPickRay

func (self *Camera) GetPickRay(screenX, screenY, viewportX, viewportY, viewportWidth, viewportHeight float32) *Ray

Creates a picking {@link Ray} from the coordinates given in screen coordinates. It is assumed that the viewport spans the whole screen. The screen coordinates origin is assumed to be in the top left corner, its y-axis pointing down, the x-axis pointing to the right. The returned instance is not a new instance but an internal member only accessible via this function. param viewportX the coordinate of the bottom left corner of the viewport in glViewport coordinates. param viewportY the coordinate of the bottom left corner of the viewport in glViewport coordinates. param viewportWidth the width of the viewport in pixels param viewportHeight the height of the viewport in pixels return the picking Ray.

func (*Camera) GetPickRayXY

func (self *Camera) GetPickRayXY(screenX, screenY float32) *Ray

Creates a picking {@link Ray} from the coordinates given in screen coordinates. It is assumed that the viewport spans the whole screen. The screen coordinates origin is assumed to be in the top left corner, its y-axis pointing down, the x-axis pointing to the right. The returned instance is not a new instance but an internal member only accessible via this function. return the picking Ray.

func (*Camera) LookAt

func (self *Camera) LookAt(x, y, z float32)

Recalculates the direction of the camera to look at the point (x, y, z). This function assumes the up vector is normalized. param x the x-coordinate of the point to look at param y the x-coordinate of the point to look at param z the x-coordinate of the point to look at

func (*Camera) LookAtV3

func (self *Camera) LookAtV3(target *Vector3)

Recalculates the direction of the camera to look at the point (x, y, z). @param target the point to look at

func (*Camera) NormalizeUp

func (self *Camera) NormalizeUp()

Normalizes the up vector by first calculating the right vector via a cross product between direction and up, and then recalculating the up vector via a cross product between right and direction.

func (*Camera) Project

func (self *Camera) Project(worldCoords *Vector3, viewportX, viewportY, viewportWidth, viewportHeight float32) *Vector3

Projects the {@link Vector3} given in world space to screen coordinates. It's the same as GLU gluProject with one small deviation: The viewport is assumed to span the whole screen. The screen coordinate system has its origin in the <b>bottom</b> left, with the y-axis pointing <b>upwards</b> and the x-axis pointing to the right. This makes it easily useable in conjunction with {@link Batch} and similar classes. This method allows you to specify the viewport position and dimensions in the coordinate system expected by {@link GL20#glViewport(int, int, int, int)}, with the origin in the bottom left corner of the screen. param viewportX the coordinate of the bottom left corner of the viewport in glViewport coordinates. param viewportY the coordinate of the bottom left corner of the viewport in glViewport coordinates. param viewportWidth the width of the viewport in pixels param viewportHeight the height of the viewport in pixels

func (*Camera) ProjectV3

func (self *Camera) ProjectV3(worldCoords *Vector3) *Vector3

Projects the {@link Vector3} given in world space to screen coordinates. It's the same as GLU gluProject with one small deviation: The viewport is assumed to span the whole screen. The screen coordinate system has its origin in the <b>bottom</b> left, with the y-axis pointing <b>upwards</b> and the x-axis pointing to the right. This makes it easily useable in conjunction with {@link Batch} and similar classes.

func (*Camera) Rotate

func (self *Camera) Rotate(angle, axisX, axisY, axisZ float32)

Rotates the direction and up vector of this camera by the given angle around the given axis. The direction and up vector will not be orthogonalized. param angle the angle param axisX the x-component of the axis param axisY the y-component of the axis param axisZ the z-component of the axis

func (*Camera) RotateAngle

func (self *Camera) RotateAngle(angle float32)

func (*Camera) RotateAround

func (self *Camera) RotateAround(point, axis *Vector3, angle float32)

Rotates the direction and up vector of this camera by the given angle around the given axis, with the axis attached to given point. The direction and up vector will not be orthogonalized. param point the point to attach the axis to param axis the axis to rotate around param angle the angle

func (*Camera) RotateM4

func (self *Camera) RotateM4(transform *Matrix4)

Rotates the direction and up vector of this camera by the given rotation matrix. The direction and up vector will not be orthogonalized. param transform The rotation matrix

func (*Camera) RotateQ

func (self *Camera) RotateQ(quat *Quaternion)

Rotates the direction and up vector of this camera by the given {@link Quaternion}. The direction and up vector will not be orthogonalized. param quat The quaternion

func (*Camera) RotateV3

func (self *Camera) RotateV3(axis *Vector3, angle float32)

Rotates the direction and up vector of this camera by the given angle around the given axis. The direction and up vector will not be orthogonalized. param axis the axis to rotate around param angle the angle

func (*Camera) SetToOrtho

func (self *Camera) SetToOrtho(yDown bool)

Orthographic Rotates the camera by the given angle around the direction vector. The direction and up vector will not be orthogonalized. param angle Sets this camera to an orthographic projection using a viewport fitting the screen resolution, centered at (Gdx.graphics.getWidth()/2, Gdx.graphics.getHeight()/2), with the y-axis pointing up or down. param yDown whether y should be pointing down

func (*Camera) SetToOrthoVW

func (self *Camera) SetToOrthoVW(yDown bool, viewportWidth, viewportHeight float32)

Sets this camera to an orthographic projection, centered at (viewportWidth/2, viewportHeight/2), with the y-axis pointing up or down. param yDown whether y should be pointing down. param viewportWidth param viewportHeight

func (*Camera) Transform

func (self *Camera) Transform(transform *Matrix4)

Transform the position, direction and up vector by the given matrix param transform The transform matrix

func (*Camera) Translate

func (self *Camera) Translate(x, y, z float32)

Moves the camera by the given amount on each axis. param x the displacement on the x-axis param y the displacement on the y-axis param z the displacement on the z-axis

func (*Camera) TranslateV2

func (self *Camera) TranslateV2(vec *Vector2)

Moves the camera by the given vector. param vec the displacement vector

func (*Camera) TranslateV3

func (self *Camera) TranslateV3(vec *Vector3)

Moves the camera by the given vector. param vec the displacement vector

func (*Camera) TranslateXY

func (self *Camera) TranslateXY(x, y float32)

Moves the camera by the given amount on each axis. param x the displacement on the x-axis param y the displacement on the y-axis

func (*Camera) Unproject

func (self *Camera) Unproject(screenCoords *Vector3, viewportX, viewportY, viewportWidth, viewportHeight float32) *Vector3

Function to translate a point given in screen coordinates to world space. It's the same as GLU gluUnProject, but does not rely on OpenGL. The x- and y-coordinate of vec are assumed to be in screen coordinates (origin is the top left corner, y pointing down, x pointing to the right) as reported by the touch methods in {@link Input}. A z-coordinate of 0 will return a point on the near plane, a z-coordinate of 1 will return a point on the far plane. This method allows you to specify the viewport position and dimensions in the coordinate system expected by {@link GL20#glViewport(int, int, int, int)}, with the origin in the bottom left corner of the screen. param screenCoords the point in screen coordinates (origin top left) param viewportX the coordinate of the bottom left corner of the viewport in glViewport coordinates. param viewportY the coordinate of the bottom left corner of the viewport in glViewport coordinates. param viewportWidth the width of the viewport in pixels param viewportHeight the height of the viewport in pixels

func (*Camera) UnprojectV3

func (self *Camera) UnprojectV3(screenCoords *Vector3) *Vector3

Function to translate a point given in screen coordinates to world space. It's the same as GLU gluUnProject but does not rely on OpenGL. The viewport is assumed to span the whole screen and is fetched from {@link Graphics#getWidth()} and {@link Graphics#getHeight()}. The x- and y-coordinate of vec are assumed to be in screen coordinates (origin is the top left corner, y pointing down, x pointing to the right) as reported by the touch methods in {@link Input}. A z-coordinate of 0 will return a point on the near plane, a z-coordinate of 1 will return a point on the far plane. param screenCoords the point in screen coordinates

type Color

type Color struct {
	// the red, green, blue and alpha components
	R, G, B, A float32
}

func GetColor

func GetColor(name string) *Color

* Convenience method to lookup a color by {@code name}. The invocation of this method is equivalent to the expression

  • {@code Colors.getColors().get(name)} *
  • @param name the name of the color
  • @return the color to which the specified {@code name} is mapped, or {@code null} if there was no mapping for {@code name}.

func NewColor

func NewColor(r, g, b, a float32) *Color

Constructor, sets the components of the color

func NewColorCopy

func NewColorCopy(color *Color) *Color

func NewColorEmpty

func NewColorEmpty() *Color

Constructs a new Color with all components set to 0

func NewColorHex

func NewColorHex(rgba8888 uint32) *Color

@see #rgba8888ToColor(Color, int)

func (*Color) Add

func (self *Color) Add(r, g, b, a float32) *Color

Adds the given color component values to this Color's values.

func (*Color) AddColor

func (self *Color) AddColor(color *Color) *Color

Adds the given color to this color

func (*Color) Clamp

func (self *Color) Clamp() *Color

Clamps this Color's components to a valid range [0 - 1]

func (*Color) Copy

func (self *Color) Copy() *Color

@return a copy of this color

func (*Color) Equals

func (self *Color) Equals(other *Color) bool

func (*Color) HashCode

func (self *Color) HashCode() uint32

func (*Color) Lerp

func (self *Color) Lerp(r, g, b, a, t float32) *Color

* Linearly interpolates between this color and the target color by t which is in the range [0,1]. The result is stored in this

  • color.
  • @param r The red component of the target color
  • @param g The green component of the target color
  • @param b The blue component of the target color
  • @param a The alpha component of the target color
  • @param t The interpolation coefficient
  • @return This color for chaining.

func (*Color) LerpColor

func (self *Color) LerpColor(target *Color, t float32) *Color

* Linearly interpolates between this color and the target color by t which is in the range [0,1]. The result is stored in this

  • color.
  • @param target The target color
  • @param t The interpolation coefficient
  • @return This color for chaining.

func (*Color) Mul

func (self *Color) Mul(r, g, b, a float32) *Color

Multiplies this Color's color components by the given ones

func (*Color) MulColor

func (self *Color) MulColor(color *Color) *Color

Multiplies the this color and the given color

func (*Color) MulValue

func (self *Color) MulValue(value float32) *Color

Multiplies all components of this Color with the given value

func (*Color) PremultiplyAlpha

func (self *Color) PremultiplyAlpha() *Color

Multiplies the RGB values by the alpha.

func (*Color) Set

func (self *Color) Set(r, g, b, a float32) *Color

Sets this Color's component values.

func (*Color) SetColor

func (self *Color) SetColor(color *Color)

Sets this color to the given color

func (*Color) SetHex

func (self *Color) SetHex(rgba uint32) *Color

Sets this color's component values through an integer representation.

func (*Color) Sub

func (self *Color) Sub(r, g, b, a float32) *Color

Subtracts the given values from this Color's component values

func (*Color) SubColor

func (self *Color) SubColor(color *Color) *Color

Subtracts the given color from this color

func (*Color) ToFloatBits

func (self *Color) ToFloatBits() float32

* Packs the color components into a 32-bit integer with the format ABGR and then converts it to a float.

  • @return the packed color as a 32-bit float
  • @see NumberUtils#intToFloatColoruint32

func (*Color) ToIntBits

func (self *Color) ToIntBits() uint32

* Packs the color components into a 32-bit integer with the format ABGR.

  • @return the packed color as a 32-bit int.

func (*Color) ToString

func (self *Color) ToString() string

Returns the color encoded as hex string with the format RRGGBBAA.

type Event

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

The base class for all events. By default an event will "bubble" up through an actor's parent's handlers (see {@link #setBubbles(boolean)}). An actor's capture listeners can {@link #stop()} an event to prevent child actors from seeing it. An Event may be marked as "handled" which will end its propagation outside of the Stage (see {@link #handle()}). The default {@link Actor#fire(Event)} will mark events handled if an {@link EventListener} returns true. A cancelled event will be stopped and handled. Additionally, many actors will undo the side-effects of a canceled event. (See {@link #cancel()}.) @see InputEvent @see Actor#fire(Event) TODO: implement Pool interface

func NewEvent

func NewEvent() *Event

func (*Event) GetBubbles

func (self *Event) GetBubbles() bool

func (*Event) GetListenerActor

func (self *Event) GetListenerActor() *Actor

* Returns the actor that this listener is attached to.

func (*Event) GetTarget

func (self *Event) GetTarget() *Actor

* Returns the actor that the event originated from.

func (*Event) SetBubbles

func (self *Event) SetBubbles(bubbles bool)

* If true, after the event is fired on the target actor, it will also be fired on each of the parent actors, all the way to

  • the root.

func (*Event) SetListenerActor

func (self *Event) SetListenerActor(listenerActor *Actor)

func (*Event) SetTarget

func (self *Event) SetTarget(targetActor *Actor)

type EventListener

type EventListener interface {
	// Try to handle the given event, if it is applicable.
	// @return true if the event should be considered {@link Event#handle() handled} by scene2d.
	Handle(event *Event) bool
}

Low level interface for receiving events. Typically there is a listener class for each specific event class. @see InputListener @see InputEvent

type InputEvent

type InputEvent struct {
	// The type of input event.
	Type InputType

	// The stage x coordinate where the event occurred. Valid for: touchDown, touchDragged, touchUp, mouseMoved, enter, and exit.
	X float32

	// The stage x coordinate where the event occurred. Valid for: touchDown, touchDragged, touchUp, mouseMoved, enter, and exit.
	Y float32

	// The pointer index for the event. The first touch is index 0, second touch is index 1, etc. Always -1 on desktop. Valid for:
	// touchDown, touchDragged, touchUp, enter, and exit.
	Pointer uint8

	// The index for the mouse button pressed. Always 0 on Android. Valid for: touchDown and touchUp.
	Button uint8

	// The key code of the key that was pressed. Valid for: keyDown and keyUp.
	KeyCode int

	// The character for the key that was type. Valid for: keyTyped.
	Character uint8

	// The amount the mouse was scrolled. Valid for: scrolled.
	ScrollAmount int
}

Event for actor input: touch, mouse, keyboard, and scroll.

func GetEvent

func GetEvent() *InputEvent

Todo: use pools, and check if pointer is ok

type InputType

type InputType uint8

The Types of Input events that can occurr.

const (
	None InputType = iota

	// A new touch for a pointer on the stage was detected
	// Called when the screen was touched or a mouse button was pressed. The button parameter will be {@link Buttons#LEFT} on iOS.
	// param screenX The x coordinate, origin is in the upper left corner
	// param screenY The y coordinate, origin is in the upper left corner
	// param pointer the pointer for the event.
	// param button the button
	// return whether the input was processed
	// Called when a mouse button or a finger touch goes down on the actor. If true is returned, this listener will receive all
	// touchDragged and touchUp events, even those not over this actor, until touchUp is received. Also when true is returned, the
	// event is {@link Event#handle() handled}.
	TouchDown

	// A pointer has stopped touching the stage.
	// Called when a finger was lifted or a mouse button was released. The button parameter will be {@link Buttons#LEFT} on iOS.
	// param pointer the pointer for the event.
	// param button the button
	// return whether the input was processed
	// Called when a mouse button or a finger touch goes up anywhere, but only if touchDown previously returned true for the mouse
	// button or touch. The touchUp event is always {@link Event#handle() handled}.
	TouchUp

	// A pointer that is touching the stage has moved.
	// Called when a finger or the mouse was dragged.
	// param pointer the pointer for the event.
	// @return whether the input was processed
	// Called when a mouse button or a finger touch is moved anywhere, but only if touchDown previously returned true for the mouse
	// button or touch. The touchDragged event is always {@link Event#handle() handled}.
	TouchDragged

	// The mouse pointer has moved (without a mouse button being active).
	MouseMoved

	// The mouse pointer or an active touch have entered (i.e., {@link Actor#hit(float, float, boolean) hit}) an actor.
	Enter

	// The mouse pointer or an active touch have exited an actor.
	Exit

	// The mouse scroll wheel has changed.
	Scrolled

	// Called when a key was pressed
	// param keycode one of the constants in {@link Input.Keys}
	// return whether the input was processed
	KeyDown

	// A keyboard key has been released.
	// A keyboard key has been pressed.
	// Called when a key was released
	// param keycode one of the constants in {@link Input.Keys}
	// return whether the input was processed
	// When true is returned, the event is {@link Event#handle() handled
	KeyUp

	// A keyboard key has been pressed and released.
	// Called when a key was typed
	// param character The character
	// return whether the input was processed
	KeyTyped

	// Called when a tap occured. A tap happens if a touch went down on the screen and was lifted again without moving outside
	// of the tap square. The tap square is a rectangular area around the initial touch position as specified on construction
	// time of the {@link GestureDetector}.
	// @param count the number of taps.
	Tap

	// Called when the user dragged a finger over the screen and lifted it. Reports the last known velocity of the finger in
	// pixels per second.
	// param velocityX velocity on x in seconds
	// param velocityY velocity on y in seconds
	Fling

	// Called when the user drags a finger over the screen.
	// param deltaX the difference in pixels to the last drag event on x.
	// param deltaY the difference in pixels to the last drag event on y.
	Pan

	// Called when no longer panning.
	PanStop

	// Called when a long press was detected
	LongPress

	// Called when the user performs a pinch zoom gesture. The original distance is the distance in pixels when the gesture
	// started.
	// param initialDistance distance between fingers when the gesture started.
	// param distance current distance between fingers.
	Zoom

	// Called when a user performs a pinch zoom gesture. Reports the initial positions of the two involved fingers and their
	// current positions.
	// param initialPointer1
	// param initialPointer2
	// param pointer1
	// param pointer2
	Pinch

	// Called when a swipe gesture occurs
	SwipeLeft
	SwipeRight
	SwipeUp
	SwipeDown
)

func (InputType) String

func (input InputType) String() string

type KeyCode

type KeyCode uint8

The type of Keyboard Keys

type Preferences

type Preferences interface {
	PutBoolean(key string, val bool) Preferences

	PutInteger(key string, val int) Preferences

	PutLong(key string, val int64) Preferences

	PutFloat(key string, val float32) Preferences

	PutString(key, val string) Preferences

	Put(vals map[string]interface{}) Preferences

	GetBoolean(key string, defValue bool) bool

	GetInteger(key string, defValue int) int

	GetLong(key string, defValue int64) int64

	GetFloat(key string, defValue float32) float32

	GetString(key, defValue string) string

	// Returns a read only map[string]interface{} with all the key, objects of the preferences.
	Get() map[string]interface{}

	Contains(key string) bool

	Clear()

	Remove(key string)

	// Makes sure the preferences are persisted.
	Flush()
}

* <p>

  • A Preference instance is a hash map holding different values. It is stored alongside your application (SharedPreferences on
  • Android, LocalStorage on GWT, on the desktop a Java Preferences file in a ".prefs" directory will be created, and on iOS an
  • NSMutableDictionary will be written to the given file). CAUTION: On the desktop platform, all libgdx applications share the same
  • ".prefs" directory. To avoid collisions use specific names like "com.myname.game1.settings" instead of "settings"
  • </p> *
  • <p>
  • Changes to a preferences instance will be cached in memory until {@link #flush()} is invoked.
  • </p> *
  • <p>
  • Use {@link Application#getPreferences(String)} to look up a specific preferences instance. Note that on several backends the
  • preferences name will be used as the filename, so make sure the name is valid for a filename.
  • </p>

* Returns the {@link Preferences} instance of this Application. It can be used to store application settings across runs.

  • @param name the name of the preferences, must be useable as a file name.
  • @return the preferences.

type SBatch

type SBatch struct {
}

func (SBatch) Begin

func (b SBatch) Begin()

func (SBatch) End

func (b SBatch) End()

type Scene

type Scene struct {
	Actor
	Name    string
	BGColor Color

	OnPause  func(self *Scene)
	OnResume func(self *Scene)

	BeforeShow    func(self *Scene)
	BeforeHide    func(self *Scene)
	AfterShow     func(self *Scene)
	AfterHide     func(self *Scene)
	TransitionIn  func(scene *Scene)
	TransitionOut func(scene *Scene)
}

public EventType evtType = EventType.None; public Scene.OnEventType onEvtType = Scene.OnEventType.DoEffect; public String eventScene = "";

func GetCurrentScene

func GetCurrentScene() *Scene

Returns the current scene being Displayed on stage

func GetScene

func GetScene(name string) *Scene

func (*Scene) AddActor

func (self *Scene) AddActor(actor *Actor)

func (*Scene) AddActorWithDelay

func (self *Scene) AddActorWithDelay(actor *Actor, duration time.Duration)

func (*Scene) AddHud

func (self *Scene) AddHud()

func (*Scene) DrawGrid

func (self *Scene) DrawGrid()

func (*Scene) DrawSelection

func (self *Scene) DrawSelection()

func (*Scene) RemoveActor

func (self *Scene) RemoveActor(actor *Actor)

func (*Scene) RemoveActorWithDelay

func (self *Scene) RemoveActorWithDelay(actor *Actor, duration time.Duration)

func (*Scene) RemoveActorWithName

func (self *Scene) RemoveActorWithName(name string)

func (*Scene) RemoveBackground

func (self *Scene) RemoveBackground()

func (*Scene) SetBackground

func (self *Scene) SetBackground(texName string)

type Touchable

type Touchable int

Touchable state of Actors Determines how touch input events are distributed to an actor and any children.

const (
	// TouchableEnabled All touch input events will be received by the actor and any children.
	TouchableEnabled Touchable = iota

	// TouchableDisabled No touch input events will be received by the actor or any children.
	TouchableDisabled

	// TouchableChildrenOnly No touch input events will be received by the actor, but children will still receive events. Note that events on the
	// children will still bubble to the parent.
	TouchableChildrenOnly
)

Directories

Path Synopsis
An app that demonstrates the 2d scenegraph Get the basic example and use gomobile to build or install it on your device.
An app that demonstrates the 2d scenegraph Get the basic example and use gomobile to build or install it on your device.
Package offering various methods for intersection testing between different geometric objects.
Package offering various methods for intersection testing between different geometric objects.
utils
Utility and fast math functions.
Utility and fast math functions.
ui
clipboard
A very simple clipboard interface for text content.
A very simple clipboard interface for text content.

Jump to

Keyboard shortcuts

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