Files
beatglow/app/app.go
T

91 lines
1.6 KiB
Go

package app
import (
"image"
"github.com/BeatGlow/audio"
"github.com/BeatGlow/display"
"github.com/BeatGlow/beatglow/config"
"github.com/BeatGlow/beatglow/player"
)
type Layout interface {
String() string
// Hide the layout
Hide(Context)
// Show the layout.
Show(Context)
// IsVisible checks if the layout is active.
IsVisible() bool
// Widgets used by this screen.
Widgets() []Widget
}
type Context interface {
// Display is the display driver.
Display() display.Display
// Player is the music player.
Player() player.Player
// Track is the current track playing.
Track() *player.Track
// Show switches layout.
Show(Layout)
// Settings are the user settings.
Settings() *config.Settings
}
type Widget interface {
String() string
// Bounds is the bounding box.
Bounds() image.Rectangle
// Move the drawable to a new position on the screen.
Move(image.Point) Widget
// Resize changes the widget's size.
Resize(image.Point) Widget
// Hide the drawable.
Hide(Context) Widget
// Show the drawable.
Show(Context) Widget
// IsVisible checks if the drawable is visible.
IsVisible() bool
// Refresh redraws the widget if it's in view.
Refresh(Context) bool
}
type RotaryInputHandler interface {
HandleRotary(ctx Context, delta int)
}
type ButtonInputHandler interface {
HandleButtonPress(Context)
HandleButtonLongPress(Context)
}
type StatusChangeHandler interface {
StatusChanged(Context, *player.Status)
}
type TrackChangeHandler interface {
TrackChanged(Context, *player.Track)
}
type BufferProcessor interface {
ProcessBuffer(audio.Buffer[float64])
}