started on render
authorDaniel Liu <mr.picklepinosaur@gmail.com>
Sat, 1 May 2021 20:19:40 +0000 (16:19 -0400)
committerDaniel Liu <mr.picklepinosaur@gmail.com>
Sat, 1 May 2021 20:19:40 +0000 (16:19 -0400)
Ekitai.hs
Render.hs [new file with mode: 0644]
ekitai.1 [new file with mode: 0644]
makefile [new file with mode: 0644]
readme.md

index 8793052..6fe1195 100644 (file)
--- a/Ekitai.hs
+++ b/Ekitai.hs
@@ -1,13 +1,21 @@
 import System.Environment
 
 import qualified Data.Vector as V
 import System.Environment
 
 import qualified Data.Vector as V
+import qualified Brick as B
 
 import Parse
 import Sim
 
 import Parse
 import Sim
+import Render
 
 
+-- ui :: B.Widget ()
+-- ui = B.str "hello" <+> B.str "World"
+
+-- main :: IO ()
 main = do
 main = do
-    argv <- getArgs
-    (opts, fname) <- ekitaiOpts argv
-    putStrLn fname
-    return 0
+    initialState <- buildInitialState
+    endState <- B.defaultMain ekitaiApp initialState
+    print endState
+    -- argv <- getArgs
+    -- (opts, fname) <- ekitaiOpts argv
+    -- return 0
 
 
diff --git a/Render.hs b/Render.hs
new file mode 100644 (file)
index 0000000..fc321f6
--- /dev/null
+++ b/Render.hs
@@ -0,0 +1,37 @@
+module Render ( buildInitialState, ekitaiApp ) where
+
+import Brick.AttrMap
+import Brick.Main
+import Brick.Types
+import Brick.Widgets.Core
+import Graphics.Vty.Input.Events
+
+type ResourceName = String
+
+data EkitaiState =
+    EkitaiState deriving (Show)
+
+ekitaiApp :: App EkitaiState e ResourceName
+ekitaiApp = App
+    { appDraw = drawEkitai
+    , appChooseCursor = showFirstCursor
+    , appHandleEvent = handleEkitaiEvent
+    , appStartEvent = pure
+    , appAttrMap = const $ attrMap mempty []
+    }
+
+buildInitialState :: IO EkitaiState
+buildInitialState = pure EkitaiState
+
+drawEkitai :: EkitaiState -> [Widget ResourceName]
+drawEkitai state = []
+
+handleEkitaiEvent :: EkitaiState -> BrickEvent n e -> EventM n (Next EkitaiState)
+handleEkitaiEvent s e =
+    case e of
+        VtyEvent vtye ->
+            case vtye of
+                EvKey (KChar 'q') [] -> halt s
+                _ -> continue s
+        _ -> continue s 
+
diff --git a/ekitai.1 b/ekitai.1
new file mode 100644 (file)
index 0000000..0210793
--- /dev/null
+++ b/ekitai.1
@@ -0,0 +1,11 @@
+.TH EKITAI 1 2021-04-30
+.SH NAME
+ekitai \- terminal fluid simulation written in haskell
+.SH SYNOPSIS
+.B ekitai
+.SH DESCRIPTION
+.SH OPTIONS
+.SH AUTHORS
+\fBekitai\fP was written by Daniel Liu
+.SH REPORTING BUGS
+Please open an issue at https://github.com/MrPicklePinosaur/ekitai.hs
diff --git a/makefile b/makefile
new file mode 100644 (file)
index 0000000..9960bb7
--- /dev/null
+++ b/makefile
@@ -0,0 +1,15 @@
+
+HC=ghc
+DHC=ghci
+HFLAGS=-dynamic -threaded
+
+.PHONY: ekitai clean test
+
+ekitai: Ekitai.hs
+       $(HC) $(HFLAGS) --make $<
+
+test: Ekitai.hs
+       $(DHC) $<
+
+clean:
+       rm Ekitai *.o *.hi
index e866d39..fe7c77e 100644 (file)
--- a/readme.md
+++ b/readme.md
@@ -1,4 +1,17 @@
 # 液体「ekitai」
 
 # 液体「ekitai」
 
-ekitai.hs is a terminal fluid simulator written in haskell. It is a submission to RUHacks 2021.
+ekitai.hs is a terminal fluid simulator written in haskell. it is a submission to RUHacks 2021.
+
+## Installation
+### Deb based
+### Arch based
+### Build from Source
+this will be incredibly painful
+
+## FAQ
+**why ekitai?**
+ekitai is fluid in japanese. since naming your projects in a different language is apparently cool.
+
+**why not in c?**
+c would have probably been one of the best choices to do this project in, but i wanted to add a bit of challenge by using a language that i didn't know.