wip(0.S3): packages and examples migrated again from their pre-0.S sources in one run
ludic migrate state packages <every example program> packages/ludic.lab/example/plate.ludic 1804 vars into 126 states, 64 into lets; 23498 edits in 460 files Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
5ffe50ed02
commit
19fcf60599
459 changed files with 17862 additions and 17603 deletions
|
|
@ -7,23 +7,10 @@
|
|||
module ludic_ui
|
||||
import "render3d_image.ludic"
|
||||
import "render3d_nine.ludic"
|
||||
var r3u_user: float = 1.0
|
||||
var r3u_tex_paths: []string = new []string
|
||||
var r3u_tex_ids: []int = new []int
|
||||
var r3u_tex_sizes: []int = new []int
|
||||
var r3u_tex_seen: []float = new []float
|
||||
var r3u_atlas: []string = new []string
|
||||
var r3u_atlas_tex: []int = new []int
|
||||
var r3u_atlas_cols: []int = new []int
|
||||
var r3u_atlas_rows: []int = new []int
|
||||
var r3u_atlas_names: [][]string = new [][]string
|
||||
var r3u_installed: bool = r3u_install()
|
||||
# importing this file is enough: it is the renderer from the program's first frame
|
||||
function r3u_install() -> bool {
|
||||
ui_render3d()
|
||||
return true
|
||||
}
|
||||
export function ui_render3d() -> void {
|
||||
def UiRenderers render3d { make: fn r3u_make }
|
||||
export function ui_render3d(ui_st: mut UiState) -> void { ui_backend(ui_st, r3u_make()) }
|
||||
function r3u_make() -> UiBackend {
|
||||
let b = new UiBackend
|
||||
b.rect = fn r3u_rect
|
||||
b.round = fn r3u_round
|
||||
|
|
@ -38,21 +25,21 @@ export function ui_render3d() -> void {
|
|||
b.unclip = fn r3u_unclip
|
||||
b.scale = fn r3u_scale
|
||||
b.now = fn r3u_now
|
||||
ui_backend(b)
|
||||
return b
|
||||
}
|
||||
# the player's interface size, 1.0 as designed
|
||||
export function ui_render3d_scale(s: float) -> void { r3u_user = s }
|
||||
export function ui_render3d_scale(ui_st: mut UiState, s: float) -> void { ui_st.r3u_user = s }
|
||||
# a grid atlas: `names` are its cells, row by row, `cols` across and `rows` down; <img
|
||||
# src="prefix:name"> draws one (by its name, or by its number: "item:12")
|
||||
export function ui_atlas(prefix: string, tex: int, cols: int, rows: int, names: []string) -> void {
|
||||
push(r3u_atlas, prefix)
|
||||
push(r3u_atlas_tex, tex)
|
||||
push(r3u_atlas_cols, cols)
|
||||
push(r3u_atlas_rows, Math.max(rows, 1))
|
||||
push(r3u_atlas_names, names)
|
||||
export function ui_atlas(ui_st: mut UiState, prefix: string, tex: int, cols: int, rows: int, names: []string) -> void {
|
||||
push(ui_st.r3u_atlas, prefix)
|
||||
push(ui_st.r3u_atlas_tex, tex)
|
||||
push(ui_st.r3u_atlas_cols, cols)
|
||||
push(ui_st.r3u_atlas_rows, Math.max(rows, 1))
|
||||
push(ui_st.r3u_atlas_names, names)
|
||||
}
|
||||
function r3u_now() -> float { return float(Time.now_us() / 1000) / 1000.0 }
|
||||
function r3u_scale() -> float { return float(gl_h) / 1080.0 * r3u_user }
|
||||
function r3u_scale(ui_st: UiState) -> float { return float(gl_h) / 1080.0 * ui_st.r3u_user }
|
||||
function r3u_r(c: int) -> float { return float((c / 65536) % 256) / 255.0 }
|
||||
function r3u_g(c: int) -> float { return float((c / 256) % 256) / 255.0 }
|
||||
function r3u_b(c: int) -> float { return float(c % 256) / 255.0 }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue