0
へのより多くの「情報」を与える:、ユーザーがシミュレーションにいくつかの「情報」を与えることができ、プログラムの開始時にシミュレート機能(ハスケル/グロスライブラリ)
main:: IO()
main = do
putStrLn("Hallo")
val <- getLine
startGUI(read val ::Float)
機能(startGUIを):
startGUI :: Float -> IO()
startGUI si = simulate window background fps initialState render $ moveBall si
シミュレーションのループのような機能を開始します。それは基本的にゲームを更新します。 moveBall関数が同様に定義される
:
moveBall :: Float -> Float -> PongGame -> PongGame
moveBall seconds go game = game { ballLoc = (x', y') }
...
Iが得るエラーメッセージは、次のとおりです
Couldn't match type ‘PongGame’ with ‘PongGame -> PongGame’
Expected type: ViewPort -> Float -> PongGame -> PongGame
Actual type: Float -> PongGame -> PongGame
Possible cause: ‘moveBall’ is applied to too many arguments
In the second argument of ‘($)’, namely ‘moveBall si’
In the expression:
simulate window background fps initialState render $ moveBall si
がstartGUI機能を指します。
ありがとうございます。