summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authormelody!2024-08-07 21:23:52 -0400
committermelody!2024-08-07 21:23:52 -0400
commit7133a728596918544601a18e3090281eaff34ad1 (patch)
tree79aa8aec9445372c8e6fe3f8bef723dd76cdefb3 /app
parent7a6eb573543666ef3f642f84dbb4a386429bf75e (diff)
did stuff
Diffstat (limited to 'app')
-rw-r--r--app/Main.hs36
-rw-r--r--app/Screen.hs7
2 files changed, 40 insertions, 3 deletions
diff --git a/app/Main.hs b/app/Main.hs
index 60d904e..f8e8c5f 100644
--- a/app/Main.hs
+++ b/app/Main.hs
@@ -1,8 +1,38 @@
module Main where
+import Screen
-import qualified MyLib (someFunc)
+import Beekeep
+ ( Garden
+ , newGarden
+ , gardenWidth
+ -- , gardenHeight
+ , gardenGet )
+
+printGarden' :: [(Int, Int)] -> Garden -> IO ()
+printGarden' [] _ = return ()
+printGarden' ((x,y):xs) g =
+ do
+ _ <- gardenGet g (x, y)
+ putChar 'x'
+ if x == viewportWidth then
+ putStrLn ""
+ else return ()
+ printGarden' xs g
+
+viewportWidth :: Int
+viewportWidth = 32
+
+viewportHeight :: Int
+viewportHeight = 16
+
+printGarden :: Garden -> IO ()
+printGarden = printGarden' [(x, y) |
+ y <- [1..viewportHeight],
+ x <- [1..viewportWidth]]
main :: IO ()
main = do
- putStrLn "Hello, Haskell!"
- MyLib.someFunc
+ clear
+ g <- newGarden
+ printGarden g
+
diff --git a/app/Screen.hs b/app/Screen.hs
new file mode 100644
index 0000000..9962cde
--- /dev/null
+++ b/app/Screen.hs
@@ -0,0 +1,7 @@
+module Screen
+ ( clear
+ ) where
+
+clear :: IO ()
+clear = putStr "\ESC[H\ESC[2J"
+