it renders text, but wrong
This commit is contained in:
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 )
|
||||
|
||||
Reference in New Issue
Block a user