An audio player with transport, scrubber and volume; an equalizer and a visualizer; a playlist; a cassette, cartridge and record that turn while they play and hold where they stop; piano keys, a step sequencer and a tracker you can type into; a waveform, a 16:9 video frame, an image compare, a gallery, a filmstrip, a record button and an FM tuner. input exports SlideBase, the undrawn rail its sliders share; the gallery treats exported Bases as building blocks, not components. pixel's micro font gains '#' for notes like C#4. pixel.Pad and the slide rail read input only while their base is enabled, so Inert or a fresh Disabled stops a drag or a key already sent. AGENTS records why a drawn container keeps the DISABLED description: MyGo paints a disabled subtree at half opacity.
36 lines
861 B
Go
36 lines
861 B
Go
package media
|
||
|
||
import (
|
||
"github.com/egoist/mygo/ui"
|
||
|
||
"git.zacharyzhang.com/ZacharyZhang-NY/8bitMyGoUI/pixel"
|
||
)
|
||
|
||
type FilmstripOptions struct {
|
||
// Scale is dots per sprite dot, 1–4; zero means 2.
|
||
Scale int
|
||
}
|
||
|
||
// Filmstrip lays a sprite's frames on film with sprocket holes.
|
||
func Filmstrip(c *ui.Context, text string, sp *pixel.Sprite, o FilmstripOptions) *ui.Element {
|
||
k := pixel.K(c)
|
||
s := scale("Filmstrip", o.Scale, 2)
|
||
n := sp.Frames()
|
||
fw, fh := sp.W*s+4, sp.H*s+2
|
||
w, h := n*fw+4, fh+14
|
||
return art(c, k, text, w, h).Draw(func(p *ui.Painter, r ui.Rect) {
|
||
g := k.Canvas(p, r)
|
||
body, line := dark(k)
|
||
g.Rect(0, 0, w, h, body)
|
||
for x := 2; x+3 <= w; x += 6 {
|
||
g.Rect(x, 2, 3, 3, line)
|
||
g.Rect(x, h-5, 3, 3, line)
|
||
}
|
||
for i := range n {
|
||
x := 3 + i*fw
|
||
g.Rect(x, 7, fw-2, fh, pixel.Lit)
|
||
g.Sprite(x+1, 8, sp, i, pixel.Ink, s)
|
||
}
|
||
})
|
||
}
|