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 <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-02-19 08:28:54 -06:00
parent cddced4bc8
commit 27b8e82e1d
3 changed files with 20 additions and 6 deletions

View File

@ -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")

14
main.go
View File

@ -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)
}

View File

@ -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":