ballum-live.sleela
lib/ballum/ballum-live.sleela · 97 line(s) · sleela
#sleela 2.5
material;
< ballum-live.sleela -- the runnable live Ballum demo. Unlike ballum.sleela >
< (a self-contained model), this drives the real native Ballum manager through >
< the uiBallum* VM bridge (impl/core/ballum_vm_bridge.c over ballum/). What it >
< prints depends on the host: with a per-OS backend compiled in and a display >
< present it reports real displays and OK controls; on a headless host the >
< backend is the unavailable fallback and every op reports an honest status -- >
< never a false success. >
< >
< Capability bits (ballum_capability_t): 1 per-pixel, 2 blit, 4 brightness, >
< 8 warmth, 16 gamma. Status codes (ballum_status_t): 0 ok, 2 unavailable, >
< 5 out-of-bounds, 7 unsupported. >
class BallumLive {
< ---- Descriptive metadata (version 1.11 nested-friendly accessors) ---- >
<< Eleven catalogued attributes with getter/setter pairs, so a GUI, loader,
or catalog can read and (where appropriate) override this record.
Values are faithful to the subject's real origin where publicly known. >>
String metaVersion = "1.0.0";
int metaId = 11533;
String metaAuthor = "Kiro Agent";
String metaDate = "2026-10-23";
String metaCopyright = "SLeeLa project";
String metaTrademark = "none";
String metaCorporation = "none";
< metaOrigin: National | <nation> | International | Galactic >
String metaOrigin = "International";
String metaBirthDate = "2026-10-23";
< metaScienceRating: maturity/robustness on a 1..10 scale >
int metaScienceRating = 9;
< metaNationalSchedule: a real, citable instrument or "none" >
String metaNationalSchedule = "none";
String getMetaVersion() { return metaVersion; }
void setMetaVersion(String v) { metaVersion = v; }
int getMetaId() { return metaId; }
void setMetaId(int v) { metaId = v; }
String getAuthor() { return metaAuthor; }
void setAuthor(String v) { metaAuthor = v; }
String getDate() { return metaDate; }
void setDate(String v) { metaDate = v; }
String getCopyright() { return metaCopyright; }
void setCopyright(String v) { metaCopyright = v; }
String getTrademark() { return metaTrademark; }
void setTrademark(String v) { metaTrademark = v; }
String getCorporation() { return metaCorporation; }
void setCorporation(String v) { metaCorporation = v; }
String getOrigin() { return metaOrigin; }
void setOrigin(String v) { metaOrigin = v; }
String getBirthDate() { return metaBirthDate; }
void setBirthDate(String v) { metaBirthDate = v; }
int getScienceRating() { return metaScienceRating; }
void setScienceRating(int v) { metaScienceRating = v; }
String getNationalSchedule() { return metaNationalSchedule; }
void setNationalSchedule(String v) { metaNationalSchedule = v; }
boolean capHas(int caps, int bit) { return (caps / bit) % 2 == 1; }
void main() {
print("=== Ballum live (native display control) ===");
print("backend: " + uiBallumBackendName() + " supported=" + uiBallumSupported());
int st = uiBallumEnumerate();
print("enumerate: " + uiBallumStatusName(st));
int count = uiBallumDisplayCount();
print("displays: " + count);
int i = 0;
while (i < count) {
int id = uiBallumDisplayId(i);
int w = uiBallumDisplayWidth(i);
int h = uiBallumDisplayHeight(i);
int caps = uiBallumDisplayCaps(i);
print(" #" + i + " id=" + id + " " + uiBallumDisplayName(i)
+ " " + w + "x" + h
+ " primary=" + uiBallumDisplayPrimary(i)
+ " perPixel=" + capHas(caps, 1)
+ " brightness=" + capHas(caps, 4)
+ " warmth=" + capHas(caps, 8));
< Drive each control; the native manager validates and returns an honest >
< status. On a headless host these report 'backend unavailable'. >
print(" setPixel(0,0 red): " + uiBallumStatusName(uiBallumSetPixel(id, 0, 0, 255, 0, 0, 255)));
print(" brightness 70%: " + uiBallumStatusName(uiBallumSetBrightness(id, 70)));
print(" warmth 3400K: " + uiBallumStatusName(uiBallumSetWarmth(id, 3400)));
print(" gamma 2.20: " + uiBallumStatusName(uiBallumSetGamma(id, 220)));
i = i + 1;
}
if (count == 0) {
< No displays (e.g. headless): prove the controls still fail closed. >
print("no displays; set on id 0 -> " + uiBallumStatusName(uiBallumSetBrightness(0, 50)));
}
print("done");
}
}