From 27b8e82e1d59880381fc0047f2ef90b423124a5d Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Mon, 19 Feb 2024 08:28:54 -0600 Subject: [PATCH] doesn't quite load when a plugin it works in init(), but if one tries to load it from the STDIN goroutine it flips out. something opengl related that is gone perhaps. anyway. it's a nice clean demo of opengl maybe someone that actually knows what they are doing can make a button work Signed-off-by: Jeff Carr --- config.go | 2 ++ main.go | 14 ++++++++++---- stdin.go | 10 ++++++++-- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/config.go b/config.go index 3c5fb11..8aaf309 100644 --- a/config.go +++ b/config.go @@ -38,10 +38,12 @@ func parseFlags() { var width int var height int var glDrift float64 + var guiJunk string flag.StringVar(&version, "version", "v0.1", "Set compiled in version string") flag.StringVar(&filename, "filename", "seascape.glsl", "path to GLSL file") + flag.StringVar(&guiJunk, "gui", "something", "redo all this code") flag.IntVar(&width, "width", 1024, "Width of the OpenGL Window") flag.IntVar(&height, "height", 768, "Height of the OpenGL Window") diff --git a/main.go b/main.go index 7e11f16..e56e6c4 100644 --- a/main.go +++ b/main.go @@ -14,6 +14,7 @@ import ( "go.wit.com/toolkits/tree" "github.com/faiface/pixel/pixelgl" + "github.com/gookit/config" ) //go:embed *.glsl @@ -39,9 +40,10 @@ func init() { showOptions() - // This parses the command line arguments - parseConfig() - + config.Set("width", 640) + config.Set("height", 480) + config.Set("glDrift", 0.01) + config.Set("filename", "seascape.glsl") pixelgl.Run(run) go simpleStdin() @@ -51,7 +53,11 @@ func init() { // I assume it's for testing the code in a stand alone way func main() { // This parses the command line arguments - parseConfig() + // parseConfig() + config.Set("width", 1024) + config.Set("height", 768) + config.Set("glDrift", 0.01) + config.Set("filename", "seascape.glsl") pixelgl.Run(run) } diff --git a/stdin.go b/stdin.go index fc2f2e5..47c8415 100644 --- a/stdin.go +++ b/stdin.go @@ -8,6 +8,8 @@ import ( "strconv" "strings" + "github.com/faiface/pixel/pixelgl" + "github.com/gookit/config" "go.wit.com/log" "go.wit.com/toolkits/tree" "go.wit.com/widget" @@ -18,7 +20,7 @@ func showOptions() { fmt.Println("Enter:") fmt.Println("'l': list all widgets") fmt.Println("'b': for buttons") - fmt.Println("'g': load gocui plugin") + fmt.Println("'g': try opengl") fmt.Println("'a': load andlabs plugin") fmt.Println("'d': enable debugging") fmt.Println("'p': panic plugin") @@ -57,7 +59,11 @@ func simpleStdin() { log.Log(NOW, "show buttons") tree.ShowButtons() case "g": - me.myTree.SendToolkitLoad("gocui") + config.Set("width", 1024) + config.Set("height", 768) + config.Set("glDrift", 0.01) + config.Set("filename", "seascape.glsl") + pixelgl.Run(run) case "a": me.myTree.SendToolkitLoad("andlabs") case "d":