set up initial project, ready to work

This commit is contained in:
Francesco 2022-07-29 16:32:45 +02:00
parent be0577b9f0
commit 25c48aa1e3
4 changed files with 38 additions and 7 deletions

View File

@ -25,6 +25,7 @@ source-repository head
library
exposed-modules:
Canvas
Lib
other-modules:
Paths_amaranth

View File

@ -1,6 +1,6 @@
module Main where
import Lib
import Lib as L
main :: IO ()
main = someFunc
main = L.app

22
src/Canvas.hs Normal file
View File

@ -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

View File

@ -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