Documentation
¶
Overview ¶
Package engine is what the host needs from something that runs a game: a libretro core in production, a small built-in core in tests.
Index ¶
Constants ¶
View Source
const ( Format0RGB1555 = 0 FormatXRGB8888 = 1 FormatRGB565 = 2 )
Pixel formats, numbered as libretro numbers them.
View Source
const ( ButtonB = iota ButtonY ButtonSelect ButtonStart ButtonUp ButtonDown ButtonLeft ButtonRight ButtonA ButtonX ButtonL ButtonR ButtonL2 ButtonR2 ButtonL3 ButtonR3 )
RetroPad buttons, as bit numbers in PadState.Buttons.
View Source
const MaxPorts = 8
MaxPorts is how many players the protocol carries input for.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AVInfo ¶
type AVInfo struct {
BaseWidth, BaseHeight int
MaxWidth, MaxHeight int
Aspect float64
FPS float64
SampleRate float64
}
AVInfo is what an engine says about its output.
type Engine ¶
type Engine interface {
SystemInfo() SystemInfo
LoadGame(path string) (AVInfo, error)
Run()
Reset()
SaveState() []byte
LoadState(b []byte) bool
SaveRAM() []byte // the engine's own memory; nil when the game has none
Close()
}
Engine runs one game. Every method is called from one locked OS thread.
type Handlers ¶
type Handlers struct {
Video func(data []byte, width, height, stride, format int)
Dupe func() // the previous frame again
Audio func(stereo []int16)
Input func() *[MaxPorts]PadState // once a frame
Rumble func(port, effect, strength int)
Message func(text string)
Log func(level int, text string)
Geometry func(width, height int, aspect float64)
Rotation func(quarterTurns int)
AVInfo func(info AVInfo)
Shutdown func()
}
Handlers receive what an engine produces. All are called on the thread running Run, and slices are only valid during the call. Any may be nil.
Click to show internal directories.
Click to hide internal directories.