I am using collage, so that the elements will be placed in the middle of the box.
import Graphics.Element exposing (show)
import Graphics.Collage exposing (collage)
textBox =
show "hello world"
main =
collage 1000 1000 [textBox]
But there is a typemismatch error at the last line as,
Graphics.Element.Element
Graphics.Collage.Form
Since, show
function returns Element
whereas collage
accepts only Form
. What other function can i use, to position the text content in the middle of the collage
?
You can convert an Element to a Form with Graphics.Collage.toForm
toForm : Element -> Form
http://package.elm-lang.org/packages/elm-lang/core/2.1.0/Graphics-Collage#toForm
Your program simply becomes
main = collage 1000 1000 [toForm textBox]
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments