a bit of scaffolding to prepare for adding resize callback + message types

This commit is contained in:
2024-10-06 08:18:24 +01:00
parent c5efc4640f
commit 6766fd1485
7 changed files with 19 additions and 5 deletions

4
fcore/app-type.sml Normal file
View File

@@ -0,0 +1,4 @@
structure AppType =
struct
end

View File

@@ -1,4 +1,10 @@
structure Buffer =
signature TEXT_BUILDER =
sig
val build: int * LineGap.t * int * int
-> Real32.real vector * LineGap.t
end
structure TextBuilder :> TEXT_BUILDER =
struct
val xSpace = 12
val xSpace3 = xSpace * 3
@@ -169,7 +175,7 @@ buildTextString ( startIdx, rStrHd, [], 5, 5, 5
Vector.concat acc
end
fun startBuildTextLineGap
fun build
(startLine, lineGap: LineGap.t, windowWidth, windowHeight) =
let
val lineGap = LineGap.goToLine (startLine, lineGap)

View File

@@ -157,6 +157,7 @@ typedef Pointer Objptr;
extern "C" {
#endif
MLLIB_PUBLIC(void mltonFramebufferSizeCallback (Int32 x0, Int32 x1);)
#undef MLLIB_PRIVATE
#undef MLLIB_PUBLIC

View File

@@ -14,4 +14,7 @@ struct
val (RELEASE, _) =
_symbol "RELEASE" public : ( unit -> int ) * ( int -> unit );
val RELEASE = RELEASE ()
val exportFramebufferSizeCallback =
_export "mltonFramebufferSizeCallback" public : (int * int -> unit) -> unit;
end

View File

@@ -19,11 +19,11 @@ struct
val _ = Gles3.loadGlad ()
(* upload text vector *)
val io = TextIO.openIn "fcore/buffer.sml"
val io = TextIO.openIn "fcore/text-builder.sml"
val lineGap = ioToLineGap (io, LineGap.empty)
val _ = TextIO.closeIn io
val (textVec, _) = Buffer.startBuildTextLineGap (0, lineGap, 1920, 1080)
val (textVec, _) = TextBuilder.build (0, lineGap, 1920, 1080)
val shellState = GlDraw.create window
val shellState = GlDraw.uploadText (shellState, textVec)

BIN
shf

Binary file not shown.

View File

@@ -5,7 +5,7 @@ lib/brolib-sml/src/line_gap.sml
lib/cozette-sml/fonts/cozette-ascii.mlb
(* FUNCTIONAL CORE *)
fcore/buffer.sml
fcore/text-builder.sml
(* IMPERATIVE SHELL *)
$(SML_LIB)/basis/mlton.mlb