progress in handling variable window width/height (mostly only in imperative shell though)

This commit is contained in:
2024-12-16 00:58:59 +00:00
parent cc7f30f718
commit 20c4060124
7 changed files with 39 additions and 19 deletions

View File

@@ -6,6 +6,8 @@ struct
, rightHeld = ref false
, upHeld = ref false
, downHeld = ref false
, width = ref (1920.0 : Real32.real)
, height = ref (1080.0 : Real32.real)
}
fun getSnapshot () =
@@ -15,19 +17,14 @@ struct
, downHeld = !(#downHeld state)
}
fun getPlayerXAxis () =
let
val lh = #leftHeld state
val rh = #rightHeld state
fun getWidth () =
!(#width state)
open Player
in
case (!lh, !rh) of
(false, false) => STAY_STILL
| (false, true) => MOVE_RIGHT
| (true, false) => MOVE_LEFT
| (true, true) => STAY_STILL
end
fun getHeight () =
!(#height state)
fun sizeCallback (width, height) =
(#width state := width; #height state := height)
open Input
@@ -60,6 +57,9 @@ struct
let
val () = Input.exportKeyCallback keyCallback
val () = Input.setKeyCallback window
val () = Input.exportFramebufferSizeCallback sizeCallback
val () = Input.setFramebufferSizeCallback window
in
()
end