diff --git a/dotscape b/dotscape index 1f71638..63455cf 100755 Binary files a/dotscape and b/dotscape differ diff --git a/dotscape.mlb b/dotscape.mlb index 9719888..01cd0dc 100644 --- a/dotscape.mlb +++ b/dotscape.mlb @@ -3,13 +3,6 @@ $(SML_LIB)/basis/basis.mlb (* FUNCTIONAL CORE *) fcore/app-type.sml -ann - "allowVectorExps true" -in - fcore/ndc.sml - cozette-sml/fonts/cozette-ascii.mlb -end - fcore/graph-lines.sml fcore/click-points.sml fcore/app-init.sml @@ -34,21 +27,6 @@ fcore/parse-file.sml $(SML_LIB)/basis/mlton.mlb $(SML_LIB)/cml/cml.mlb -ann - "allowFFI true" -in - ffi/gles3-import.sml - ffi/glfw-import.sml - ffi/glfw-input.sml -end - -ann - "allowVectorExps true" -in - imperative-shell/constants.sml - imperative-shell/app-draw.sml -end - imperative-shell/input-callbacks.sml imperative-shell/update-thread.sml diff --git a/fcore/normal-mode.sml b/fcore/normal-mode.sml index 10b372c..aabe189 100644 --- a/fcore/normal-mode.sml +++ b/fcore/normal-mode.sml @@ -134,7 +134,7 @@ struct fun realToInt x = Real32.toInt IEEEReal.TO_NEAREST x - fun addCoordinates (model: app_type, hIdx, vIdx) = + fun changeSquare (model: app_type, hIdx, vIdx, fModel) = let val { windowWidth @@ -149,7 +149,7 @@ struct val xpos = Vector.sub (xClickPoints, hIdx) val ypos = Vector.sub (yClickPoints, vIdx) - val model = AppWith.addSquare (model, hIdx, vIdx, hIdx, vIdx) + val model = fModel (model, hIdx, vIdx, hIdx, vIdx) val squares = #squares model val dotVec = getDotVecFromIndices (model, hIdx, vIdx) @@ -170,6 +170,9 @@ struct (model, [DRAW drawMsg]) end + fun addCoordinates (model, hIdx, vIdx) = + changeSquare (model, hIdx, vIdx, AppWith.addSquare) + fun mouseLeftClick model = case ClickPoints.getClickPositionFromMouse model of SOME (hIdx, vIdx) => addCoordinates (model, hIdx, vIdx) @@ -181,40 +184,7 @@ struct end fun deletePixel (model, hIdx, vIdx) = - let - val - { windowWidth - , windowHeight - , xClickPoints - , yClickPoints - , canvasWidth - , canvasHeight - , ... - } = model - - val xpos = Vector.sub (xClickPoints, hIdx) - val ypos = Vector.sub (yClickPoints, vIdx) - - val model = AppWith.deleteSquare (model, hIdx, vIdx, hIdx, vIdx) - val squares = #squares model - - val dotVec = getDotVecFromIndices (model, hIdx, vIdx) - - val maxSide = Int.max (canvasWidth, canvasHeight) - val squares = CollisionTree.toTriangles - ( windowWidth - , windowHeight - , squares - , maxSide - , canvasWidth - , canvasHeight - , xClickPoints - , yClickPoints - ) - val drawMsg = DRAW_SQUARES_AND_DOTS {squares = squares, dots = dotVec} - in - (model, [DRAW drawMsg]) - end + changeSquare (model, hIdx, vIdx, AppWith.deleteSquare) fun backspace model = let val {arrowX, arrowY, ...} = model