diff --git a/fcore/app-type.sml b/fcore/app-type.sml new file mode 100644 index 0000000..2be927f --- /dev/null +++ b/fcore/app-type.sml @@ -0,0 +1,4 @@ +structure AppType = +struct + +end diff --git a/fcore/buffer.sml b/fcore/text-builder.sml similarity index 97% rename from fcore/buffer.sml rename to fcore/text-builder.sml index 96f3bd0..fadb6ac 100644 --- a/fcore/buffer.sml +++ b/fcore/text-builder.sml @@ -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) diff --git a/ffi/export.h b/ffi/export.h index ec6f560..c210373 100644 --- a/ffi/export.h +++ b/ffi/export.h @@ -157,6 +157,7 @@ typedef Pointer Objptr; extern "C" { #endif +MLLIB_PUBLIC(void mltonFramebufferSizeCallback (Int32 x0, Int32 x1);) #undef MLLIB_PRIVATE #undef MLLIB_PUBLIC diff --git a/ffi/glfw-input.sml b/ffi/glfw-input.sml index 1759120..bb8a843 100644 --- a/ffi/glfw-input.sml +++ b/ffi/glfw-input.sml @@ -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 diff --git a/shell/shell.sml b/shell/shell.sml index 2bc1e4e..9d6c94b 100644 --- a/shell/shell.sml +++ b/shell/shell.sml @@ -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) diff --git a/shf b/shf index a2f3311..325237c 100755 Binary files a/shf and b/shf differ diff --git a/shf.mlb b/shf.mlb index 4f8b375..f0ee053 100644 --- a/shf.mlb +++ b/shf.mlb @@ -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