feat: port the client to MyGo native UI (0.3.0)

Switch from Asuka to MyGo, keeping the API client and the feature set:

- servers: saved servers, passwordless and password login, proxy,
  self-signed certificates, per-server device tokens (Keystore), connect
  form, instance list sheet with switch/disconnect
- sessions: virtualized list, search, new session, rename/archive/delete,
  running indicator, event stream keeps it live
- chat: pushed window with system back bar, streaming Markdown via
  ui/markdown, reasoning and tool rows with image previews, footer menu
  (read aloud via a Kotlin TTS plugin, copy, fork), user message menu
  (copy, revert, fork), context usage ring and detail sheet, attachments
  (photos/files via the document picker), permissions
- release builds allow plain http:// LAN servers (Go's net/http dials
  directly, no cleartext manifest needed)
- a local fork of MyGo (third_party/mygo) lowers the Android host's
  minSdk to 24 (Android 7.0); Go 1.27.4 via mise

Version 0.3.0.
This commit is contained in:
OpenChamber committed 2026-11-18 13:22:59 +08:00
1 parent 2fb4a8ea79
commit 6c0ee61750
2538 files changed
+675779 -4792

No files matched your search

+51
View File
@@ -0,0 +1,51 @@
package gputest
import "github.com/egoist/mygo/internal/scene"
// SpriteScene returns a w×h frame of a 2D game: layers of tiles of 16
// pixels drawn scale times as large, pixelated, from one sheet, covering
// the frame, and sprites of 16×32 over them, all ops of one image. With
// scale 3 at 1920×1080, three layers and 300 sprites, it draws 1,872
// sprites, about what a top-down farming game draws.
func SpriteScene(w, h int, scale float32, layers, sprites int) *scene.Scene {
s := &scene.Scene{Width: w, Height: h, Clear: scene.Color{R: 40, G: 44, B: 52, A: 255}}
// A sheet of 8×8 tiles of 16 pixels, each of its own colors.
const tiles, tile = 8, 16
pix := make([]byte, tiles*tile*tiles*tile*4)
for y := range tiles * tile {
for x := range tiles * tile {
i := (y*tiles*tile + x) * 4
tx, ty := x/tile, y/tile
pix[i] = byte(tx*32 + x%tile*2)
pix[i+1] = byte(ty*32 + y%tile*2)
pix[i+2] = byte((tx + ty) * 16)
pix[i+3] = 255
}
}
sheet := scene.NewImageRGBA(tiles*tile, tiles*tile, pix)
size := tile * scale
cols, rows := int(float32(w)/size)+1, int(float32(h)/size)+1
for l := range layers {
for r := range rows {
for c := range cols {
k := (r*cols + c + l*7) % (tiles * tiles)
src := scene.Rect{X: float32(k%tiles) * tile, Y: float32(k/tiles) * tile, W: tile, H: tile}
if l > 0 && (r+c+l)%3 != 0 {
continue // upper layers cover a third
}
s.Ops = append(s.Ops, scene.Op{Kind: scene.OpImage, Rect: scene.Rect{X: float32(c) * size, Y: float32(r) * size, W: size, H: size},
Image: sheet, Src: src, Pixelated: true})
}
}
}
for i := range sprites {
x := float32(i*97%max(w-int(size), 1)) + 0.5
y := float32(i*61%max(h-int(2*size), 1)) + 0.25
src := scene.Rect{X: float32(i%tiles) * tile, Y: 0, W: tile, H: 2 * tile}
if i%2 == 1 {
src.X, src.W = src.X+src.W, -src.W // facing left
}
s.Ops = append(s.Ops, scene.Op{Kind: scene.OpImage, Rect: scene.Rect{X: x, Y: y, W: size, H: 2 * size}, Image: sheet, Src: src, Pixelated: true})
}
return s
}