From 27190e821e54517240f55fd451585023f94f7bdc Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Mon, 6 Jan 2020 10:52:48 -0500 Subject: Starting tui developpement --- main.go | 36 +++++--- ressources/TwoPoint.flf | 219 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 244 insertions(+), 11 deletions(-) create mode 100644 ressources/TwoPoint.flf diff --git a/main.go b/main.go index 2c44f8a..cbfb1d9 100644 --- a/main.go +++ b/main.go @@ -2,7 +2,8 @@ package main import ( "fmt" - "github.com/rivo/tview" + "github.com/mbndr/figlet4go" + tv "github.com/rivo/tview" ) func main() { @@ -20,16 +21,29 @@ func main() { player_two.prey = &player_one if settings.debug { - fmt.Println("# #---TESTING SEQUENCE---# #") - - app := tview.NewApplication() - flex := tview.NewFlex(). - AddItem(tview.NewBox().SetBorder(true).SetTitle("Left (1/2 x width of Top)"), 0, 1, false). - AddItem(tview.NewFlex().SetDirection(tview.FlexRow). - AddItem(tview.NewBox().SetBorder(true).SetTitle("Top"), 0, 1, false). - AddItem(tview.NewBox().SetBorder(true).SetTitle("Middle (3 x height of Top)"), 0, 3, false). - AddItem(tview.NewBox().SetBorder(true).SetTitle("Bottom (5 rows)"), 5, 1, false), 0, 2, false). - AddItem(tview.NewBox().SetBorder(true).SetTitle("Right (20 cols)"), 20, 1, false) + + ascii := figlet4go.NewAsciiRender() + + options := figlet4go.NewRenderOptions() + options.FontName = "TwoPoint" + + // If 'larry3d' wouldn't be included you would have to load your .flf files like that: + ascii.LoadFont("./ressources/") + + renderStr, _ := ascii.RenderOpts("Hello Fonts", options) + fmt.Print(renderStr) + + app := tv.NewApplication() + flex := tv.NewFlex(). + //AddItem(item, fixedSize, proportion, focus) + AddItem(tv.NewBox().SetBorder(true).SetTitle("Left (1/2 x width of Top)"), 0, 1, false). + AddItem(tv.NewFlex().SetDirection(tv.FlexRow). + AddItem(tv.NewBox().SetBorder(true).SetTitle("Top "), 0, 1, false). + AddItem(tv.NewBox().SetBorder(true).SetTitle("Middle (3 x height of Top)"), 0, 3, false). + AddItem(tv.NewBox().SetBorder(true).SetTitle("Bottom (5 rows) "), 5, 1, false), 0, 2, false). + AddItem(tv.NewFlex().SetDirection(tv.FlexRow). + AddItem(tv.NewBox().SetBorder(true).SetTitle("Gains"), 0, 1, false). + AddItem(tv.NewBox().SetBorder(true).SetTitle("Losses"), 0, 1, false), 12, 2, false) if err := app.SetRoot(flex, true).SetFocus(flex).Run(); err != nil { panic(err) } diff --git a/ressources/TwoPoint.flf b/ressources/TwoPoint.flf new file mode 100644 index 0000000..c86d0d3 --- /dev/null +++ b/ressources/TwoPoint.flf @@ -0,0 +1,219 @@ +flf2a$ 2 2 8 0 14 +twopoint by Bruce Jakeway (pbjakeway@neumann.uwaterloo.ca) +For figlet release 2.0 +Date: 1994 Aug 11 + +Explanation of first line: +flf2 - "magic number" for file identification +a - should always be `a', for now +$ - the "hardblank" -- prints as a blank, but can't be smushed +2 - height of a character +2 - height of a character, not including descenders +8 - max line length (excluding comment lines) +0 - default smushmode for this font (like "-m 15" on command line) +14 - number of comment lines + +$$@ +$$@@ +|@ +o@@ +''@ +$$@@ +++@ +++@@ +(|~@ +_|)@@ +o/@ +/o@@ + o @ +(_X@@ +)@ +$@@ +/~@ +\_@@ +~\@ +_/@@ +\|/@ +/|\@@ +$|$@ +~|~@@ +$@ +)@@ +$$@ +~~@@ +$@ +o@@ +$/@ +/$@@ +/\@ +\/@@ +'|@ +$|@@ +~)@ +/_@@ +~/@ +_)@@ +/|$@ +~|~@@ +|~@ +_)@@ + / @ +(_)@@ +~/@ +/$@@ +(~)@ +(_)@@ +(~|@ +$/$@@ +o@ +o@@ +o@ +)@@ +/@ +\@@ +--@ +--@@ +\@ +/@@ +~)@ +o$@@ + _ @ +(a)@@ +|~|@ +|~|@@ +|~)@ +|_)@@ +|~@ +|_@@ +|~\@ +|_/@@ +[~@ +[_@@ +|~@ +|~@@ +|~_@ +|_|@@ +|_|@ +| |@@ +|@ +|@@ +$|@ +_|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