summary refs log tree commit diff
path: root/app
diff options
context:
space:
mode:
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"
+