set up initial project, ready to work
This commit is contained in:
parent
be0577b9f0
commit
25c48aa1e3
|
@ -25,6 +25,7 @@ source-repository head
|
|||
|
||||
library
|
||||
exposed-modules:
|
||||
Canvas
|
||||
Lib
|
||||
other-modules:
|
||||
Paths_amaranth
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
module Main where
|
||||
|
||||
import Lib
|
||||
import Lib as L
|
||||
|
||||
main :: IO ()
|
||||
main = someFunc
|
||||
main = L.app
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
module Canvas where
|
||||
|
||||
import Graphics.Gloss.Data.Picture ( Picture, pictures )
|
||||
import Graphics.Gloss.Interface.IO.Interact ( Event )
|
||||
|
||||
newtype Canvas = Canvas {
|
||||
items :: [Picture]
|
||||
}
|
||||
|
||||
initial :: Canvas
|
||||
initial = Canvas {
|
||||
items = []
|
||||
}
|
||||
|
||||
render :: Canvas -> Picture
|
||||
render canvas = pictures ( items canvas )
|
||||
|
||||
handle :: Event -> Canvas -> Canvas
|
||||
handle _ _ = initial
|
||||
|
||||
update :: Float -> Canvas -> Canvas
|
||||
update _ _ = initial
|
18
src/Lib.hs
18
src/Lib.hs
|
@ -1,6 +1,14 @@
|
|||
module Lib
|
||||
( someFunc
|
||||
) where
|
||||
module Lib where
|
||||
|
||||
someFunc :: IO ()
|
||||
someFunc = putStrLn "someFunc"
|
||||
import Graphics.Gloss
|
||||
import Canvas as C
|
||||
|
||||
-- Variables
|
||||
display :: Display
|
||||
display = InWindow "Amaranth" (500, 500) (0,0)
|
||||
|
||||
background :: Color
|
||||
background = white
|
||||
|
||||
app :: IO ()
|
||||
app = play Lib.display background 60 C.initial C.render C.handle C.update
|
||||
|
|
Loading…
Reference in New Issue