done adding ability to change different colours in both functional core and imperative shell

This commit is contained in:
2024-12-30 04:32:15 +00:00
parent fc69a0e4c3
commit 40c5222621
5 changed files with 89 additions and 0 deletions

View File

@@ -353,6 +353,19 @@ struct
(model, drawMsg)
end
fun updateNum (model: app_type, inputNum) =
let
val oldNum = #num model
val newNum = oldNum * 10 + inputNum
val newNum = if newNum > 255 then 0 else newNum
in
(AppWith.num (model, newNum), [])
end
fun updateRed model = (AppWith.r model, [])
fun updateGreen model = (AppWith.g model, [])
fun updateBlue model = (AppWith.b model, [])
fun getSaveTrianglesMsg model =
let
val {triangles, ...} = model
@@ -409,6 +422,10 @@ struct
end
| MOUSE_LEFT_RELEASE => mouseMoveOrRelease model
| MOUSE_LEFT_CLICK => mouseLeftClick model
| NUM num => updateNum (model, num)
| KEY_R => updateRed model
| KEY_G => updateGreen model
| KEY_B => updateBlue model
| RESIZE_WINDOW {width, height} => resizeWindow (model, width, height)
| UNDO_ACTION => undoAction model
| REDO_ACTION => redoAction model