add N2.mli

This commit is contained in:
tali 2024-01-19 14:20:57 -05:00
parent a691757921
commit 5ce8d30f89
2 changed files with 40 additions and 1 deletions

View File

@ -32,7 +32,8 @@ let main () =
) )
in in
let ty = 400.0 in let ty = 400.0 in
Mat2A.set (TG.model root.transform) ~tx ~ty ~sx:1.0 ~sy:1.0 let tf = TG.model (Scene.transform root) in
Mat2A.set tf ~tx ~ty ~sx:1.0 ~sy:1.0
end; end;
Renderer.pre_draw ren; Renderer.pre_draw ren;

38
src/n2/n2.mli Normal file
View File

@ -0,0 +1,38 @@
open Adam
open S2
module Sexp = Sexplib0.Sexp
module Transform_graph : sig
type t
type node
val make : unit -> t
val update : t -> unit
val add : ?parent:node -> t -> node
val model : node -> mat2a
val world : node -> mat2a
end
module Sprite_graph : sig
type t
type node
val make : unit -> t
val render : t -> ren:Renderer.t -> unit
val add_rect : t -> tf:mat2a -> bb:aabb -> fill:color -> node
end
module Scene : sig
type t
type obj
val load : string ->
tg:Transform_graph.t ->
sg:Sprite_graph.t ->
t
val get : t -> string -> obj
val transform : obj -> Transform_graph.node
end