additional scaffolding for making RGFW main loop
This commit is contained in:
@@ -1,20 +1,51 @@
|
|||||||
structure RgfwLoop =
|
structure RgfwLoop =
|
||||||
struct
|
struct
|
||||||
fun loop window =
|
fun loop (window, app) =
|
||||||
if Rgfw.shouldCloseWindow window then
|
if Rgfw.shouldCloseWindow window then
|
||||||
Rgfw.closeWindow window
|
Rgfw.closeWindow window
|
||||||
else
|
else
|
||||||
let
|
let
|
||||||
|
val _ = Gles3.clearColor (0.89, 0.89, 0.89, 1.0)
|
||||||
|
val _ = Gles3.clear ()
|
||||||
val () = Rgfw.swapBuffers window
|
val () = Rgfw.swapBuffers window
|
||||||
in
|
in
|
||||||
loop window
|
loop (window, app)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local
|
||||||
|
fun loop (io, acc, lastCharWasNewline) =
|
||||||
|
case TextIO.inputLine io of
|
||||||
|
SOME str =>
|
||||||
|
let
|
||||||
|
val endsWithNewline =
|
||||||
|
String.size str > 0
|
||||||
|
andalso String.sub (str, String.size str - 1) = #"\n"
|
||||||
|
in
|
||||||
|
loop (io, LineGap.append (str, acc), endsWithNewline)
|
||||||
|
end
|
||||||
|
| NONE =>
|
||||||
|
if lastCharWasNewline then
|
||||||
|
LineGap.goToStart acc
|
||||||
|
else
|
||||||
|
let val acc = LineGap.append ("\n", acc)
|
||||||
|
in LineGap.goToStart acc
|
||||||
|
end
|
||||||
|
in
|
||||||
|
fun ioToLineGap (io, acc) = loop (io, acc, false)
|
||||||
|
end
|
||||||
|
|
||||||
fun main () =
|
fun main () =
|
||||||
let
|
let
|
||||||
val window = Rgfw.createWindow ("shf", 0, 0, 1920, 1080)
|
val window = Rgfw.createWindow ("shf", 0, 0, 1920, 1080)
|
||||||
|
val () = Gles3.enableDepthTest ()
|
||||||
|
|
||||||
|
(* load file intol gap buffer and create initial app *)
|
||||||
|
val io = TextIO.openIn "temp.txt"
|
||||||
|
val lineGap = ioToLineGap (io, LineGap.empty)
|
||||||
|
val _ = TextIO.closeIn io
|
||||||
|
val app = AppType.init (lineGap, 1920, 1080, Time.now ())
|
||||||
in
|
in
|
||||||
loop window
|
loop (window, app)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
77
shf-rgfw.mlb
77
shf-rgfw.mlb
@@ -1,11 +1,86 @@
|
|||||||
$(SML_LIB)/basis/basis.mlb
|
$(SML_LIB)/basis/basis.mlb
|
||||||
|
|
||||||
|
(* LIBRARIES *)
|
||||||
|
lib/brolib-sml/src/line_gap.sml
|
||||||
|
lib/brolib-sml/src/gap_set.sml
|
||||||
|
lib/cozette-sml/fonts-with-z-index/cozette-ascii.mlb
|
||||||
|
|
||||||
|
(* FUNCTIONAL CORE *)
|
||||||
|
fcore/bin-search.sml
|
||||||
|
|
||||||
|
ann
|
||||||
|
"allowVectorExps true"
|
||||||
|
in
|
||||||
|
fcore/persistent-vector.sml
|
||||||
|
end
|
||||||
|
fcore/search-list/dfa-gen.sml
|
||||||
|
fcore/search-list/search-list.sml
|
||||||
|
|
||||||
|
message-types/input-msg.sml
|
||||||
|
message-types/draw-msg.sml
|
||||||
|
message-types/mailbox-type.sml
|
||||||
|
|
||||||
|
fcore/app-type.sml
|
||||||
|
fcore/normal-mode/normal-mode-with.sml
|
||||||
|
fcore/normal-mode/normal-search-mode-with.sml
|
||||||
|
fcore/app-with.sml
|
||||||
|
|
||||||
|
fcore/text-constants.sml
|
||||||
|
ann
|
||||||
|
"allowVectorExps true"
|
||||||
|
in
|
||||||
|
fcore/cursor-dfa/make-dfa-loop.sml
|
||||||
|
fcore/cursor-dfa/vi-word-dfa.sml
|
||||||
|
fcore/cursor-dfa/vi-caps-word-dfa.sml
|
||||||
|
fcore/cursor-dfa/vi-dlr-dfa.sml
|
||||||
|
fcore/cursor-dfa/vi-l-dfa.sml
|
||||||
|
fcore/cursor-dfa/vi-h-dfa.sml
|
||||||
|
fcore/rect.sml
|
||||||
|
fcore/pipe-cursor.sml
|
||||||
|
end
|
||||||
|
fcore/text-builder/text-builder-utils.sml
|
||||||
|
fcore/text-builder/text-builder-with-cursor.sml
|
||||||
|
fcore/text-builder/text-builder-with-highlight.sml
|
||||||
|
fcore/text-builder/normal-mode-text-builder.sml
|
||||||
|
fcore/text-builder/search-bar.sml
|
||||||
|
|
||||||
|
fcore/cursor.sml
|
||||||
|
fcore/text-scroll.sml
|
||||||
|
|
||||||
|
fcore/normal-mode/normal-finish.sml
|
||||||
|
fcore/normal-mode/normal-search-finish.sml
|
||||||
|
fcore/move.sml
|
||||||
|
|
||||||
|
fcore/normal-mode/normal-move.sml
|
||||||
|
fcore/normal-mode/normal-yank.sml
|
||||||
|
fcore/normal-mode/make-normal-delete.sml
|
||||||
|
fcore/normal-mode/normal-delete.sml
|
||||||
|
fcore/normal-mode/normal-yank-delete.sml
|
||||||
|
fcore/normal-mode/normal-mode.sml
|
||||||
|
fcore/normal-mode/normal-search-mode.sml
|
||||||
|
|
||||||
|
fcore/app-update.sml
|
||||||
|
|
||||||
(* IMPERATIVE SHELL *)
|
(* IMPERATIVE SHELL *)
|
||||||
$(SML_LIB)/basis/mlton.mlb
|
$(SML_LIB)/basis/mlton.mlb
|
||||||
ann
|
ann
|
||||||
"allowFFI true"
|
"allowFFI true"
|
||||||
in
|
in
|
||||||
ffi/rgfw-import.sml
|
|
||||||
ffi/gles3-import.sml
|
ffi/gles3-import.sml
|
||||||
|
ffi/rgfw-import.sml
|
||||||
end
|
end
|
||||||
|
|
||||||
|
ann
|
||||||
|
"allowVectorExps true"
|
||||||
|
in
|
||||||
|
shell/make-mailbox.sml
|
||||||
|
end
|
||||||
|
|
||||||
|
shell/input-mailbox.sml
|
||||||
|
shell/draw-mailbox.sml
|
||||||
|
|
||||||
|
shell/exception-logger.sml
|
||||||
|
shell/updater.sml
|
||||||
|
shell/gl-shaders.sml
|
||||||
|
shell/gl-draw.sml
|
||||||
shell/rgfw-loop.sml
|
shell/rgfw-loop.sml
|
||||||
|
|||||||
Reference in New Issue
Block a user