diff --git a/amaranth.cabal b/amaranth.cabal index ac6ab2e..0c242d0 100644 --- a/amaranth.cabal +++ b/amaranth.cabal @@ -25,6 +25,7 @@ source-repository head library exposed-modules: + Canvas Lib other-modules: Paths_amaranth diff --git a/app/Main.hs b/app/Main.hs index de1c1ab..0fd53fc 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -1,6 +1,6 @@ module Main where -import Lib +import Lib as L main :: IO () -main = someFunc +main = L.app diff --git a/src/Canvas.hs b/src/Canvas.hs new file mode 100644 index 0000000..457bc79 --- /dev/null +++ b/src/Canvas.hs @@ -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 \ No newline at end of file diff --git a/src/Lib.hs b/src/Lib.hs index d36ff27..5393e8f 100644 --- a/src/Lib.hs +++ b/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