Joystick position: Difference between revisions
Content added Content deleted
(added ocaml) |
(→{{header|OCaml}}: handle window resized correctly) |
||
Line 120: | Line 120: | ||
let position app x y = |
let position app x y = |
||
let |
let view = SFRenderWindow.getView app in |
||
let |
let width, height = SFView.getSize view in |
||
let |
let hw = width /. 2.0 in |
||
let hh = height /. 2.0 in |
|||
(hw +. ((x /. 100.0) *. hw), |
(hw +. ((x /. 100.0) *. hw), |
||
hh +. ((y /. 100.0) *. hh)) |
hh +. ((y /. 100.0) *. hh)) |