fn main() {
println("ClosedBit ready")
u256 result = (5 + 7) * 3
save result
}
Authoring Rules
Use `.cbp` source. Library declarations go at the top. Normal line-end semicolons are optional. Keep semicolons when writing multiple statements on one line or inside C-style `for (...)` headers.
Studio Console
help
check
save
compile cba small compute threaded max_memory 1024
compile exe small fps graphics threaded usage_high
compile exe small fps graphics threaded usage_high msi
compile dll small compute
compile library small graphics threaded
decompile
encrypt
encrypt key_file D:\ClosedBit\keys\project.key
decrypt key_file D:\ClosedBit\keys\project.key
target cba
target exe
target dll
target library
- Open the Console inside ClosedBit Studio or ClosedBit Games.
- Choose the output type from the Studio toolbar, then run a build action.
- `fps`, `ai`, `graphics`, `compute`, and `threaded` select Runtime services.
- `usage_high` targets higher CPU use. `uncapped` removes resource ceilings while keeping validation and overflow checks.
- `msi` stacks only with `compile exe` and packages the standalone executable when WiX is installed.
- `encrypt` auto-builds or uses the current `.cba`; `decrypt` requires a 256-character key or `key_file`.
Programs
library CB-Math
fn main() {
u256 base = 1_000_000
u256 bonus = 250_000
u256 total = base + bonus
println("total calculated")
save total
}
Saving
Use `.cb` when the file is a validated ClosedBit storage container. Use ordinary file helpers only when plain text is the goal.
library CB-Storage
fn main() {
u256 coins = 1_000_000 + 250_000
CB-Storage.write_u256("player.cb", "coins", coins)
u256 loaded = CB-Storage.read_u256_or("player.cb", "coins", zero)
println("save file checked")
save loaded
}
UI And Games
library CB-UI
fn main() {
string html = "<h1>ClosedBit App</h1><button>Start</button>"
ui.html(html)
}
library CB-Render
library CB-Input
fn main() {
init_window(960, 540, "ClosedBit Game")
while window_open() {
handle_events()
clear(0x071018)
draw_text(24, 24, "ClosedBit", 0x64F1AC, 24)
present()
}
}
Libraries
Built-in libraries use `CB-Name`. Compiled user libraries output `.cbl` and can be used by `.cbp` and `.cba` packages.
Open every shipped library source file
library CB-Math
fn Arcade.score_bonus(u256 score, u256 multiplier) {
return score * multiplier
}
Account And License
Sign in from the Studio Settings panel or from this portal. The desktop apps protect the session with Windows DPAPI, and the compiler silently verifies product entitlement before each build. If the license service cannot be reached, Studio can use the last locally protected active license until the connection returns.