a little clean up (make the ClickPoints.getClickPosition easier for callers to use, because fewer arguments need to be passed)

This commit is contained in:
2024-08-13 23:38:04 +01:00
parent 1dccd14cfa
commit 6878f7fa58
3 changed files with 32 additions and 80 deletions

View File

@@ -2,15 +2,7 @@ signature CLICK_POINTS =
sig
val generate: int * int -> Real32.real vector
val getClickPosition:
Real32.real
* Real32.real
* Real32.real
* Real32.real
* Real32.real
* Real32.real vector
* Real32.real vector
* int
* int
Real32.real * Real32.real * Real32.real * AppType.app_type
-> Real32.real vector * Real32.real * Real32.real
end
@@ -192,27 +184,29 @@ struct
* If a square wasn't found at the clicked position,
* an empty vector is returned.
*)
fun getClickPosition
( mouseX
, mouseY
, r
, g
, b
, xClickPoints
, yClickPoints
, windowWidth
, windowHeight
) =
getHorizontalClickPos
( xClickPoints
, yClickPoints
, 0
, mouseX
, mouseY
, r
, g
, b
, windowWidth
, windowHeight
)
fun getClickPosition (r, g, b, app: AppType.app_type) =
let
val
{ xClickPoints
, yClickPoints
, mouseX
, mouseY
, windowWidth
, windowHeight
, ...
} = app
in
getHorizontalClickPos
( xClickPoints
, yClickPoints
, 0
, mouseX
, mouseY
, r
, g
, b
, windowWidth
, windowHeight
)
end
end