Documentation ¶
Index ¶
- Constants
- Variables
- func CountdownLoop(e *ScriptEnv, timer *int, tickMs int, end Event) bool
- func Error(format string, a ...interface{})
- func FormatAction(a Action) string
- func FormatEvent(e Event) string
- func FormatScore(format string, a ...interface{}) string
- func Info(format string, a ...interface{})
- func Log(format string, a ...interface{})
- func RGBAToUint32(c color.RGBA) uint32
- func RGBToGray(rgb color.Color) uint8
- func RegisterFonts(eng *Engine)
- func RegisterLoggingSystem(eng *Engine)
- func RegisterTrackerSystem(eng *Engine)
- func RenderFrameLoop(e *ScriptEnv, fn func(*ScriptEnv)) bool
- func ScoreHurryUpLoop(e *ScriptEnv, score *int, tickMs int, decScore int, endScore int) bool
- func ScorePanel(e *ScriptEnv)
- func ShotSequenceLoop(e *ScriptEnv, shot string, timeMs int, switches ...string)
- func WaitForBallArrivalFunc(e *ScriptEnv, sw string, timeMs int) func() bool
- func WaitForBallArrivalLoop(e *ScriptEnv, sw string, timeMs int) bool
- func WaitForBallDepartureLoop(e *ScriptEnv, sw string, timeMs int) bool
- func Warn(format string, a ...interface{})
- func WatcherTimerLoop(e *ScriptEnv, timer *int, fn func(v int)) bool
- type Action
- type ActionHandler
- type AddBall
- type AddPlayer
- type AdvanceEvent
- type AdvanceGame
- type AllLampsOff
- type AnchorX
- type AnchorY
- type AutoPulse
- type AutoPulseOff
- type AutoPulseOn
- type AwardScore
- type BallAddedEvent
- type BallDrainEvent
- type BallHold
- type BallWillDrainEvent
- type Config
- type Debug
- type Display
- type DisplayOptions
- type Done
- type Driver
- type DriverOff
- type DriverOn
- type DriverPWM
- type DriverPulse
- type DriverType
- type EndOfBallEvent
- type EndOfGameEvent
- type Engine
- func (e *Engine) Display(id string) Display
- func (e *Engine) Do(act Action)
- func (e *Engine) GetVars(name string) (interface{}, bool)
- func (e *Engine) NewCoroutine(fn func(*ScriptEnv))
- func (e *Engine) Post(evt Event)
- func (e *Engine) RegisterAction(act Action)
- func (e *Engine) RegisterActionHandler(h ActionHandler)
- func (e *Engine) RegisterEvent(evt Event)
- func (e *Engine) RegisterEventHandler(h EventHandler)
- func (e *Engine) RegisterServer(s Server)
- func (e *Engine) RegisterVars(name string, vars interface{})
- func (e *Engine) Run()
- func (e *Engine) Stop()
- type Event
- type EventHandler
- type FadeOutMusic
- type Flipper
- type FlippersOff
- type FlippersOn
- type GameOverEvent
- type GameVars
- type Graphics
- type Message
- type MusicFinishedEvent
- type MusicVolume
- type Options
- type PlayMusic
- type PlayScript
- type PlaySound
- type PlaySpeech
- type PlayerAddedEvent
- type PlayerVars
- type RegisterAutoPulse
- type RegisterCoil
- type RegisterDisplay
- type RegisterFlasher
- type RegisterFlipper
- type RegisterFont
- type RegisterLamp
- type RegisterMagnet
- type RegisterMotor
- type RegisterMusic
- type RegisterScript
- type RegisterSound
- type RegisterSpeech
- type RegisterSwitch
- type Renderer
- type Resources
- type ScriptEnv
- func (e *ScriptEnv) Display(id string) Display
- func (e *ScriptEnv) Do(act Action)
- func (e *ScriptEnv) GetVars(name string) (interface{}, bool)
- func (e *ScriptEnv) NewCoroutine(fn ScriptFn)
- func (e *ScriptEnv) Post(evt Event)
- func (e *ScriptEnv) RegisterVars(name string, vars interface{})
- func (e *ScriptEnv) Sleep(ms int) bool
- func (e *ScriptEnv) WaitFor(events ...coroutine.Event) (coroutine.Event, bool)
- func (e *ScriptEnv) WaitForUntil(ms int, s ...coroutine.Event) (coroutine.Event, bool)
- type ScriptFinishedEvent
- type ScriptFn
- type ScriptStartedEvent
- type Sequencer
- func (s *Sequencer) Defer(act Action)
- func (s *Sequencer) Do(act Action)
- func (s *Sequencer) DoFunc(fn func())
- func (s *Sequencer) DoRun(fn func() bool)
- func (s *Sequencer) DoScript(fn func(*ScriptEnv))
- func (s *Sequencer) Loop()
- func (s *Sequencer) LoopN(n int)
- func (s *Sequencer) Post(evt Event)
- func (s *Sequencer) Run() bool
- func (s *Sequencer) Sleep(ms int)
- func (s *Sequencer) WaitFor(events ...coroutine.Event)
- func (s *Sequencer) WaitForUntil(ms int, events ...coroutine.Event)
- type Server
- type SetScore
- type SetVar
- type ShotEvent
- type SoundFinishedEvent
- type SpeechFinishedEvent
- type StartOfBallEvent
- type StopAudio
- type StopMusic
- type StopScript
- type StopScriptGroup
- type StopSound
- type StopSpeech
- type Store
- type Switch
- type SwitchEvent
- type TimeoutEvent
Constants ¶
View Source
const ( Font04B_03_7px = "04B-03-7px" Font09x5 = "Font09x5" Font09x6 = "Font09x6" Font09x7 = "Font09x7" Font14x9 = "Font14x9" Font14x8 = "Font14x8" Font14x10 = "Font14x10" Font18x10 = "Font18x10" Font18x11 = "Font18x11" Font18x12 = "Font18x12" FontPfArmaFive8 = "FontPfArmaFive8" FontPfRondaSeven8 = "FontPfRondaSeven8" FontPfRondaSevenBold8 = "FontPfRondaSevenBold8" FontPfTempestaFive8 = "FontPfTempestaFive8" FontPfTempestaFiveBold8 = "FontPfTempestaFiveBold8" FontPfTempestaFiveCompressed8 = "FontPfTempestaFiveCompressed8" FontPfTempestaFiveCompressedBold8 = "FontPfTempestaFiveCompressedBold8" FontPfTempestaFiveCondensed8 = "FontPfTempestaFiveCondensed8" FontPfTempestaFiveCondensedBold8 = "FontPfTempestaFiveCondensedBold8" FontPfTempestaFiveExtended8 = "FontPfTempestaFiveExtended8" FontPfTempestaFiveExtendedBold8 = "FontPfTempestaFiveExtendedBold8" )
View Source
const ( ScriptGroupMode = "GroupMode" ScriptGroupBall = "GroupBall" )
View Source
const ( Version = "alpha-v7" Date = "1 Feb 2022" )
View Source
const (
DebugStackTrace = "StackTrace"
)
View Source
const (
LayerPriority = "LayerPriority"
)
View Source
const (
PriorityAudioModeCallout = 1
)
Variables ¶
View Source
var ( ColorBlack = color.RGBA{0x00, 0x00, 0x00, 0xff} ColorWhite = color.RGBA{0xff, 0xff, 0xff, 0xff} )
View Source
var AssetDir = os.Getenv("SPIN_ASSET_DIR")
Functions ¶
func CountdownLoop ¶ added in v0.6.0
func FormatAction ¶ added in v0.3.0
func FormatEvent ¶ added in v0.3.0
func FormatScore ¶
func RGBAToUint32 ¶ added in v0.5.0
func RGBToGray ¶ added in v0.3.0
https://stackoverflow.com/questions/42516203/converting-rgba-image-to-grayscale-golang
func RegisterFonts ¶ added in v0.6.0
func RegisterFonts(eng *Engine)
func RegisterLoggingSystem ¶
func RegisterLoggingSystem(eng *Engine)
func RegisterTrackerSystem ¶ added in v0.6.0
func RegisterTrackerSystem(eng *Engine)
func RenderFrameLoop ¶ added in v0.6.0
func ScoreHurryUpLoop ¶ added in v0.6.0
func ScorePanel ¶ added in v0.6.0
func ScorePanel(e *ScriptEnv)
func ShotSequenceLoop ¶ added in v0.6.0
func WaitForBallArrivalFunc ¶ added in v0.6.0
func WaitForBallArrivalLoop ¶ added in v0.6.0
func WaitForBallDepartureLoop ¶ added in v0.6.0
Types ¶
type ActionHandler ¶
type ActionHandler interface {
HandleAction(Action)
}
type AdvanceEvent ¶ added in v0.6.0
type AdvanceEvent struct {
ID string
}
func (AdvanceEvent) Key ¶ added in v0.6.0
func (e AdvanceEvent) Key() interface{}
type AdvanceGame ¶
type AdvanceGame struct{}
type AllLampsOff ¶ added in v0.7.0
type AllLampsOff struct{}
type AutoPulseOff ¶ added in v0.4.0
type AutoPulseOff struct {
ID string
}
type AutoPulseOn ¶ added in v0.4.0
type AutoPulseOn struct {
ID string
}
type AwardScore ¶
type AwardScore struct {
Val int
}
type BallAddedEvent ¶ added in v0.6.0
type BallAddedEvent struct {
BallsInPlay int
}
func (BallAddedEvent) Key ¶ added in v0.6.0
func (e BallAddedEvent) Key() interface{}
type BallDrainEvent ¶ added in v0.5.0
type BallDrainEvent struct {
BallsInPlay int
}
func (BallDrainEvent) Key ¶ added in v0.5.0
func (e BallDrainEvent) Key() interface{}
type BallWillDrainEvent ¶ added in v0.5.0
type BallWillDrainEvent struct{}
func (BallWillDrainEvent) Key ¶ added in v0.5.0
func (e BallWillDrainEvent) Key() interface{}
type Config ¶ added in v0.3.0
type Config struct { CoilTrough string SwitchDrain string SwitchEnterServiceButton string SwitchExitServiceButton string SwitchLeftFlipperButton string SwitchNextServiceButton string SwitchPreviousServiceButton string SwitchRightFlipperButton string SwitchShooterLane string SwitchStartButton string SwitchTroughJam string SwitchWillDrain []string LampStartButton string GI []string NumBalls int }
type Driver ¶ added in v0.3.0
type Driver struct { ID string Type DriverType Addr interface{} }
type DriverPulse ¶ added in v0.3.0
type DriverType ¶ added in v0.3.0
type DriverType int
const ( Coil DriverType = iota Flasher Lamp Magnet Motor )
type EndOfBallEvent ¶
func (EndOfBallEvent) Key ¶
func (e EndOfBallEvent) Key() interface{}
type EndOfGameEvent ¶
type EndOfGameEvent struct{}
func (EndOfGameEvent) Key ¶
func (e EndOfGameEvent) Key() interface{}
type Engine ¶
type Engine struct { Config Config Options Options Actions map[string]Action Events map[string]Event // contains filtered or unexported fields }
func (*Engine) NewCoroutine ¶ added in v0.6.0
func (*Engine) RegisterAction ¶
func (*Engine) RegisterActionHandler ¶
func (e *Engine) RegisterActionHandler(h ActionHandler)
func (*Engine) RegisterEvent ¶
func (*Engine) RegisterEventHandler ¶
func (e *Engine) RegisterEventHandler(h EventHandler)
func (*Engine) RegisterServer ¶
func (*Engine) RegisterVars ¶
type EventHandler ¶
type EventHandler interface {
HandleEvent(Event)
}
type FadeOutMusic ¶
type FadeOutMusic struct {
Time int // milliseconds
}
type Flipper ¶ added in v0.4.0
type Flipper struct { ID string SwitchAddr interface{} PowerCoilAddr interface{} HoldCoilAddr interface{} // contains filtered or unexported fields }
type FlippersOff ¶ added in v0.4.0
type FlippersOff struct {
FlipperIDs []string
}
type FlippersOn ¶ added in v0.4.0
type FlippersOn struct {
FlipperIDs []string
}
type GameOverEvent ¶ added in v0.4.0
type GameOverEvent struct{}
func (GameOverEvent) Key ¶ added in v0.4.0
func (e GameOverEvent) Key() interface{}
type GameVars ¶
type GameVars struct { BallActive bool BallsInPlay int BallsPerGame int Player int Ball int MaxPlayers int NumPlayers int ExtraBalls int IsExtraBall bool }
func GetGameVars ¶ added in v0.5.0
type MusicFinishedEvent ¶ added in v0.5.0
type MusicFinishedEvent struct{}
func (MusicFinishedEvent) Key ¶ added in v0.5.0
func (e MusicFinishedEvent) Key() interface{}
type MusicVolume ¶ added in v0.4.0
type Options ¶ added in v0.4.0
type Options struct {
RegisterEOS bool
}
func DefaultOptions ¶ added in v0.4.0
func DefaultOptions() Options
type PlayScript ¶
type PlayScript struct {
ID string
}
type PlaySpeech ¶
type PlayerAddedEvent ¶ added in v0.4.0
type PlayerAddedEvent struct {
Player int
}
func (PlayerAddedEvent) Key ¶ added in v0.4.0
func (e PlayerAddedEvent) Key() interface{}
type PlayerVars ¶ added in v0.5.0
type PlayerVars struct {
Score int
}
func GetPlayerVars ¶ added in v0.5.0
func GetPlayerVars(store Store) *PlayerVars
func GetPlayerVarsFor ¶ added in v0.5.0
func GetPlayerVarsFor(store Store, player int) *PlayerVars
type RegisterAutoPulse ¶ added in v0.4.0
type RegisterCoil ¶ added in v0.3.0
type RegisterCoil struct { ID string Addr interface{} }
type RegisterDisplay ¶
type RegisterFlasher ¶ added in v0.3.0
type RegisterFlasher struct { ID string Addr interface{} }
type RegisterFlipper ¶ added in v0.4.0
type RegisterFlipper struct { ID string SwitchAddr interface{} PowerCoilAddr interface{} HoldCoilAddr interface{} }
type RegisterFont ¶
type RegisterLamp ¶ added in v0.3.0
type RegisterLamp struct { ID string Addr interface{} }
type RegisterMagnet ¶ added in v0.3.0
type RegisterMagnet struct { ID string Addr interface{} }
type RegisterMotor ¶ added in v0.3.0
type RegisterMotor struct { ID string Addr interface{} }
type RegisterMusic ¶
type RegisterScript ¶
type RegisterSound ¶
type RegisterSpeech ¶
type RegisterSwitch ¶ added in v0.3.0
type Resources ¶
func GetResourceVars ¶ added in v0.6.0
type ScriptEnv ¶ added in v0.6.0
type ScriptEnv struct { Config Config // contains filtered or unexported fields }
func (*ScriptEnv) NewCoroutine ¶ added in v0.6.0
func (*ScriptEnv) RegisterVars ¶ added in v0.6.0
type ScriptFinishedEvent ¶ added in v0.5.0
type ScriptFinishedEvent struct {
ID string
}
func (ScriptFinishedEvent) Key ¶ added in v0.5.0
func (e ScriptFinishedEvent) Key() interface{}
type ScriptStartedEvent ¶ added in v0.7.0
type ScriptStartedEvent struct {
ID string
}
func (ScriptStartedEvent) Key ¶ added in v0.7.0
func (e ScriptStartedEvent) Key() interface{}
type Sequencer ¶ added in v0.6.0
type Sequencer struct {
// contains filtered or unexported fields
}
func NewSequencer ¶ added in v0.6.0
type SoundFinishedEvent ¶ added in v0.6.0
type SoundFinishedEvent struct {
ID string
}
func (SoundFinishedEvent) Key ¶ added in v0.6.0
func (e SoundFinishedEvent) Key() interface{}
type SpeechFinishedEvent ¶ added in v0.5.0
type SpeechFinishedEvent struct {
ID string
}
func (SpeechFinishedEvent) Key ¶ added in v0.5.0
func (e SpeechFinishedEvent) Key() interface{}
type StartOfBallEvent ¶
func (StartOfBallEvent) Key ¶
func (e StartOfBallEvent) Key() interface{}
type StopScript ¶
type StopScript struct {
ID string
}
type StopScriptGroup ¶ added in v0.7.0
type StopScriptGroup struct {
ID string
}
type StopSpeech ¶
type StopSpeech struct {
ID string
}
type SwitchEvent ¶
func (SwitchEvent) Key ¶
func (e SwitchEvent) Key() interface{}
type TimeoutEvent ¶ added in v0.6.0
type TimeoutEvent struct {
ID string
}
func (TimeoutEvent) Key ¶ added in v0.6.0
func (e TimeoutEvent) Key() interface{}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.