Reintroduce apps/arcade and the ten game crates that were ripped out of
the fork (assets, audio, blocks, coedit, gen, net, pkg, render, script,
session), from makepad-internal/dev. Reconcile against the fork's layout:
- makepad-game-sim/math come from the fork's existing libs/sim + sim/math;
the copied internal libs/game/{sim,math} are dropped and the kept game
crates plus arcade point at ../../sim and ../../sim/math.
- arcade AI is rewritten off the removed makepad-ai agent API onto the
makepad-ai-hub headless ChatProvider worker (example/cad pattern):
AiWorker{send,cancel,poll}, ai_worker_loop driving
ClaudeApiChatProvider(ClaudeCli), AiWorkerEvent availability/delta/
done/error mapped into the chat feed and authoring land_edit, with
main.rs send_message/cancel_request/event-drain rebuilt around it.
- the game-script sandbox is adapted to the fork's jailed splash storage:
every isolate gets mod.fs = splash_storage jail; splaes splash_storage
set_root_for_heap is now public so the ScriptHost (or Splash) can grant
a per-game jail root. ENT font: build.rs/dispatch.rs entities fill new
fork sim Entity/Part fields via ..Default::default(); world_raycast now
borrows mutably and returns the material id.
cargo check -p makepad-arcade and the game + arcade test suites pass.
16 lines
765 B
Rust
16 lines
765 B
Rust
use makepad_game_gen::*;
|
|
fn main(){
|
|
for (name,h) in [("oak",4.0f32),("pine",5.0),("palm",6.0),("cactus",3.0)]{
|
|
let m = tree(name, TreeParams{seed:2,height:h,..Default::default()});
|
|
let (w,hh)=(37usize,17usize);
|
|
let mut grid=vec![b' ';w*hh];
|
|
let sx=m.max.x-m.min.x; let sy=m.max.y-m.min.y;
|
|
for v in m.vertices.chunks_exact(6){
|
|
let x=((v[0]-m.min.x)/sx.max(1e-6)*(w-1) as f32) as usize;
|
|
let y=((v[1]-m.min.y)/sy.max(1e-6)*(hh-1) as f32) as usize;
|
|
grid[(hh-1-y.min(hh-1))*w+x.min(w-1)]=b'#';
|
|
}
|
|
println!("--- {name} h={h} ({} tris, {:.1}x{:.1}) ---",m.triangle_count(),sx,sy);
|
|
for r in 0..hh{ println!("{}", String::from_utf8_lossy(&grid[r*w..(r+1)*w])); }
|
|
}
|
|
}
|