From c68579ccc2b03996eec6ac5c1526d6e5d20c3c78 Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Sat, 1 May 2021 16:19:40 -0400 Subject: [PATCH] started on render --- Ekitai.hs | 16 ++++++++++++---- Render.hs | 37 +++++++++++++++++++++++++++++++++++++ ekitai.1 | 11 +++++++++++ makefile | 15 +++++++++++++++ readme.md | 15 ++++++++++++++- 5 files changed, 89 insertions(+), 5 deletions(-) create mode 100644 Render.hs create mode 100644 ekitai.1 create mode 100644 makefile diff --git a/Ekitai.hs b/Ekitai.hs index 8793052..6fe1195 100644 --- a/Ekitai.hs +++ b/Ekitai.hs @@ -1,13 +1,21 @@ import System.Environment import qualified Data.Vector as V +import qualified Brick as B import Parse import Sim +import Render +-- ui :: B.Widget () +-- ui = B.str "hello" <+> B.str "World" + +-- main :: IO () 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 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 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 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 diff --git a/readme.md b/readme.md index e866d39..fe7c77e 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,17 @@ # 液体「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. -- 2.20.1