我正在学习如何使用Gloss库在Haskell中制作一些动画。 考虑下面其中码动画该收缩和扩大其半径随时间的圆。 import Graphics.Gloss
import Graphics.Gloss.Interface.Pure.Game
type Radius = Float
type RealTime = Float
data World = World Radius RealT
-- | Main function
main :: IO()
main = do
wall <- loadBMP "wall.bmp" -- loads wall image
play initialState drawState reactEvent reactTime
-- | Function that creates the game
play :
我有一个简单的窗口中显示两个形状像这样: import Graphics.Gloss
circles = pictures [Translate 80 0 one, Translate (-80) 0 two]
main = display (InWindow "t" (400,400) (800,0)) white circles
one = Color red $ Circle 8
我想在Haskell中使用HUnit编写一些使用Gloss图库的函数。 功能: makePicture :: Color -> Picture
makePicture c = Color c $ Circle 80
如果我显示与控制台的说法“黑”这个函数的调用你看到这样: Color (RGBA 0.0 0.0 0.0 1.0) (Circle 80.0)
其中有一个图片的类型。我的问题
在节目的开始,用户可以给模拟一些“信息”: main:: IO()
main = do
putStrLn("Hallo")
val <- getLine
startGUI(read val ::Float)
功能(startGUI): startGUI :: Float -> IO()
startGUI si = simulate window