ludic.ui: a screen's nodes and envs are pooled and used again - two generations a screen, reset in place, their own lists emptied not replaced; a tree is good until its screen is built twice more (benchmark 256 -> 110 KB a frame)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
83200a453b
commit
d1c9359e96
19 changed files with 307 additions and 83 deletions
96
packages/ludic.ui/pool_reset_more.ludic
Normal file
96
packages/ludic.ui/pool_reset_more.ludic
Normal file
|
|
@ -0,0 +1,96 @@
|
|||
# pool_reset_more.ludic - the rest of a pooled node's fields, its extras and an env, to their defaults
|
||||
function nd_reset_b(n: UiNode) -> void {
|
||||
n.nowrap = false
|
||||
n.ellipsis = false
|
||||
if n.lines != null { List.clear(n.lines) }
|
||||
if n.var_names != null { List.clear(n.var_names) }
|
||||
if n.var_vals != null { List.clear(n.var_vals) }
|
||||
n.fg = -1
|
||||
n.fg_a = 1.0
|
||||
n.bg = -2
|
||||
n.bg_a = 1.0
|
||||
n.border_a = 1.0
|
||||
n.rfg_a = 1.0
|
||||
n.alpha = 1.0
|
||||
n.enabled = true
|
||||
n.act = null
|
||||
n.on_names = null
|
||||
n.on_acts = null
|
||||
n.native = null
|
||||
n.env = null
|
||||
if n.children != null { List.clear(n.children) }
|
||||
n.mw = 0.0
|
||||
n.mh = 0.0
|
||||
n.content_h = 0.0
|
||||
n.x = 0.0
|
||||
n.y = 0.0
|
||||
n.cw = 0.0
|
||||
n.ch = 0.0
|
||||
n.rsize = 0.0
|
||||
n.rfg = 0
|
||||
n.hovered = false
|
||||
n.focusable = false
|
||||
n.radius = 0.0
|
||||
n.outline_w = 0.0
|
||||
n.outline_c = -1
|
||||
n.outline_a = 1.0
|
||||
n.outline_off = 0.0
|
||||
n.scroll_y = 0.0
|
||||
n.bar_c = -1
|
||||
n.bar_track = -2
|
||||
n.opts = null
|
||||
n.bg_img = ""
|
||||
n.bi_src = ""
|
||||
n.bi_slice = 0.0
|
||||
n.bi_width = 0.0
|
||||
n.sh_x = 0.0
|
||||
n.sh_y = 0.0
|
||||
n.sh_c = -2
|
||||
n.sh_a = 1.0
|
||||
n.anim = ""
|
||||
n.anim_dur = 0.0
|
||||
n.anim_loop = false
|
||||
n.anim_alt = false
|
||||
n.tr_dur = 0.0
|
||||
n.popover = false
|
||||
if n.ex != null { nx_reset(n.ex) }
|
||||
}
|
||||
function nx_reset(x: UiNodeX) -> void {
|
||||
x.shrink = -1.0
|
||||
x.order = 0
|
||||
x.w_off = 0.0
|
||||
x.h_off = 0.0
|
||||
x.mh_min = 0.0
|
||||
x.has_min = false
|
||||
x.tsh_set = false
|
||||
x.tsh_x = 0.0
|
||||
x.tsh_y = 0.0
|
||||
x.tsh_c = -2
|
||||
x.tsh_a = 1.0
|
||||
x.no_pointer = false
|
||||
x.fit_min = 0.0
|
||||
x.lh_kind = 0
|
||||
x.lh_v = 0.0
|
||||
x.ip_t = 0.0
|
||||
x.ip_r = 0.0
|
||||
x.ip_b = 0.0
|
||||
x.ip_l = 0.0
|
||||
x.grad = null
|
||||
x.ratio = 0.0
|
||||
x.fit_obj = 0
|
||||
x.zoom = 1.0
|
||||
}
|
||||
function env_reset(e: UiEnv) -> void {
|
||||
if e.names != null { List.clear(e.names) }
|
||||
if e.vals != null { List.clear(e.vals) }
|
||||
e.state = null
|
||||
e.parent = null
|
||||
e.model = null
|
||||
e.slot = null
|
||||
e.slot_env = null
|
||||
e.on_names = null
|
||||
e.on_acts = null
|
||||
if e.on_envs != null { List.clear(e.on_envs) }
|
||||
e.ctx = null
|
||||
e.inst = null
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue