mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-11-29 21:46:11 +03:00
Merge simple demo
This commit is contained in:
commit
0c7914175a
11
brick.cabal
11
brick.cabal
@ -46,6 +46,17 @@ executable brick
|
||||
data-default,
|
||||
lens
|
||||
|
||||
executable brick-minimal
|
||||
hs-source-dirs: programs
|
||||
ghc-options: -threaded -Wall -fno-warn-unused-do-bind
|
||||
default-language: Haskell2010
|
||||
main-is: Minimal.hs
|
||||
build-depends: base,
|
||||
brick,
|
||||
vty >= 5.2.9,
|
||||
data-default,
|
||||
lens
|
||||
|
||||
executable brick-rogue
|
||||
buildable: False
|
||||
hs-source-dirs: programs
|
||||
|
7
programs/Minimal.hs
Normal file
7
programs/Minimal.hs
Normal file
@ -0,0 +1,7 @@
|
||||
module Main where
|
||||
|
||||
import Brick.Main
|
||||
import Brick.Prim
|
||||
|
||||
main :: IO ()
|
||||
main = simpleMain [Txt "Hello, world!"]
|
@ -4,6 +4,8 @@ module Brick.Main
|
||||
, defaultMain
|
||||
, defaultMainWithVty
|
||||
|
||||
, simpleMain
|
||||
|
||||
, supplyVtyEvents
|
||||
, withVty
|
||||
, runVty
|
||||
@ -30,6 +32,7 @@ import Graphics.Vty
|
||||
, nextEvent
|
||||
, mkVty
|
||||
)
|
||||
import System.Exit (exitSuccess)
|
||||
|
||||
import Brick.Prim (Prim)
|
||||
import Brick.Prim.Internal (renderFinal)
|
||||
@ -50,6 +53,13 @@ instance Default (App a e) where
|
||||
defaultMain :: App a Event -> a -> IO ()
|
||||
defaultMain = defaultMainWithVty (mkVty def)
|
||||
|
||||
simpleMain :: [Prim ()] -> IO ()
|
||||
simpleMain ls =
|
||||
let app = def { appDraw = const ls
|
||||
, appHandleEvent = const $ const exitSuccess
|
||||
}
|
||||
in defaultMain app ()
|
||||
|
||||
defaultMainWithVty :: IO Vty -> App a Event -> a -> IO ()
|
||||
defaultMainWithVty buildVty app initialState = do
|
||||
chan <- newChan
|
||||
|
Loading…
Reference in New Issue
Block a user