Documentation
¶
Index ¶
- Constants
- func CallUpdateCallback() int
- func SetUpdateCallback(callback func() int)
- type AudioSample
- type BitmapData
- type ChannelAPI
- type CollisionPoint
- type CollisionVector
- type ControlSignal
- type Display
- func (d *Display) GetHeight() int
- func (d *Display) GetRefreshRate() float32
- func (d *Display) GetWidth() int
- func (d *Display) SetFlipped(x, y bool)
- func (d *Display) SetInverted(inverted bool)
- func (d *Display) SetMosaic(x, y uint)
- func (d *Display) SetOffset(x, y int)
- func (d *Display) SetRefreshRate(rate float32)
- func (d *Display) SetScale(scale uint)
- type File
- func (f *File) Close(file *SDFile) error
- func (f *File) Flush(file *SDFile) error
- func (f *File) Mkdir(path string) error
- func (f *File) Open(path string, mode FileOptions) (*SDFile, error)
- func (f *File) Read(file *SDFile, buf []byte) (int, error)
- func (f *File) Rename(from, to string) error
- func (f *File) Seek(file *SDFile, pos int, whence int) error
- func (f *File) Stat(path string) (*FileStat, error)
- func (f *File) Tell(file *SDFile) (int, error)
- func (f *File) Unlink(path string, recursive bool) error
- func (f *File) Write(file *SDFile, buf []byte) (int, error)
- type FileOptions
- type FilePlayer
- type FileStat
- type Graphics
- func (g *Graphics) Clear(color LCDColor)
- func (g *Graphics) ClearBitmap(bitmap *LCDBitmap, bgcolor LCDColor)
- func (g *Graphics) ClearClipRect()
- func (g *Graphics) CopyBitmap(bitmap *LCDBitmap) *LCDBitmap
- func (g *Graphics) Display()
- func (g *Graphics) DrawBitmap(bitmap *LCDBitmap, x, y int, flip LCDBitmapFlip)
- func (g *Graphics) DrawEllipse(x, y, width, height, lineWidth int, startAngle, endAngle float32, ...)
- func (g *Graphics) DrawLine(x1, y1, x2, y2, width int, color LCDColor)
- func (g *Graphics) DrawRect(x, y, width, height int, color LCDColor)
- func (g *Graphics) DrawRotatedBitmap(bitmap *LCDBitmap, x, y int, ...)
- func (g *Graphics) DrawScaledBitmap(bitmap *LCDBitmap, x, y int, xscale, yscale float32)
- func (g *Graphics) DrawText(text string, x, y int) int
- func (g *Graphics) FillEllipse(x, y, width, height int, startAngle, endAngle float32, color LCDColor)
- func (g *Graphics) FillRect(x, y, width, height int, color LCDColor)
- func (g *Graphics) FillTriangle(x1, y1, x2, y2, x3, y3 int, color LCDColor)
- func (g *Graphics) FreeBitmap(bitmap *LCDBitmap)
- func (g *Graphics) FreeBitmapTable(table *LCDBitmapTable)
- func (g *Graphics) GetBitmapData(bitmap *LCDBitmap) *BitmapData
- func (g *Graphics) GetDisplayBufferBitmap() *LCDBitmap
- func (g *Graphics) GetDisplayFrame() []byte
- func (g *Graphics) GetFrame() []byte
- func (g *Graphics) GetTableBitmap(table *LCDBitmapTable, idx int) *LCDBitmap
- func (g *Graphics) GetTextWidth(font *LCDFont, text string, tracking int) int
- func (g *Graphics) LoadBitmap(path string) (*LCDBitmap, error)
- func (g *Graphics) LoadBitmapTable(path string) (*LCDBitmapTable, error)
- func (g *Graphics) LoadFont(path string) (*LCDFont, error)
- func (g *Graphics) MarkUpdatedRows(start, end int)
- func (g *Graphics) NewBitmap(width, height int, bgcolor LCDColor) *LCDBitmap
- func (g *Graphics) NewBitmapTable(count, width, height int) *LCDBitmapTable
- func (g *Graphics) NewTilemap() *LCDTileMap
- func (g *Graphics) PopContext()
- func (g *Graphics) PushContext(target *LCDBitmap)
- func (g *Graphics) SetBackgroundColor(color LCDSolidColor)
- func (g *Graphics) SetClipRect(x, y, width, height int)
- func (g *Graphics) SetDrawMode(mode LCDBitmapDrawMode) LCDBitmapDrawMode
- func (g *Graphics) SetDrawOffset(dx, dy int)
- func (g *Graphics) SetFont(font *LCDFont)
- func (g *Graphics) SetLineCapStyle(style LCDLineCapStyle)
- func (g *Graphics) SetTextTracking(tracking int)
- func (g *Graphics) TileBitmap(bitmap *LCDBitmap, x, y, width, height int, flip LCDBitmapFlip)
- type HTTPRequest
- type HTTPResponse
- type InstrumentAPI
- type JSON
- func (j *JSON) DecodeFile(file *SDFile, handler JSONDecodeHandler) error
- func (j *JSON) DecodeString(jsonStr string, handler JSONDecodeHandler) error
- func (j *JSON) NewEncoder(pretty bool) *JSONEncoder
- func (j *JSON) Parse(jsonStr string) (*JSONNode, error)
- func (j *JSON) ParseFile(file *SDFile) (*JSONNode, error)
- type JSONDecodeHandler
- type JSONEncoder
- func (e *JSONEncoder) AddArrayElement()
- func (e *JSONEncoder) Bytes() []byte
- func (e *JSONEncoder) EndArray()
- func (e *JSONEncoder) EndObject()
- func (e *JSONEncoder) Free()
- func (e *JSONEncoder) StartArray()
- func (e *JSONEncoder) StartObject()
- func (e *JSONEncoder) String() string
- func (e *JSONEncoder) WriteBool(v bool)
- func (e *JSONEncoder) WriteFloat(v float64)
- func (e *JSONEncoder) WriteInt(v int)
- func (e *JSONEncoder) WriteKey(key string)
- func (e *JSONEncoder) WriteNull()
- func (e *JSONEncoder) WriteString(s string)
- type JSONNode
- type JSONValue
- type JSONValueType
- type LCDBitmap
- type LCDBitmapDrawMode
- type LCDBitmapFlip
- type LCDBitmapTable
- type LCDColor
- type LCDFont
- type LCDLineCapStyle
- type LCDSolidColor
- type LCDSprite
- type LCDTileMap
- func (t *LCDTileMap) DrawAtPoint(x, y float32)
- func (t *LCDTileMap) Free()
- func (t *LCDTileMap) GetImageTable() *LCDBitmapTable
- func (t *LCDTileMap) GetSize() (tilesWide, tilesHigh int)
- func (t *LCDTileMap) GetTileAtPosition(x, y int) int
- func (t *LCDTileMap) SetImageTable(table *LCDBitmapTable)
- func (t *LCDTileMap) SetSize(tilesWide, tilesHigh int)
- func (t *LCDTileMap) SetTileAtPosition(x, y int, idx uint16)
- type Lua
- func (l *Lua) AddFunction(name string, callback func(args []interface{}) interface{}) error
- func (l *Lua) ArgIsNil(pos int) bool
- func (l *Lua) GetArgBool(pos int) bool
- func (l *Lua) GetArgCount() int
- func (l *Lua) GetArgFloat(pos int) float32
- func (l *Lua) GetArgInt(pos int) int
- func (l *Lua) GetArgString(pos int) string
- func (l *Lua) GetArgType(pos int) (LuaType, string)
- func (l *Lua) PushBool(val bool)
- func (l *Lua) PushFloat(val float32)
- func (l *Lua) PushInt(val int)
- func (l *Lua) PushNil()
- func (l *Lua) PushString(val string)
- type LuaType
- type MIDINote
- type Network
- type NetworkCallback
- type PDBoard
- type PDButtons
- type PDLanguage
- type PDPeripherals
- type PDPersonalBest
- type PDRect
- type PDScore
- type PDScoresList
- type PDStringEncoding
- type PDSynth
- type PDSynthInstrument
- type PDSystemEvent
- type PlaydateAPI
- type SDFile
- type SampleAPI
- type SamplePlayer
- type Scoreboards
- func (s *Scoreboards) AddScore(boardID string, value uint32, callback ScoreboardsResult)
- func (s *Scoreboards) FreeBoardsList(boards []PDBoard)
- func (s *Scoreboards) FreeScore(score *PDPersonalBest)
- func (s *Scoreboards) FreeScoresList(scores *PDScoresList)
- func (s *Scoreboards) GetPersonalBest(boardID string, callback ScoreboardsResult)
- func (s *Scoreboards) GetScoreboards(callback ScoreboardsResult)
- func (s *Scoreboards) GetScores(boardID string, callback ScoreboardsResult)
- type ScoreboardsResult
- type SequenceAPI
- func (s *SequenceAPI) GetCurrentStep(seq *SoundSequence) int
- func (s *SequenceAPI) GetTrackAtIndex(seq *SoundSequence, index uint) *SequenceTrack
- func (s *SequenceAPI) GetTrackCount(seq *SoundSequence) int
- func (s *SequenceAPI) LoadMIDIFile(seq *SoundSequence, path string) error
- func (s *SequenceAPI) NewSequence() *SoundSequence
- func (s *SequenceAPI) Play(seq *SoundSequence)
- func (s *SequenceAPI) Stop(seq *SoundSequence)
- type SequenceTrack
- type Sound
- func (s *Sound) FreeAudioSample(sample *AudioSample)
- func (s *Sound) FreeFilePlayer(player *FilePlayer)
- func (s *Sound) FreeSamplePlayer(player *SamplePlayer)
- func (s *Sound) GetDefaultChannel() *SoundChannel
- func (s *Sound) GetFilePlayerLength(player *FilePlayer) float32
- func (s *Sound) GetFilePlayerOffset(player *FilePlayer) float32
- func (s *Sound) GetFilePlayerVolume(player *FilePlayer) (left, right float32)
- func (s *Sound) GetHeadphoneState() (headphone, mic bool)
- func (s *Sound) IsFilePlayerPlaying(player *FilePlayer) bool
- func (s *Sound) IsSamplePlayerPlaying(player *SamplePlayer) bool
- func (s *Sound) LoadAudioSample(path string) *AudioSample
- func (s *Sound) LoadIntoFilePlayer(player *FilePlayer, path string) error
- func (s *Sound) NewAudioSample(length int) *AudioSample
- func (s *Sound) NewFilePlayer() *FilePlayer
- func (s *Sound) NewSamplePlayer() *SamplePlayer
- func (s *Sound) PauseFilePlayer(player *FilePlayer)
- func (s *Sound) PlayFilePlayer(player *FilePlayer, repeat int)
- func (s *Sound) PlaySamplePlayer(player *SamplePlayer, repeat int, rate float32)
- func (s *Sound) SetFilePlayerOffset(player *FilePlayer, offset float32)
- func (s *Sound) SetFilePlayerRate(player *FilePlayer, rate float32)
- func (s *Sound) SetFilePlayerVolume(player *FilePlayer, left, right float32)
- func (s *Sound) SetHeadphoneCallback(callback func(headphone, mic int))
- func (s *Sound) SetOutputsActive(headphone, speaker bool)
- func (s *Sound) SetSamplePlayerSample(player *SamplePlayer, sample *AudioSample)
- func (s *Sound) SetSamplePlayerVolume(player *SamplePlayer, left, right float32)
- func (s *Sound) StopFilePlayer(player *FilePlayer)
- func (s *Sound) StopSamplePlayer(player *SamplePlayer)
- type SoundChannel
- type SoundEffect
- type SoundSequence
- type SoundSource
- type SoundWaveform
- type Sprite
- type SpriteAPI
- func (s *SpriteAPI) AddSprite(sprite *LCDSprite)
- func (s *SpriteAPI) AllOverlappingSprites() []*LCDSprite
- func (s *SpriteAPI) CheckCollisions(sprite *LCDSprite, goalX, goalY float32) ([]SpriteCollisionInfo, float32, float32)
- func (s *SpriteAPI) ClearCollideRect(sprite *LCDSprite)
- func (s *SpriteAPI) DrawSprites()
- func (s *SpriteAPI) FreeSprite(sprite *LCDSprite)
- func (s *SpriteAPI) GetBounds(sprite *LCDSprite) PDRect
- func (s *SpriteAPI) GetCollideRect(sprite *LCDSprite) PDRect
- func (s *SpriteAPI) GetImage(sprite *LCDSprite) *LCDBitmap
- func (s *SpriteAPI) GetImageFlip(sprite *LCDSprite) LCDBitmapFlip
- func (s *SpriteAPI) GetPosition(sprite *LCDSprite) (x, y float32)
- func (s *SpriteAPI) GetSpriteCount() int
- func (s *SpriteAPI) GetTag(sprite *LCDSprite) uint8
- func (s *SpriteAPI) GetZIndex(sprite *LCDSprite) int16
- func (s *SpriteAPI) IsVisible(sprite *LCDSprite) bool
- func (s *SpriteAPI) MarkDirty(sprite *LCDSprite)
- func (s *SpriteAPI) MoveBy(sprite *LCDSprite, dx, dy float32)
- func (s *SpriteAPI) MoveTo(sprite *LCDSprite, x, y float32)
- func (s *SpriteAPI) MoveWithCollisions(sprite *LCDSprite, goalX, goalY float32) ([]SpriteCollisionInfo, float32, float32)
- func (s *SpriteAPI) NewSprite() *LCDSprite
- func (s *SpriteAPI) QuerySpriteInfoAlongLine(x1, y1, x2, y2 float32) []SpriteQueryInfo
- func (s *SpriteAPI) QuerySpritesAlongLine(x1, y1, x2, y2 float32) []*LCDSprite
- func (s *SpriteAPI) QuerySpritesAtPoint(x, y float32) []*LCDSprite
- func (s *SpriteAPI) QuerySpritesInRect(x, y, w, h float32) []*LCDSprite
- func (s *SpriteAPI) RemoveAllSprites()
- func (s *SpriteAPI) RemoveSprite(sprite *LCDSprite)
- func (s *SpriteAPI) ResetCollisionWorld()
- func (s *SpriteAPI) SetAlwaysRedraw(flag bool)
- func (s *SpriteAPI) SetBounds(sprite *LCDSprite, bounds PDRect)
- func (s *SpriteAPI) SetCollideRect(sprite *LCDSprite, collideRect PDRect)
- func (s *SpriteAPI) SetCollisionResponseFunction(sprite *LCDSprite, ...)
- func (s *SpriteAPI) SetCollisionsEnabled(sprite *LCDSprite, enabled bool)
- func (s *SpriteAPI) SetDrawFunction(sprite *LCDSprite, callback func(*LCDSprite, PDRect, PDRect))
- func (s *SpriteAPI) SetDrawMode(sprite *LCDSprite, mode LCDBitmapDrawMode)
- func (s *SpriteAPI) SetImage(sprite *LCDSprite, image *LCDBitmap, flip LCDBitmapFlip)
- func (s *SpriteAPI) SetImageFlip(sprite *LCDSprite, flip LCDBitmapFlip)
- func (s *SpriteAPI) SetOpaque(sprite *LCDSprite, opaque bool)
- func (s *SpriteAPI) SetTag(sprite *LCDSprite, tag uint8)
- func (s *SpriteAPI) SetUpdateFunction(sprite *LCDSprite, callback func(*LCDSprite))
- func (s *SpriteAPI) SetUpdatesEnabled(sprite *LCDSprite, enabled bool)
- func (s *SpriteAPI) SetVisible(sprite *LCDSprite, visible bool)
- func (s *SpriteAPI) SetZIndex(sprite *LCDSprite, z int16)
- func (s *SpriteAPI) UpdateAndDrawSprites()
- type SpriteCollisionInfo
- type SpriteCollisionResponseType
- type SpriteQueryInfo
- type SynthAPI
- func (sy *SynthAPI) Copy(synth *PDSynth) *PDSynth
- func (sy *SynthAPI) FreeSynth(synth *PDSynth)
- func (sy *SynthAPI) GetVolume(synth *PDSynth) (left, right float32)
- func (sy *SynthAPI) IsPlaying(synth *PDSynth) bool
- func (sy *SynthAPI) NewSynth() *PDSynth
- func (sy *SynthAPI) NoteOff(synth *PDSynth, when uint32)
- func (sy *SynthAPI) PlayMIDINote(synth *PDSynth, note MIDINote, vel, length float32, when uint32)
- func (sy *SynthAPI) PlayNote(synth *PDSynth, freq, vel, length float32, when uint32)
- func (sy *SynthAPI) SetAttackTime(synth *PDSynth, attack float32)
- func (sy *SynthAPI) SetDecayTime(synth *PDSynth, decay float32)
- func (sy *SynthAPI) SetReleaseTime(synth *PDSynth, release float32)
- func (sy *SynthAPI) SetSample(synth *PDSynth, sample *AudioSample, sustainStart, sustainEnd uint32)
- func (sy *SynthAPI) SetSustainLevel(synth *PDSynth, sustain float32)
- func (sy *SynthAPI) SetTranspose(synth *PDSynth, halfSteps float32)
- func (sy *SynthAPI) SetVolume(synth *PDSynth, left, right float32)
- func (sy *SynthAPI) SetWaveform(synth *PDSynth, wave SoundWaveform)
- func (sy *SynthAPI) Stop(synth *PDSynth)
- type System
- func (s *System) DrawFPS(x, y int)
- func (s *System) Error(msg string)
- func (s *System) GetAccelerometer() (x, y, z float32)
- func (s *System) GetBatteryPercentage() float32
- func (s *System) GetBatteryVoltage() float32
- func (s *System) GetButtonState() (current, pushed, released PDButtons)
- func (s *System) GetCrankAngle() float32
- func (s *System) GetCrankChange() float32
- func (s *System) GetCurrentTimeMilliseconds() uint
- func (s *System) GetFlipped() bool
- func (s *System) GetLanguage() PDLanguage
- func (s *System) GetSecondsSinceEpoch() (seconds uint, milliseconds uint)
- func (s *System) IsCrankDocked() bool
- func (s *System) LogToConsole(msg string)
- func (s *System) SetAutoLockDisabled(disabled bool)
- func (s *System) SetCrankSoundsDisabled(disabled bool) bool
- func (s *System) SetPeripheralsEnabled(mask PDPeripherals)
- func (s *System) SetUpdateCallback(callback func() int)
- type TrackAPI
- func (t *TrackAPI) GetIndexForStep(track *SequenceTrack, step uint32) int
- func (t *TrackAPI) GetNoteAtIndex(track *SequenceTrack, index int) (step, length uint32, note MIDINote, velocity float32, ok bool)
- func (t *TrackAPI) GetPolyphony(track *SequenceTrack) int
- func (t *TrackAPI) SetInstrument(track *SequenceTrack, inst *PDSynthInstrument)
Constants ¶
const ( LCDColumns = 400 LCDRows = 240 LCDRowSize = 52 // bytes per row (400 / 8 = 50, rounded up to 52) )
Display constants
Variables ¶
This section is empty.
Functions ¶
func CallUpdateCallback ¶ added in v0.2.0
func CallUpdateCallback() int
CallUpdateCallback is called from C trampoline
func SetUpdateCallback ¶ added in v0.2.0
func SetUpdateCallback(callback func() int)
Types ¶
type AudioSample ¶
type AudioSample struct {
// contains filtered or unexported fields
}
AudioSample represents an audio sample
type BitmapData ¶
BitmapData contains bitmap information
type ChannelAPI ¶
type ChannelAPI struct{}
ChannelAPI wraps channel functions
func (*ChannelAPI) AddInstrumentAsSource ¶ added in v0.1.5
func (c *ChannelAPI) AddInstrumentAsSource(channel *SoundChannel, inst *PDSynthInstrument) bool
AddInstrumentAsSource adds an instrument as a source to a channel
type CollisionPoint ¶
CollisionPoint represents a point in collision detection
type CollisionVector ¶
CollisionVector represents a vector in collision detection
type ControlSignal ¶
type ControlSignal struct {
// contains filtered or unexported fields
}
ControlSignal represents a control signal
type Display ¶
type Display struct{}
Display provides access to display settings
func (*Display) GetRefreshRate ¶
GetRefreshRate returns current refresh rate
func (*Display) SetFlipped ¶
SetFlipped sets whether display is flipped
func (*Display) SetInverted ¶
SetInverted sets whether display colors are inverted
func (*Display) SetRefreshRate ¶
SetRefreshRate sets the display refresh rate (20-50 fps)
type File ¶
type File struct{}
File provides access to file system functions
func (*File) Open ¶
func (f *File) Open(path string, mode FileOptions) (*SDFile, error)
Open opens a file
type FileOptions ¶
type FileOptions int32
FileOptions for opening files
const ( FileRead FileOptions = 1 << 0 FileReadData FileOptions = 1 << 1 FileWrite FileOptions = 1 << 2 FileAppend FileOptions = 1 << 3 )
type FilePlayer ¶ added in v0.2.0
type FilePlayer struct {
// contains filtered or unexported fields
}
FilePlayer plays audio files
type Graphics ¶
type Graphics struct{}
Graphics provides access to Playdate graphics functions
func (*Graphics) ClearBitmap ¶
ClearBitmap clears a bitmap
func (*Graphics) ClearClipRect ¶
func (g *Graphics) ClearClipRect()
ClearClipRect clears the clipping rectangle
func (*Graphics) CopyBitmap ¶
CopyBitmap copies a bitmap
func (*Graphics) DrawBitmap ¶
func (g *Graphics) DrawBitmap(bitmap *LCDBitmap, x, y int, flip LCDBitmapFlip)
DrawBitmap draws a bitmap
func (*Graphics) DrawEllipse ¶
func (g *Graphics) DrawEllipse(x, y, width, height, lineWidth int, startAngle, endAngle float32, color LCDColor)
DrawEllipse draws an ellipse outline
func (*Graphics) DrawRotatedBitmap ¶
func (g *Graphics) DrawRotatedBitmap(bitmap *LCDBitmap, x, y int, rotation, centerX, centerY, xscale, yscale float32)
DrawRotatedBitmap draws a rotated bitmap
func (*Graphics) DrawScaledBitmap ¶
DrawScaledBitmap draws a scaled bitmap
func (*Graphics) FillEllipse ¶
func (g *Graphics) FillEllipse(x, y, width, height int, startAngle, endAngle float32, color LCDColor)
FillEllipse fills an ellipse
func (*Graphics) FillTriangle ¶
FillTriangle fills a triangle
func (*Graphics) FreeBitmap ¶
FreeBitmap frees a bitmap
func (*Graphics) FreeBitmapTable ¶
func (g *Graphics) FreeBitmapTable(table *LCDBitmapTable)
FreeBitmapTable frees a bitmap table
func (*Graphics) GetBitmapData ¶
func (g *Graphics) GetBitmapData(bitmap *LCDBitmap) *BitmapData
GetBitmapData returns bitmap data information
func (*Graphics) GetDisplayBufferBitmap ¶
GetDisplayBufferBitmap returns the display buffer as a bitmap
func (*Graphics) GetDisplayFrame ¶
GetDisplayFrame returns the actual display buffer
func (*Graphics) GetTableBitmap ¶
func (g *Graphics) GetTableBitmap(table *LCDBitmapTable, idx int) *LCDBitmap
GetTableBitmap gets a bitmap from a table
func (*Graphics) GetTextWidth ¶
GetTextWidth returns the width of text
func (*Graphics) LoadBitmap ¶
LoadBitmap loads a bitmap from file
func (*Graphics) LoadBitmapTable ¶
func (g *Graphics) LoadBitmapTable(path string) (*LCDBitmapTable, error)
LoadBitmapTable loads a bitmap table from file
func (*Graphics) MarkUpdatedRows ¶
MarkUpdatedRows marks rows as needing update
func (*Graphics) NewBitmapTable ¶
func (g *Graphics) NewBitmapTable(count, width, height int) *LCDBitmapTable
NewBitmapTable creates a new bitmap table
func (*Graphics) NewTilemap ¶ added in v0.5.0
func (g *Graphics) NewTilemap() *LCDTileMap
NewTilemap creates a new tilemap
func (*Graphics) PopContext ¶
func (g *Graphics) PopContext()
PopContext pops the current drawing context
func (*Graphics) PushContext ¶
PushContext pushes a new drawing context
func (*Graphics) SetBackgroundColor ¶
func (g *Graphics) SetBackgroundColor(color LCDSolidColor)
SetBackgroundColor sets the background color
func (*Graphics) SetClipRect ¶
SetClipRect sets the clipping rectangle
func (*Graphics) SetDrawMode ¶
func (g *Graphics) SetDrawMode(mode LCDBitmapDrawMode) LCDBitmapDrawMode
SetDrawMode sets the drawing mode
func (*Graphics) SetDrawOffset ¶
SetDrawOffset sets the drawing offset
func (*Graphics) SetLineCapStyle ¶
func (g *Graphics) SetLineCapStyle(style LCDLineCapStyle)
SetLineCapStyle sets line cap style
func (*Graphics) SetTextTracking ¶
SetTextTracking sets text tracking
func (*Graphics) TileBitmap ¶
func (g *Graphics) TileBitmap(bitmap *LCDBitmap, x, y, width, height int, flip LCDBitmapFlip)
TileBitmap tiles a bitmap
type HTTPRequest ¶ added in v0.2.0
type HTTPRequest struct {
// contains filtered or unexported fields
}
HTTPRequest represents an HTTP request
type HTTPResponse ¶ added in v0.2.0
HTTPResponse represents an HTTP response
type InstrumentAPI ¶
type InstrumentAPI struct{}
InstrumentAPI wraps instrument functions
func (*InstrumentAPI) AddVoice ¶
func (i *InstrumentAPI) AddVoice(inst *PDSynthInstrument, synth *PDSynth, rangeStart, rangeEnd MIDINote, transpose float32) bool
AddVoice adds a voice to the instrument
func (*InstrumentAPI) NewInstrument ¶
func (i *InstrumentAPI) NewInstrument() *PDSynthInstrument
NewInstrument creates a new instrument
func (*InstrumentAPI) SetVolume ¶
func (i *InstrumentAPI) SetVolume(inst *PDSynthInstrument, left, right float32)
SetVolume sets the instrument volume
type JSON ¶
type JSON struct{}
JSON provides access to Playdate JSON parsing
func (*JSON) DecodeFile ¶ added in v0.4.0
func (j *JSON) DecodeFile(file *SDFile, handler JSONDecodeHandler) error
DecodeFile decodes JSON from an open file using the provided handler
func (*JSON) DecodeString ¶
func (j *JSON) DecodeString(jsonStr string, handler JSONDecodeHandler) error
DecodeString decodes a JSON string using the provided handler
func (*JSON) NewEncoder ¶
func (j *JSON) NewEncoder(pretty bool) *JSONEncoder
NewEncoder creates a new JSON encoder If pretty is true, output will be formatted with indentation
type JSONDecodeHandler ¶ added in v0.4.0
type JSONDecodeHandler interface {
// DecodeError is called when a parse error occurs
DecodeError(error string, lineNum int)
// WillDecodeSublist is called before decoding an array or table
WillDecodeSublist(name string, valueType JSONValueType)
// ShouldDecodeTableValueForKey returns true to decode this key's value
ShouldDecodeTableValueForKey(key string) bool
// DidDecodeTableValue is called after decoding a table value
DidDecodeTableValue(key string, value JSONValue)
// ShouldDecodeArrayValueAtIndex returns true to decode this index's value
ShouldDecodeArrayValueAtIndex(pos int) bool
// DidDecodeArrayValue is called after decoding an array value
DidDecodeArrayValue(pos int, value JSONValue)
// DidDecodeSublist is called after finishing an array or table
DidDecodeSublist(name string, valueType JSONValueType)
}
JSONDecodeHandler handles JSON decode events
type JSONEncoder ¶
type JSONEncoder struct {
// contains filtered or unexported fields
}
JSONEncoder encodes data to JSON format
func (*JSONEncoder) AddArrayElement ¶ added in v0.4.0
func (e *JSONEncoder) AddArrayElement()
AddArrayElement prepares for next array element
func (*JSONEncoder) Bytes ¶ added in v0.4.0
func (e *JSONEncoder) Bytes() []byte
Bytes returns the encoded JSON as bytes
func (*JSONEncoder) EndObject ¶ added in v0.4.0
func (e *JSONEncoder) EndObject()
EndObject ends a JSON object
func (*JSONEncoder) StartArray ¶
func (e *JSONEncoder) StartArray()
StartArray starts a JSON array [...]
func (*JSONEncoder) StartObject ¶ added in v0.4.0
func (e *JSONEncoder) StartObject()
StartObject starts a JSON object {...}
func (*JSONEncoder) String ¶ added in v0.4.0
func (e *JSONEncoder) String() string
String returns the encoded JSON string
func (*JSONEncoder) WriteBool ¶
func (e *JSONEncoder) WriteBool(v bool)
WriteBool writes boolean value
func (*JSONEncoder) WriteFloat ¶
func (e *JSONEncoder) WriteFloat(v float64)
WriteFloat writes float value
func (*JSONEncoder) WriteKey ¶ added in v0.4.0
func (e *JSONEncoder) WriteKey(key string)
WriteKey writes an object key (call before writing value)
func (*JSONEncoder) WriteString ¶
func (e *JSONEncoder) WriteString(s string)
WriteString writes string value
type JSONNode ¶ added in v0.4.0
type JSONNode struct {
Type JSONValueType
IntVal int
FloatVal float32
StrVal string
Array []*JSONNode
Object map[string]*JSONNode
}
JSONNode represents a JSON value in a tree structure
type JSONValue ¶
type JSONValue struct {
Type JSONValueType
Int int
Float float32
String string
}
JSONValue represents a decoded JSON value
type JSONValueType ¶
type JSONValueType int
JSONValueType represents JSON value types (matches Playdate SDK)
const ( JSONNull JSONValueType = 0 JSONTrue JSONValueType = 1 JSONFalse JSONValueType = 2 JSONInteger JSONValueType = 3 JSONFloat JSONValueType = 4 JSONString JSONValueType = 5 JSONArray JSONValueType = 6 JSONTable JSONValueType = 7 )
type LCDBitmap ¶
type LCDBitmap struct {
// contains filtered or unexported fields
}
LCDBitmap represents a bitmap image
type LCDBitmapDrawMode ¶
type LCDBitmapDrawMode int32
LCDBitmapDrawMode represents bitmap draw modes
const ( DrawModeCopy LCDBitmapDrawMode = 0 DrawModeWhiteTransp LCDBitmapDrawMode = 1 DrawModeBlackTransp LCDBitmapDrawMode = 2 DrawModeFillWhite LCDBitmapDrawMode = 3 DrawModeFillBlack LCDBitmapDrawMode = 4 DrawModeXOR LCDBitmapDrawMode = 5 DrawModeNXOR LCDBitmapDrawMode = 6 DrawModeInverted LCDBitmapDrawMode = 7 )
type LCDBitmapFlip ¶
type LCDBitmapFlip int32
LCDBitmapFlip represents bitmap flip options
const ( BitmapUnflipped LCDBitmapFlip = 0 BitmapFlippedX LCDBitmapFlip = 1 BitmapFlippedY LCDBitmapFlip = 2 BitmapFlippedXY LCDBitmapFlip = 3 )
type LCDBitmapTable ¶
type LCDBitmapTable struct {
// contains filtered or unexported fields
}
LCDBitmapTable represents a table of bitmaps
type LCDFont ¶
type LCDFont struct {
// contains filtered or unexported fields
}
LCDFont represents a font
type LCDLineCapStyle ¶
type LCDLineCapStyle int32
LCDLineCapStyle represents line cap styles
const ( LineCapStyleButt LCDLineCapStyle = 0 LineCapStyleSquare LCDLineCapStyle = 1 LineCapStyleRound LCDLineCapStyle = 2 )
type LCDSolidColor ¶
type LCDSolidColor int32
LCDSolidColor represents solid colors
const ( ColorBlack LCDSolidColor = 0 ColorWhite LCDSolidColor = 1 ColorClear LCDSolidColor = 2 ColorXOR LCDSolidColor = 3 )
type LCDTileMap ¶
type LCDTileMap struct {
// contains filtered or unexported fields
}
LCDTileMap represents a tilemap
func (*LCDTileMap) DrawAtPoint ¶ added in v0.5.0
func (t *LCDTileMap) DrawAtPoint(x, y float32)
DrawAtPoint draws the tilemap at the given position
func (*LCDTileMap) GetImageTable ¶ added in v0.5.0
func (t *LCDTileMap) GetImageTable() *LCDBitmapTable
GetImageTable gets the image table from the tilemap
func (*LCDTileMap) GetSize ¶ added in v0.5.0
func (t *LCDTileMap) GetSize() (tilesWide, tilesHigh int)
GetSize returns the size of the tilemap in tiles
func (*LCDTileMap) GetTileAtPosition ¶ added in v0.5.0
func (t *LCDTileMap) GetTileAtPosition(x, y int) int
GetTileAtPosition gets the tile index at the given position
func (*LCDTileMap) SetImageTable ¶ added in v0.5.0
func (t *LCDTileMap) SetImageTable(table *LCDBitmapTable)
SetImageTable sets the image table for the tilemap
func (*LCDTileMap) SetSize ¶ added in v0.5.0
func (t *LCDTileMap) SetSize(tilesWide, tilesHigh int)
SetSize sets the size of the tilemap in tiles
func (*LCDTileMap) SetTileAtPosition ¶ added in v0.5.0
func (t *LCDTileMap) SetTileAtPosition(x, y int, idx uint16)
SetTileAtPosition sets the tile index at the given position
type Lua ¶
type Lua struct{}
Lua provides access to Lua scripting
func (*Lua) AddFunction ¶ added in v0.2.0
AddFunction adds a Go function callable from Lua
func (*Lua) GetArgCount ¶
GetArgCount returns number of Lua arguments
func (*Lua) GetArgFloat ¶
GetArgFloat gets float argument
func (*Lua) GetArgString ¶
GetArgString gets string argument
func (*Lua) GetArgType ¶
GetArgType returns type of argument at index and class name
type Network ¶
type Network struct{}
Network provides access to network functions (Simulator only)
func (*Network) Cancel ¶ added in v0.2.0
func (n *Network) Cancel(request *HTTPRequest)
Cancel cancels a pending request
func (*Network) Get ¶ added in v0.2.0
func (n *Network) Get(url string, callback NetworkCallback) *HTTPRequest
Get performs an HTTP GET request (Simulator only)
func (*Network) Post ¶ added in v0.2.0
func (n *Network) Post(url string, body []byte, contentType string, callback NetworkCallback) *HTTPRequest
Post performs an HTTP POST request (Simulator only)
type NetworkCallback ¶ added in v0.2.0
type NetworkCallback func(response *HTTPResponse, err error)
NetworkCallback is called when a request completes
type PDLanguage ¶
type PDLanguage int32
PDLanguage represents system language
const ( LanguageEnglish PDLanguage = 0 LanguageJapanese PDLanguage = 1 )
type PDPeripherals ¶
type PDPeripherals uint32
PDPeripherals represents peripheral flags
const ( PeripheralNone PDPeripherals = 0 PeripheralAccelerometer PDPeripherals = 1 << 0 )
type PDPersonalBest ¶ added in v0.2.0
PDPersonalBest represents a personal best score
type PDScoresList ¶
PDScoresList represents a list of scores
type PDStringEncoding ¶
type PDStringEncoding int32
Text encoding types
const ( ASCIIEncoding PDStringEncoding = 0 UTF8Encoding PDStringEncoding = 1 Latin1Encoding PDStringEncoding = 2 )
type PDSynth ¶
type PDSynth struct {
// contains filtered or unexported fields
}
PDSynth represents a synthesizer
type PDSynthInstrument ¶
type PDSynthInstrument struct {
// contains filtered or unexported fields
}
PDSynthInstrument represents a synth instrument
type PDSystemEvent ¶
type PDSystemEvent int32
PDSystemEvent represents system events
const ( EventInit PDSystemEvent = 0 EventInitLua PDSystemEvent = 1 EventLock PDSystemEvent = 2 EventUnlock PDSystemEvent = 3 EventPause PDSystemEvent = 4 EventResume PDSystemEvent = 5 EventTerminate PDSystemEvent = 6 EventKeyPressed PDSystemEvent = 7 EventKeyReleased PDSystemEvent = 8 EventLowPower PDSystemEvent = 9 )
type PlaydateAPI ¶
type PlaydateAPI struct {
System *System
Graphics *Graphics
Display *Display
Sprite *SpriteAPI
File *File
Sound *Sound
Lua *Lua
JSON *JSON
Scoreboards *Scoreboards
Network *Network
// contains filtered or unexported fields
}
PlaydateAPI is the main API wrapper
func Init ¶
func Init(playdateAPI unsafe.Pointer) *PlaydateAPI
Init initializes the Playdate API with the provided C API pointer. This should be called from your eventHandler function.
type SDFile ¶
type SDFile struct {
// contains filtered or unexported fields
}
SDFile represents an open file
type SampleAPI ¶
type SampleAPI struct{}
SampleAPI wraps sample functions
func (*SampleAPI) Load ¶
func (sa *SampleAPI) Load(path string) *AudioSample
Load loads an audio sample from file
type SamplePlayer ¶
type SamplePlayer struct {
// contains filtered or unexported fields
}
SamplePlayer plays audio samples
type Scoreboards ¶
type Scoreboards struct{}
Scoreboards provides access to online scoreboards
func (*Scoreboards) AddScore ¶
func (s *Scoreboards) AddScore(boardID string, value uint32, callback ScoreboardsResult)
AddScore adds a score to a board
func (*Scoreboards) FreeBoardsList ¶
func (s *Scoreboards) FreeBoardsList(boards []PDBoard)
FreeBoardsList frees boards list
func (*Scoreboards) FreeScore ¶
func (s *Scoreboards) FreeScore(score *PDPersonalBest)
FreeScore frees a score result
func (*Scoreboards) FreeScoresList ¶
func (s *Scoreboards) FreeScoresList(scores *PDScoresList)
FreeScoresList frees scores list
func (*Scoreboards) GetPersonalBest ¶
func (s *Scoreboards) GetPersonalBest(boardID string, callback ScoreboardsResult)
GetPersonalBest gets personal best score
func (*Scoreboards) GetScoreboards ¶
func (s *Scoreboards) GetScoreboards(callback ScoreboardsResult)
GetScoreboards gets list of scoreboards
func (*Scoreboards) GetScores ¶
func (s *Scoreboards) GetScores(boardID string, callback ScoreboardsResult)
GetScores gets scores from a board
type ScoreboardsResult ¶ added in v0.2.0
type ScoreboardsResult func(result interface{}, errorMsg string)
ScoreboardsResult callback type
type SequenceAPI ¶
type SequenceAPI struct{}
SequenceAPI wraps sequence functions
func (*SequenceAPI) GetCurrentStep ¶ added in v0.1.5
func (s *SequenceAPI) GetCurrentStep(seq *SoundSequence) int
GetCurrentStep returns the current step in the sequence
func (*SequenceAPI) GetTrackAtIndex ¶
func (s *SequenceAPI) GetTrackAtIndex(seq *SoundSequence, index uint) *SequenceTrack
GetTrackAtIndex returns a track at an index
func (*SequenceAPI) GetTrackCount ¶
func (s *SequenceAPI) GetTrackCount(seq *SoundSequence) int
GetTrackCount returns the track count
func (*SequenceAPI) LoadMIDIFile ¶
func (s *SequenceAPI) LoadMIDIFile(seq *SoundSequence, path string) error
LoadMIDIFile loads a MIDI file into the sequence
func (*SequenceAPI) NewSequence ¶
func (s *SequenceAPI) NewSequence() *SoundSequence
NewSequence creates a new sequence
type SequenceTrack ¶
type SequenceTrack struct {
// contains filtered or unexported fields
}
SequenceTrack represents a track in a sequence
type Sound ¶
type Sound struct {
Channel *ChannelAPI
Sample *SampleAPI
Synth *SynthAPI
Sequence *SequenceAPI
Track *TrackAPI
Instrument *InstrumentAPI
}
Sound provides access to sound functions
func (*Sound) FreeAudioSample ¶ added in v0.2.0
func (s *Sound) FreeAudioSample(sample *AudioSample)
FreeAudioSample frees an audio sample
func (*Sound) FreeFilePlayer ¶ added in v0.2.0
func (s *Sound) FreeFilePlayer(player *FilePlayer)
FreeFilePlayer frees a file player
func (*Sound) FreeSamplePlayer ¶ added in v0.2.0
func (s *Sound) FreeSamplePlayer(player *SamplePlayer)
FreeSamplePlayer frees a sample player
func (*Sound) GetDefaultChannel ¶
func (s *Sound) GetDefaultChannel() *SoundChannel
GetDefaultChannel returns the default sound channel
func (*Sound) GetFilePlayerLength ¶ added in v0.2.0
func (s *Sound) GetFilePlayerLength(player *FilePlayer) float32
GetFilePlayerLength returns length in seconds
func (*Sound) GetFilePlayerOffset ¶ added in v0.2.0
func (s *Sound) GetFilePlayerOffset(player *FilePlayer) float32
GetFilePlayerOffset gets playback offset
func (*Sound) GetFilePlayerVolume ¶ added in v0.2.0
func (s *Sound) GetFilePlayerVolume(player *FilePlayer) (left, right float32)
GetFilePlayerVolume gets volume
func (*Sound) GetHeadphoneState ¶
GetHeadphoneState returns headphone state
func (*Sound) IsFilePlayerPlaying ¶ added in v0.2.0
func (s *Sound) IsFilePlayerPlaying(player *FilePlayer) bool
IsFilePlayerPlaying returns true if playing
func (*Sound) IsSamplePlayerPlaying ¶ added in v0.2.0
func (s *Sound) IsSamplePlayerPlaying(player *SamplePlayer) bool
IsSamplePlayerPlaying returns true if playing
func (*Sound) LoadAudioSample ¶ added in v0.2.0
func (s *Sound) LoadAudioSample(path string) *AudioSample
LoadAudioSample loads an audio sample from file
func (*Sound) LoadIntoFilePlayer ¶ added in v0.2.0
func (s *Sound) LoadIntoFilePlayer(player *FilePlayer, path string) error
LoadIntoFilePlayer loads audio into file player
func (*Sound) NewAudioSample ¶ added in v0.2.0
func (s *Sound) NewAudioSample(length int) *AudioSample
NewAudioSample creates a new audio sample
func (*Sound) NewFilePlayer ¶ added in v0.2.0
func (s *Sound) NewFilePlayer() *FilePlayer
NewFilePlayer creates a new file player
func (*Sound) NewSamplePlayer ¶ added in v0.2.0
func (s *Sound) NewSamplePlayer() *SamplePlayer
NewSamplePlayer creates a new sample player
func (*Sound) PauseFilePlayer ¶ added in v0.2.0
func (s *Sound) PauseFilePlayer(player *FilePlayer)
PauseFilePlayer pauses playback
func (*Sound) PlayFilePlayer ¶ added in v0.2.0
func (s *Sound) PlayFilePlayer(player *FilePlayer, repeat int)
PlayFilePlayer plays audio
func (*Sound) PlaySamplePlayer ¶ added in v0.2.0
func (s *Sound) PlaySamplePlayer(player *SamplePlayer, repeat int, rate float32)
PlaySamplePlayer plays the sample
func (*Sound) SetFilePlayerOffset ¶ added in v0.2.0
func (s *Sound) SetFilePlayerOffset(player *FilePlayer, offset float32)
SetFilePlayerOffset sets playback offset
func (*Sound) SetFilePlayerRate ¶ added in v0.2.0
func (s *Sound) SetFilePlayerRate(player *FilePlayer, rate float32)
SetFilePlayerRate sets playback rate
func (*Sound) SetFilePlayerVolume ¶ added in v0.2.0
func (s *Sound) SetFilePlayerVolume(player *FilePlayer, left, right float32)
SetFilePlayerVolume sets volume (0.0 - 1.0)
func (*Sound) SetHeadphoneCallback ¶ added in v0.2.0
SetHeadphoneCallback sets headphone callback (stub)
func (*Sound) SetOutputsActive ¶
SetOutputsActive sets which outputs are active
func (*Sound) SetSamplePlayerSample ¶ added in v0.2.0
func (s *Sound) SetSamplePlayerSample(player *SamplePlayer, sample *AudioSample)
SetSamplePlayerSample sets the sample to play
func (*Sound) SetSamplePlayerVolume ¶ added in v0.2.0
func (s *Sound) SetSamplePlayerVolume(player *SamplePlayer, left, right float32)
SetSamplePlayerVolume sets volume
func (*Sound) StopFilePlayer ¶ added in v0.2.0
func (s *Sound) StopFilePlayer(player *FilePlayer)
StopFilePlayer stops playback
func (*Sound) StopSamplePlayer ¶ added in v0.2.0
func (s *Sound) StopSamplePlayer(player *SamplePlayer)
StopSamplePlayer stops playback
type SoundChannel ¶
type SoundChannel struct {
// contains filtered or unexported fields
}
SoundChannel represents a sound channel
type SoundEffect ¶
type SoundEffect struct {
// contains filtered or unexported fields
}
SoundEffect represents a sound effect
type SoundSequence ¶
type SoundSequence struct {
// contains filtered or unexported fields
}
SoundSequence represents a sound sequence
type SoundSource ¶
type SoundSource struct {
// contains filtered or unexported fields
}
SoundSource represents a sound source
type SoundWaveform ¶
type SoundWaveform int32
SoundWaveform represents synth waveforms
const ( WaveformSquare SoundWaveform = 0 WaveformTriangle SoundWaveform = 1 WaveformSine SoundWaveform = 2 WaveformNoise SoundWaveform = 3 WaveformSawtooth SoundWaveform = 4 WaveformPOPhase SoundWaveform = 5 WaveformPODigital SoundWaveform = 6 WaveformPOVosim SoundWaveform = 7 )
type Sprite ¶
type Sprite struct {
// contains filtered or unexported fields
}
Sprite represents a sprite object
type SpriteAPI ¶ added in v0.2.0
type SpriteAPI struct{}
SpriteAPI provides access to sprite functions
func (*SpriteAPI) AllOverlappingSprites ¶ added in v0.2.0
AllOverlappingSprites returns all overlapping sprites
func (*SpriteAPI) CheckCollisions ¶ added in v0.2.0
func (s *SpriteAPI) CheckCollisions(sprite *LCDSprite, goalX, goalY float32) ([]SpriteCollisionInfo, float32, float32)
CheckCollisions checks for collisions without moving
func (*SpriteAPI) ClearCollideRect ¶ added in v0.2.0
ClearCollideRect clears collision rectangle
func (*SpriteAPI) DrawSprites ¶ added in v0.2.0
func (s *SpriteAPI) DrawSprites()
DrawSprites draws all sprites without updating
func (*SpriteAPI) FreeSprite ¶ added in v0.2.0
FreeSprite frees a sprite
func (*SpriteAPI) GetCollideRect ¶ added in v0.2.0
GetCollideRect returns collision rectangle
func (*SpriteAPI) GetImageFlip ¶ added in v0.2.0
func (s *SpriteAPI) GetImageFlip(sprite *LCDSprite) LCDBitmapFlip
GetImageFlip returns image flip
func (*SpriteAPI) GetPosition ¶ added in v0.2.0
GetPosition returns sprite position
func (*SpriteAPI) GetSpriteCount ¶ added in v0.2.0
GetSpriteCount returns number of sprites
func (*SpriteAPI) MoveWithCollisions ¶ added in v0.2.0
func (s *SpriteAPI) MoveWithCollisions(sprite *LCDSprite, goalX, goalY float32) ([]SpriteCollisionInfo, float32, float32)
MoveWithCollisions moves sprite with collision detection
func (*SpriteAPI) QuerySpriteInfoAlongLine ¶ added in v0.6.0
func (s *SpriteAPI) QuerySpriteInfoAlongLine(x1, y1, x2, y2 float32) []SpriteQueryInfo
QuerySpriteInfoAlongLine returns sprite query info along a line
func (*SpriteAPI) QuerySpritesAlongLine ¶ added in v0.2.0
QuerySpritesAlongLine returns sprites along a line
func (*SpriteAPI) QuerySpritesAtPoint ¶ added in v0.2.0
QuerySpritesAtPoint returns sprites at a point
func (*SpriteAPI) QuerySpritesInRect ¶ added in v0.2.0
QuerySpritesInRect returns sprites in a rectangle
func (*SpriteAPI) RemoveAllSprites ¶ added in v0.2.0
func (s *SpriteAPI) RemoveAllSprites()
RemoveAllSprites removes all sprites from display
func (*SpriteAPI) RemoveSprite ¶ added in v0.2.0
RemoveSprite removes a sprite from the display list
func (*SpriteAPI) ResetCollisionWorld ¶ added in v0.2.0
func (s *SpriteAPI) ResetCollisionWorld()
ResetCollisionWorld resets the collision world
func (*SpriteAPI) SetAlwaysRedraw ¶ added in v0.2.0
SetAlwaysRedraw sets whether sprites always redraw
func (*SpriteAPI) SetCollideRect ¶ added in v0.2.0
SetCollideRect sets collision rectangle
func (*SpriteAPI) SetCollisionResponseFunction ¶ added in v0.2.0
func (s *SpriteAPI) SetCollisionResponseFunction(sprite *LCDSprite, callback func(*LCDSprite, *LCDSprite) SpriteCollisionResponseType)
SetCollisionResponseFunction sets the sprite's collision response callback
func (*SpriteAPI) SetCollisionsEnabled ¶ added in v0.2.0
SetCollisionsEnabled enables/disables collisions
func (*SpriteAPI) SetDrawFunction ¶ added in v0.2.0
SetDrawFunction sets the sprite's draw callback
func (*SpriteAPI) SetDrawMode ¶ added in v0.2.0
func (s *SpriteAPI) SetDrawMode(sprite *LCDSprite, mode LCDBitmapDrawMode)
SetDrawMode sets sprite draw mode
func (*SpriteAPI) SetImage ¶ added in v0.2.0
func (s *SpriteAPI) SetImage(sprite *LCDSprite, image *LCDBitmap, flip LCDBitmapFlip)
SetImage sets the sprite's image
func (*SpriteAPI) SetImageFlip ¶ added in v0.2.0
func (s *SpriteAPI) SetImageFlip(sprite *LCDSprite, flip LCDBitmapFlip)
SetImageFlip sets image flip
func (*SpriteAPI) SetUpdateFunction ¶ added in v0.2.0
SetUpdateFunction sets the sprite's update callback
func (*SpriteAPI) SetUpdatesEnabled ¶ added in v0.2.0
SetUpdatesEnabled enables/disables sprite updates
func (*SpriteAPI) SetVisible ¶ added in v0.2.0
SetVisible sets sprite visibility
func (*SpriteAPI) UpdateAndDrawSprites ¶ added in v0.2.0
func (s *SpriteAPI) UpdateAndDrawSprites()
UpdateAndDrawSprites updates and draws all sprites
type SpriteCollisionInfo ¶
type SpriteCollisionInfo struct {
Sprite *LCDSprite
Other *LCDSprite
ResponseType SpriteCollisionResponseType
Overlaps bool
Ti float32
Move CollisionPoint
Normal CollisionVector
Touch CollisionPoint
SpriteRect PDRect
OtherRect PDRect
}
SpriteCollisionInfo for collision results
type SpriteCollisionResponseType ¶
type SpriteCollisionResponseType int32
SpriteCollisionResponseType represents collision response types
const ( CollisionTypeSlide SpriteCollisionResponseType = 0 CollisionTypeFreeze SpriteCollisionResponseType = 1 CollisionTypeOverlap SpriteCollisionResponseType = 2 CollisionTypeBounce SpriteCollisionResponseType = 3 )
type SpriteQueryInfo ¶
type SpriteQueryInfo struct {
Sprite *LCDSprite
Ti1 float32
Ti2 float32
EntryPoint CollisionPoint
ExitPoint CollisionPoint
}
SpriteQueryInfo contains information about a sprite intersection along a line
type SynthAPI ¶
type SynthAPI struct{}
SynthAPI wraps synth functions
func (*SynthAPI) PlayMIDINote ¶
PlayMIDINote plays a MIDI note
func (*SynthAPI) SetAttackTime ¶
SetAttackTime sets the attack time
func (*SynthAPI) SetDecayTime ¶
SetDecayTime sets the decay time
func (*SynthAPI) SetReleaseTime ¶
SetReleaseTime sets the release time
func (*SynthAPI) SetSample ¶
func (sy *SynthAPI) SetSample(synth *PDSynth, sample *AudioSample, sustainStart, sustainEnd uint32)
SetSample sets the sample for the synth
func (*SynthAPI) SetSustainLevel ¶
SetSustainLevel sets the sustain level
func (*SynthAPI) SetTranspose ¶
SetTranspose sets the transpose
func (*SynthAPI) SetWaveform ¶
func (sy *SynthAPI) SetWaveform(synth *PDSynth, wave SoundWaveform)
SetWaveform sets the waveform
type System ¶
type System struct{}
System provides access to Playdate system functions
func (*System) GetAccelerometer ¶
GetAccelerometer returns accelerometer readings
func (*System) GetBatteryPercentage ¶
GetBatteryPercentage returns battery percentage (0.0-1.0)
func (*System) GetBatteryVoltage ¶
GetBatteryVoltage returns battery voltage
func (*System) GetButtonState ¶
GetButtonState returns current, pushed, and released button states
func (*System) GetCrankAngle ¶
GetCrankAngle returns current crank angle (0-360)
func (*System) GetCrankChange ¶
GetCrankChange returns crank angle change since last call
func (*System) GetCurrentTimeMilliseconds ¶
GetCurrentTimeMilliseconds returns the current time in milliseconds
func (*System) GetFlipped ¶
GetFlipped returns true if the device is flipped
func (*System) GetLanguage ¶
func (s *System) GetLanguage() PDLanguage
GetLanguage returns the system language
func (*System) GetSecondsSinceEpoch ¶
GetSecondsSinceEpoch returns seconds and milliseconds since epoch
func (*System) IsCrankDocked ¶
IsCrankDocked returns true if crank is docked
func (*System) LogToConsole ¶
LogToConsole prints a message to the Playdate console
func (*System) SetAutoLockDisabled ¶
SetAutoLockDisabled disables/enables auto lock
func (*System) SetCrankSoundsDisabled ¶
SetCrankSoundsDisabled disables/enables crank sounds
func (*System) SetPeripheralsEnabled ¶
func (s *System) SetPeripheralsEnabled(mask PDPeripherals)
SetPeripheralsEnabled enables or disables peripherals like accelerometer
func (*System) SetUpdateCallback ¶
SetUpdateCallback sets the update callback function
type TrackAPI ¶
type TrackAPI struct{}
TrackAPI wraps track functions
func (*TrackAPI) GetIndexForStep ¶ added in v0.1.5
func (t *TrackAPI) GetIndexForStep(track *SequenceTrack, step uint32) int
GetIndexForStep returns the internal index for the step
func (*TrackAPI) GetNoteAtIndex ¶ added in v0.1.5
func (t *TrackAPI) GetNoteAtIndex(track *SequenceTrack, index int) (step, length uint32, note MIDINote, velocity float32, ok bool)
GetNoteAtIndex returns note information at the given index
func (*TrackAPI) GetPolyphony ¶ added in v0.1.5
func (t *TrackAPI) GetPolyphony(track *SequenceTrack) int
GetPolyphony returns the maximum polyphony for the track
func (*TrackAPI) SetInstrument ¶
func (t *TrackAPI) SetInstrument(track *SequenceTrack, inst *PDSynthInstrument)
SetInstrument sets the instrument for a track