Reputation: 2843
I am trying to set initialWindowSize
which takes a Graphics.UI.GLUT.Size
based on the output of another function with returns some Double
s.
First I stupidly plugged in my Double
s and of course I get this:
Couldn't match type `Double' with `Foreign.C.Types.CInt'
Expected type: GLsizei
Actual type: Double
In the first argument of `G.Size', namely `x'
In the second argument of `($=)', namely `G.Size x y'
In a stmt of a 'do' block: initialWindowSize $= G.Size x y
I can't seem to find any functions which will allow me to convert my Double
s into CInt
s
I tried toInteger
but I get:
Couldn't match type `Integer' with `Foreign.C.Types.CInt'
What is the right way to do this conversion?
Upvotes: 0
Views: 936
Reputation: 981
What about:
round (2.25 :: Double) :: CInt
Or even better:
round (2.25 :: Double) :: GLsizei
Upvotes: 4