Compare commits
2 Commits
7460b8f793
...
399280d9c4
| Author | SHA1 | Date | |
|---|---|---|---|
| 399280d9c4 | |||
| 6a484c3a06 |
17
boot_js.ml
17
boot_js.ml
@ -40,7 +40,7 @@ let _ =
|
||||
(* File in this case is actually the CSS font name *)
|
||||
Text.create vg ~name:"sans" ~file:"sans" |> ignore ;
|
||||
webgl_ctx##clearColor 0.3 0.3 0.32 1. ;
|
||||
let rec render (time : float) =
|
||||
let render ev =
|
||||
webgl_ctx##clear
|
||||
( webgl_ctx##._COLOR_BUFFER_BIT_
|
||||
lor webgl_ctx##._DEPTH_BUFFER_BIT_
|
||||
@ -49,7 +49,7 @@ let _ =
|
||||
begin_frame vg ~width:canvas##.width ~height:canvas##.height
|
||||
~device_ratio ;
|
||||
Transform.scale vg ~x:device_ratio ~y:device_ratio ;
|
||||
Human.Display.render vg canvas##.width canvas##.height ;
|
||||
ignore Human.Panel.Ui.(panel vg Gg.P2.o test ev) ;
|
||||
(*
|
||||
Path.begin_ vg ;
|
||||
Path.rect vg ~x:40. ~y:40. ~w:320. ~h:320. ;
|
||||
@ -62,8 +62,11 @@ let _ =
|
||||
Text.set_align vg ~align:Align.(center lor middle) ;
|
||||
set_fill_color vg ~color:Color.white ;
|
||||
Text.text vg ~x:0. ~y:0. "Hello World!" ; *)
|
||||
NVG.end_frame vg ;
|
||||
Dom_html.window##requestAnimationFrame (Js.wrap_callback render)
|
||||
|> ignore in
|
||||
Dom_html.window##requestAnimationFrame (Js.wrap_callback render)
|
||||
|> ignore
|
||||
NVG.end_frame vg in
|
||||
Dom_html.window##requestAnimationFrame
|
||||
(Js.wrap_callback (fun _ -> render Human.Event.empty))
|
||||
|> ignore ;
|
||||
Dom_html.document##.onkeydown
|
||||
:= Dom.handler (fun (evt : Dom_html.keyboardEvent Js.t) ->
|
||||
render (Human.Event_js.evt_of_jskey `Press evt) ;
|
||||
Js._false )
|
||||
|
||||
13
dune
13
dune
@ -1,19 +1,22 @@
|
||||
(env
|
||||
(dev
|
||||
(flags (:standard -warn-error -A))))
|
||||
(dev (flags (:standard -warn-error -A))
|
||||
(js_of_ocaml (flags) (compilation_mode separate))))
|
||||
|
||||
(executable
|
||||
(name boot_js)
|
||||
(modes byte js)
|
||||
(preprocess (pps js_of_ocaml-ppx))
|
||||
(modules boot_js backend backend_js human)
|
||||
|
||||
(modules boot_js human)
|
||||
(libraries
|
||||
fmt
|
||||
graphv_webgl
|
||||
js_of_ocaml
|
||||
lwt
|
||||
irmin-git
|
||||
irmin-indexeddb
|
||||
; irmin-git
|
||||
; irmin-indexeddb
|
||||
zed
|
||||
gg
|
||||
|
||||
))
|
||||
|
||||
|
||||
@ -1,3 +1,2 @@
|
||||
(lang dune 2.8)
|
||||
(name komm)
|
||||
(wrapped_executables false)
|
||||
(lang dune 3.4)
|
||||
(name boot)
|
||||
|
||||
@ -17,8 +17,8 @@ div {
|
||||
}
|
||||
|
||||
canvas {
|
||||
width: 400px;
|
||||
height: 400px;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
Reference in New Issue
Block a user