Documentation ¶
Index ¶
- Constants
- func Exit(code int)
- func Exit()
- func Gopt_Game_Main(game Gamer, sprites ...Spriter)
- func Gopt_Game_Reload(game Gamer, index interface{}) (err error)
- func Gopt_Game_Run(game Gamer, resource interface{}, gameConf ...*Config)
- func Gopt_Sprite_Clone(sprite Spriter)
- func Gopt_Sprite_Clone(sprite Spriter, data interface{})
- func Iround(v float64) int
- func Rand(from, to int) float64
- func Rand(from, to float64) float64
- func Sched() int
- func SchedNow() int
- func SetDebug(flags dbgFlags)
- type Camera
- type Color
- type Config
- type EffectKind
- type Game
- func (p *Game) Answer() Value
- func (p *Game) Ask(msg interface{})
- func (p *Game) Broadcast(msg string)
- func (p *Game) Broadcast(msg string, wait bool)
- func (p *Game) Broadcast(msg string, data interface{}, wait bool)
- func (p *Game) ChangeEffect(kind EffectKind, delta float64)
- func (p *Game) ChangeVolume(delta float64)
- func (p *Game) ClearSoundEffects()
- func (p *Game) Draw(screen *ebiten.Image)
- func (p *Game) EraseAll()
- func (p *Game) HideVar(name string)
- func (p *Game) KeyPressed(key Key) bool
- func (p *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)
- func (p *Game) Loudness() float64
- func (p *Game) MouseHitItem() (target *Sprite, ok bool)
- func (p *Game) MousePressed() bool
- func (p *Game) MouseX() float64
- func (p *Game) MouseY() float64
- func (p *Game) NextScene(wait ...bool)
- func (p *Game) OnAnyKey(onKey func(key Key))
- func (p *Game) OnClick(onClick func())
- func (p *Game) OnKey(key Key, onKey func())
- func (p *Game) OnKey(keys []Key, onKey func(Key))
- func (p *Game) OnKey(keys []Key, onKey func())
- func (p *Game) OnMsg(onMsg func(msg string, data interface{}))
- func (p *Game) OnMsg(msg string, onMsg func())
- func (p *Game) OnScene(onScene func(name string))
- func (p *Game) OnScene(name string, onScene func())
- func (p *Game) OnStart(onStart func())
- func (p *Game) Play(media Sound)
- func (p *Game) Play(media Sound, wait bool)
- func (p *Game) Play(media Sound, action *PlayOptions)
- func (p *Game) PrevScene(wait ...bool)
- func (p *Game) ResetTimer()
- func (p *Game) SceneIndex() int
- func (p *Game) SceneName() string
- func (p *Game) SetEffect(kind EffectKind, val float64)
- func (p *Game) SetVolume(volume float64)
- func (p *Game) ShowVar(name string)
- func (p *Game) StartScene(scene interface{}, wait ...bool)
- func (p *Game) Stop(kind StopKind)
- func (p *Game) StopAllSounds()
- func (p *Game) Timer() float64
- func (p *Game) Update() error
- func (p *Game) Username() string
- func (p *Game) Volume() float64
- func (p *Game) Wait(secs float64)
- type Gamer
- type Key
- type List
- func (p *List) Append(v obj)
- func (p *List) At(i Pos) Value
- func (p *List) Contains(v obj) bool
- func (p *List) Delete(i Pos)
- func (p *List) Init(data ...obj)
- func (p *List) InitFrom(src *List)
- func (p *List) Insert(i Pos, v obj)
- func (p *List) Len() int
- func (p *List) Set(i Pos, v obj)
- func (p *List) String() string
- type MovingInfo
- type PlayAction
- type PlayOptions
- type Pos
- type RotationStyle
- type Shape
- type Sound
- type Sprite
- func (p *Sprite) Animate(name string)
- func (p *Sprite) Ask(msg interface{})
- func (p *Sprite) BounceOffEdge()
- func (p *Sprite) Bounds() *math32.RotatedRect
- func (p *Sprite) ChangeEffect(kind EffectKind, delta float64)
- func (p *Sprite) ChangeHeading(dir float64)
- func (p *Sprite) ChangePenColor(delta float64)
- func (p *Sprite) ChangePenHue(delta float64)
- func (p *Sprite) ChangePenShade(delta float64)
- func (p *Sprite) ChangePenSize(delta float64)
- func (p *Sprite) ChangeSize(delta float64)
- func (p *Sprite) ChangeXYpos(dx, dy float64)
- func (p *Sprite) ChangeXpos(dx float64)
- func (p *Sprite) ChangeYpos(dy float64)
- func (p *Sprite) ClearGraphEffects()
- func (p *Sprite) CostumeHeight() float64
- func (p *Sprite) CostumeIndex() int
- func (p *Sprite) CostumeName() string
- func (p *Sprite) CostumeWidth() float64
- func (p *Sprite) Destroy()
- func (p *Sprite) Die()
- func (p *Sprite) DistanceTo(obj interface{}) float64
- func (p *Sprite) Glide(x, y float64, secs float64)
- func (p *Sprite) Glide(obj interface{}, secs float64)
- func (p *Sprite) GoBackLayers(n int)
- func (p *Sprite) Goto(obj interface{})
- func (p *Sprite) GotoBack()
- func (p *Sprite) GotoFront()
- func (p *Sprite) Heading() float64
- func (p *Sprite) Hide()
- func (p *Sprite) HideVar(name string)
- func (p *Sprite) InitFrom(src *Sprite)
- func (p *Sprite) IsCloned() bool
- func (p *Sprite) Move(step float64)
- func (p *Sprite) Move(step int)
- func (p *Sprite) NextCostume()
- func (p *Sprite) OnAnyKey(onKey func(key Key))
- func (p *Sprite) OnClick(onClick func())
- func (p *Sprite) OnCloned(onCloned func(data interface{}))
- func (p *Sprite) OnCloned(onCloned func())
- func (p *Sprite) OnKey(key Key, onKey func())
- func (p *Sprite) OnKey(keys []Key, onKey func(Key))
- func (p *Sprite) OnKey(keys []Key, onKey func())
- func (p *Sprite) OnMoving(onMoving func(mi *MovingInfo))
- func (p *Sprite) OnMoving(onMoving func())
- func (p *Sprite) OnMsg(onMsg func(msg string, data interface{}))
- func (p *Sprite) OnMsg(msg string, onMsg func())
- func (p *Sprite) OnScene(onScene func(name string))
- func (p *Sprite) OnScene(name string, onScene func())
- func (p *Sprite) OnStart(onStart func())
- func (p *Sprite) OnTouched(onTouched func(obj *Sprite))
- func (p *Sprite) OnTouched(onTouched func())
- func (p *Sprite) OnTouched(name string, onTouched func(obj *Sprite))
- func (p *Sprite) OnTouched(name string, onTouched func())
- func (p *Sprite) OnTouched(names []string, onTouched func(obj *Sprite))
- func (p *Sprite) OnTouched(names []string, onTouched func())
- func (p *Sprite) OnTurning(onTurning func(ti *TurningInfo))
- func (p *Sprite) OnTurning(onTurning func())
- func (p *Sprite) Parent() *Game
- func (p *Sprite) PenDown()
- func (p *Sprite) PenUp()
- func (p *Sprite) PrevCostume()
- func (p *Sprite) Quote(message string)
- func (p *Sprite) Quote(message string, secs float64)
- func (p *Sprite) Quote(message, description string, secs ...float64)
- func (p *Sprite) Say(msg interface{}, secs ...float64)
- func (p *Sprite) SetCostume(costume interface{})
- func (p *Sprite) SetDying()
- func (p *Sprite) SetEffect(kind EffectKind, val float64)
- func (p *Sprite) SetHeading(dir float64)
- func (p *Sprite) SetPenColor(color Color)
- func (p *Sprite) SetPenHue(hue float64)
- func (p *Sprite) SetPenShade(shade float64)
- func (p *Sprite) SetPenSize(size float64)
- func (p *Sprite) SetRotationStyle(style RotationStyle)
- func (p *Sprite) SetSize(size float64)
- func (p *Sprite) SetXYpos(x, y float64)
- func (p *Sprite) SetXpos(x float64)
- func (p *Sprite) SetYpos(y float64)
- func (p *Sprite) Show()
- func (p *Sprite) ShowVar(name string)
- func (p *Sprite) Size() float64
- func (p *Sprite) Stamp()
- func (p *Sprite) Step(step float64)
- func (p *Sprite) Step(step int)
- func (p *Sprite) Step(step float64, animname string)
- func (p *Sprite) Stop(kind StopKind)
- func (p *Sprite) Think(msg interface{}, secs ...float64)
- func (p *Sprite) Touching(obj interface{}) bool
- func (p *Sprite) TouchingColor(color Color) bool
- func (p *Sprite) Turn(val interface{})
- func (p *Sprite) TurnTo(obj interface{})
- func (p *Sprite) Visible() bool
- func (p *Sprite) Xpos() float64
- func (p *Sprite) Ypos() float64
- type Spriter
- type StopKind
- type TurningInfo
- type Value
Constants ¶
View Source
const ( GopPackage = true Gop_sched = "Sched,SchedNow" )
View Source
const ( DbgFlagLoad dbgFlags = 1 << iota DbgFlagInstr DbgFlagEvent DbgFlagAll = DbgFlagLoad | DbgFlagInstr | DbgFlagEvent )
View Source
const ( Prev switchAction = -1 Next switchAction = 1 )
View Source
const ( Right specialDir = 90 Left specialDir = -90 Up specialDir = 0 Down specialDir = 180 )
View Source
const ( Mouse specialObj = -5 Edge specialObj = touchingAllEdges EdgeLeft specialObj = touchingScreenLeft EdgeTop specialObj = touchingScreenTop EdgeRight specialObj = touchingScreenRight EdgeBottom specialObj = touchingScreenBottom )
Variables ¶
This section is empty.
Functions ¶
func Gopt_Game_Main ¶
Gopt_Game_Main is required by Go+ compiler as the entry of a .gmx project.
func Gopt_Game_Reload ¶
func Gopt_Game_Run ¶
Gopt_Game_Run runs the game. resource can be a string or fs.Dir object.
func Gopt_Sprite_Clone ¶
func Gopt_Sprite_Clone(sprite Spriter)
func Gopt_Sprite_Clone ¶
func Gopt_Sprite_Clone(sprite Spriter, data interface{})
Types ¶
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
func (*Camera) ChangeXYpos ¶
type Color ¶
type Config ¶
type Config struct { Title string `json:"title,omitempty"` Width int `json:"width,omitempty"` Height int `json:"height,omitempty"` KeyDuration int `json:"keyDuration,omitempty"` ScreenshotKey string `json:"screenshotKey,omitempty"` // screenshot image capture key Index interface{} `json:"-"` // where is index.json, can be file (string) or io.Reader DontParseFlags bool `json:"-"` FullScreen bool `json:"fullScreen,omitempty"` DontRunOnUnfocused bool `json:"pauseOnUnfocused,omitempty"` }
type EffectKind ¶
type EffectKind int
const ( ColorEffect EffectKind = iota BrightnessEffect GhostEffect )
func (EffectKind) String ¶
func (kind EffectKind) String() string
type Game ¶
type Game struct { Camera // contains filtered or unexported fields }
func (*Game) ChangeEffect ¶
func (p *Game) ChangeEffect(kind EffectKind, delta float64)
func (*Game) ChangeVolume ¶
func (*Game) ClearSoundEffects ¶
func (p *Game) ClearSoundEffects()
func (*Game) KeyPressed ¶
func (*Game) MouseHitItem ¶
MouseHitItem returns the topmost item which is hit by mouse.
func (*Game) MousePressed ¶
func (*Game) Play ¶
Play func:
Play(sound) Play(video) -- maybe Play(media, wait) -- sync Play(media, opts)
func (*Game) Play ¶
func (p *Game) Play(media Sound, action *PlayOptions)
func (*Game) ResetTimer ¶
func (p *Game) ResetTimer()
func (*Game) SceneIndex ¶
func (*Game) SetEffect ¶
func (p *Game) SetEffect(kind EffectKind, val float64)
func (*Game) StartScene ¶
StartScene func:
StartScene(sceneName) or StartScene(sceneIndex) or StartScene(spx.Next) StartScene(spx.Prev)
func (*Game) StopAllSounds ¶
func (p *Game) StopAllSounds()
type Key ¶
type Key = ebiten.Key
const ( Key0 Key = ebiten.Key0 Key1 Key = ebiten.Key1 Key2 Key = ebiten.Key2 Key3 Key = ebiten.Key3 Key4 Key = ebiten.Key4 Key5 Key = ebiten.Key5 Key6 Key = ebiten.Key6 Key7 Key = ebiten.Key7 Key8 Key = ebiten.Key8 Key9 Key = ebiten.Key9 KeyA Key = ebiten.KeyA KeyB Key = ebiten.KeyB KeyC Key = ebiten.KeyC KeyD Key = ebiten.KeyD KeyE Key = ebiten.KeyE KeyF Key = ebiten.KeyF KeyG Key = ebiten.KeyG KeyH Key = ebiten.KeyH KeyI Key = ebiten.KeyI KeyJ Key = ebiten.KeyJ KeyK Key = ebiten.KeyK KeyL Key = ebiten.KeyL KeyM Key = ebiten.KeyM KeyN Key = ebiten.KeyN KeyO Key = ebiten.KeyO KeyP Key = ebiten.KeyP KeyQ Key = ebiten.KeyQ KeyR Key = ebiten.KeyR KeyS Key = ebiten.KeyS KeyT Key = ebiten.KeyT KeyU Key = ebiten.KeyU KeyV Key = ebiten.KeyV KeyW Key = ebiten.KeyW KeyX Key = ebiten.KeyX KeyY Key = ebiten.KeyY KeyZ Key = ebiten.KeyZ KeyApostrophe Key = ebiten.KeyApostrophe KeyBackslash Key = ebiten.KeyBackslash KeyBackspace Key = ebiten.KeyBackspace KeyCapsLock Key = ebiten.KeyCapsLock KeyComma Key = ebiten.KeyComma KeyDelete Key = ebiten.KeyDelete KeyDown Key = ebiten.KeyDown KeyEnd Key = ebiten.KeyEnd KeyEnter Key = ebiten.KeyEnter KeyEqual Key = ebiten.KeyEqual KeyEscape Key = ebiten.KeyEscape KeyF1 Key = ebiten.KeyF1 KeyF2 Key = ebiten.KeyF2 KeyF3 Key = ebiten.KeyF3 KeyF4 Key = ebiten.KeyF4 KeyF5 Key = ebiten.KeyF5 KeyF6 Key = ebiten.KeyF6 KeyF7 Key = ebiten.KeyF7 KeyF8 Key = ebiten.KeyF8 KeyF9 Key = ebiten.KeyF9 KeyF10 Key = ebiten.KeyF10 KeyF11 Key = ebiten.KeyF11 KeyF12 Key = ebiten.KeyF12 KeyGraveAccent Key = ebiten.KeyGraveAccent KeyHome Key = ebiten.KeyHome KeyInsert Key = ebiten.KeyInsert KeyKP0 Key = ebiten.KeyKP0 KeyKP1 Key = ebiten.KeyKP1 KeyKP2 Key = ebiten.KeyKP2 KeyKP3 Key = ebiten.KeyKP3 KeyKP4 Key = ebiten.KeyKP4 KeyKP5 Key = ebiten.KeyKP5 KeyKP6 Key = ebiten.KeyKP6 KeyKP7 Key = ebiten.KeyKP7 KeyKP8 Key = ebiten.KeyKP8 KeyKP9 Key = ebiten.KeyKP9 KeyKPDecimal Key = ebiten.KeyKPDecimal KeyKPDivide Key = ebiten.KeyKPDivide KeyKPEnter Key = ebiten.KeyKPEnter KeyKPEqual Key = ebiten.KeyKPEqual KeyKPMultiply Key = ebiten.KeyKPMultiply KeyKPSubtract Key = ebiten.KeyKPSubtract KeyLeft Key = ebiten.KeyLeft KeyLeftBracket Key = ebiten.KeyLeftBracket KeyMenu Key = ebiten.KeyMenu KeyMinus Key = ebiten.KeyMinus KeyNumLock Key = ebiten.KeyNumLock KeyPageDown Key = ebiten.KeyPageDown KeyPageUp Key = ebiten.KeyPageUp KeyPause Key = ebiten.KeyPause KeyPeriod Key = ebiten.KeyPeriod KeyPrintScreen Key = ebiten.KeyPrintScreen KeyRight Key = ebiten.KeyRight KeyRightBracket Key = ebiten.KeyRightBracket KeyScrollLock Key = ebiten.KeyScrollLock KeySemicolon Key = ebiten.KeySemicolon KeySlash Key = ebiten.KeySlash KeySpace Key = ebiten.KeySpace KeyTab Key = ebiten.KeyTab KeyUp Key = ebiten.KeyUp KeyAlt Key = ebiten.KeyAlt KeyControl Key = ebiten.KeyControl KeyShift Key = ebiten.KeyShift KeyMax Key = ebiten.KeyMax KeyAny Key = -1 )
type MovingInfo ¶
type MovingInfo struct {
OldX, OldY float64
NewX, NewY float64
Obj *Sprite
// contains filtered or unexported fields
}
func (*MovingInfo) Dx ¶
func (p *MovingInfo) Dx() float64
func (*MovingInfo) Dy ¶
func (p *MovingInfo) Dy() float64
func (*MovingInfo) StopMoving ¶
func (p *MovingInfo) StopMoving()
type PlayAction ¶
type PlayAction int
const ( PlayRewind PlayAction = iota PlayContinue PlayPause PlayResume PlayStop )
type PlayOptions ¶
type PlayOptions struct { Action PlayAction Wait bool Loop bool }
type Sprite ¶
type Sprite struct {
// contains filtered or unexported fields
}
func (*Sprite) BounceOffEdge ¶
func (p *Sprite) BounceOffEdge()
func (*Sprite) Bounds ¶
func (p *Sprite) Bounds() *math32.RotatedRect
func (*Sprite) ChangeEffect ¶
func (p *Sprite) ChangeEffect(kind EffectKind, delta float64)
func (*Sprite) ChangeHeading ¶
func (*Sprite) ChangePenColor ¶
func (*Sprite) ChangePenHue ¶
func (*Sprite) ChangePenShade ¶
func (*Sprite) ChangePenSize ¶
func (*Sprite) ChangeSize ¶
func (*Sprite) ChangeXYpos ¶
func (*Sprite) ChangeXpos ¶
func (*Sprite) ChangeYpos ¶
func (*Sprite) ClearGraphEffects ¶
func (p *Sprite) ClearGraphEffects()
func (*Sprite) CostumeHeight ¶
CostumeHeight returns height of sprite current costume.
func (*Sprite) CostumeIndex ¶
func (*Sprite) CostumeName ¶
func (*Sprite) CostumeWidth ¶
CostumeWidth returns width of sprite current costume.
func (*Sprite) DistanceTo ¶
DistanceTo func:
DistanceTo(sprite) DistanceTo(spriteName) DistanceTo(spx.Mouse) DistanceTo(spx.Random)
func (*Sprite) GoBackLayers ¶
func (*Sprite) Goto ¶
func (p *Sprite) Goto(obj interface{})
Goto func:
Goto(sprite) Goto(spriteName) Goto(spx.Mouse) Goto(spx.Random)
func (*Sprite) NextCostume ¶
func (p *Sprite) NextCostume()
func (*Sprite) OnMoving ¶
func (p *Sprite) OnMoving(onMoving func(mi *MovingInfo))
func (*Sprite) OnTurning ¶
func (p *Sprite) OnTurning(onTurning func(ti *TurningInfo))
func (*Sprite) PrevCostume ¶
func (p *Sprite) PrevCostume()
func (*Sprite) SetCostume ¶
func (p *Sprite) SetCostume(costume interface{})
func (*Sprite) SetEffect ¶
func (p *Sprite) SetEffect(kind EffectKind, val float64)
func (*Sprite) SetHeading ¶
func (*Sprite) SetPenColor ¶
func (*Sprite) SetPenShade ¶
func (*Sprite) SetPenSize ¶
func (*Sprite) SetRotationStyle ¶
func (p *Sprite) SetRotationStyle(style RotationStyle)
func (*Sprite) Touching ¶
Touching func:
Touching(spriteName) Touching(sprite) Touching(spx.Mouse) Touching(spx.Edge) Touching(spx.EdgeLeft) Touching(spx.EdgeTop) Touching(spx.EdgeRight) Touching(spx.EdgeBottom)
func (*Sprite) TouchingColor ¶
func (*Sprite) Turn ¶
func (p *Sprite) Turn(val interface{})
Turn func:
Turn(degree) Turn(spx.Left) Turn(spx.Right) Turn(ti *spx.TurningInfo)
type StopKind ¶
type StopKind int
const ( AllOtherScripts StopKind = -100 // stop all other scripts AllSprites StopKind = -101 // stop all scripts of sprites ThisSprite StopKind = -102 // stop all scripts of this sprite ThisScript StopKind = -103 // abort this script OtherScriptsInSprite StopKind = -104 // stop other scripts of this sprite )
type TurningInfo ¶
func (*TurningInfo) Dir ¶
func (p *TurningInfo) Dir() float64
Source Files ¶
Click to show internal directories.
Click to hide internal directories.