the different direction was fruitful and we have text insertion now

This commit is contained in:
cqc
2024-05-08 17:41:41 -05:00
parent 11806042fe
commit 11b255758c
2 changed files with 274 additions and 404 deletions

View File

@ -1,6 +1,7 @@
module F = Fmt
open Tgles2
module Gv = Graphv_gles2_native
open Ogui
module GLFWExtras = struct
open Ctypes
@ -106,6 +107,20 @@ let () =
Ogui.Ui.chrcallback ui ch))
|> ignore;
F.pr "oplevel.ml: building initial page@.";
let page =
Layout.(
vbox
[
frame
(`TextEdit
(TextEdit.multiline ui
(TextBuffer.of_repo
~path:[ "README" ] (*[ ".config"; "init.ml" ] *)
~repo:rootrepo)));
])
in
F.pr "oplevel.ml: entering drawing loop@.";
let t = GLFW.getTime () |> ref in
@ -136,17 +151,12 @@ let () =
Gl.disable Gl.depth_test;
let width, height = (float win_w, float win_h) in
let box = Gg.(Box2.v V2.zero Size2.(v width height)) in
Gv.begin_frame ctx ~width ~height ~device_ratio:1.;
Perfgraph.render graph ctx (width -. 205.) 5.;
ignore
Ogui.TextEdit.(
show
(multiline
(Ogui.TextBuffer.of_repo
~path:[ ".config"; "init.ml" ]
~repo:rootrepo))
ui);
(* F.epr "box=%a@." Gg.Box2.pp box;
F.epr "Painter.layout=%a@." Gg.Box2.pp *)
Painter.layout box ui page |> ignore;
(* Demo.render_demo ctx mx my win_w win_h now !blowup data; *)
Gv.end_frame ctx;