灵符lingfu

LingSys

↓ 0 downloads

Your machine's memory, GPU, motherboard and network, drawn and played in the Ling design system: LingSys, a small build for USB liquid-cooler displays, LingNet for IPv4/IPv6, DNS and packets, and a LingOS edition. 64-bit and 32-bit Windows builds included.

Keywords system-monitor, visualization, network, ipv6, gpu, lcd, lingos, ling
lingfu install LingSys
LicenseMIT
AuthorsLing Lin <taellinglin@gmail.com>
READMECode / FilesVersionsDependency GraphDependentsSecurityBuildsSettings

Code / Files (48)

lingos/hatchsys_os.ling
# ══════════════════════════════════════════════════════════════════════════════
# LingSys for LingOS: the Rings view, drawn straight to the LingOS framebuffer.
#
# LingOS userland (crates/ling-user) is deliberately small: print, math, lists, strings, the framebuffer
# (plot, plot_disc, clear), key polling and a clock. It has no windows, no files, no performance counters
# and no network stack, so none of the monitoring programs can run on it. This edition keeps the design
# (seven hue rings, crosshatched arcs, turning against each other) and moves it with a synthetic activity
# signal instead of real numbers. When LingOS grows system counters, they go where `act` is computed.
#
# Build:  ling build lingos/hatchsys_os.ling --platform lingos --out dist/lingos
# Press any key to quit.
# ══════════════════════════════════════════════════════════════════════════════

bind TAU = 6.283185307179586
bind CR = [255, 255, 255, 70, 70, 140, 235]
bind CG = [60, 150, 220, 230, 140, 100, 90]
bind CB = [70, 50, 70, 130, 255, 255, 255]

# one ring: a dim rail, then crosshatch strokes over `sweep` radians starting at `spin`
fn ring(cx, cy, r, sweep, spin, k, lit) {
    bind rr = CR[k] * lit
    bind gg = CG[k] * lit
    bind bb = CB[k] * lit
    bind n = floor(TAU * r / 3.0)
    bind i = 0
    while i < n {
        bind a = i * TAU / n
        plot(cx + r * sin(a), cy - r * cos(a), 1.0, rr * 0.35, gg * 0.35, bb * 0.35)
        bind i = i + 1
    }
    bind m = floor(sweep / 0.03)
    bind j = 0
    while j < m {
        bind a = spin + j * 0.03
        bind s = 0
        while s < 6 {
            bind rad = r - 6.0 + s * 2.0
            bind aa = a + s * 0.006
            plot(cx + rad * sin(aa), cy - rad * cos(aa), 1.0, rr, gg, bb)
            bind s = s + 1
        }
        bind j = j + 1
    }
}

bind start = do {
    open_window(0, 0, "LingSys")
    bind w = fb_w()
    bind h = fb_h()
    bind cx = w / 2.0
    bind cy = h / 2.0
    bind R = h / 2.0 - 14.0
    if w < h { bind R = w / 2.0 - 14.0 }
    bind t0 = time_now()
    bind go = 1
    while go == 1 {
        bind t = time_now() - t0
        clear(0)
        bind k = 0
        while k < 7 {
            bind act = 0.5 + 0.5 * sin(t * (0.31 + 0.17 * k) + k * 1.3)
            bind dir = 1.0
            if k % 2 == 1 { bind dir = 0.0 - 1.0 }
            ring(cx, cy, R * (1.0 - k * 0.1), (0.15 + 0.85 * act) * TAU, t * dir * (0.2 + 0.1 * k), k, 0.55 + 0.45 * act)
            bind k = k + 1
        }
        plot_disc(cx, cy, 1.0, floor(R * 0.12), 255, 220, 70)
        plot_disc(cx, cy, 1.0, floor(R * 0.1), 0, 0, 0)
        present()
        if poll_key() > 0 { bind go = 0 }
    }
    exit(0)
}

← Back to index