summaryrefslogtreecommitdiff
path: root/psutil.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-02-19 08:10:21 -0600
committerJeff Carr <[email protected]>2024-02-19 08:10:21 -0600
commitcddced4bc8e963c9e5a2af17c8e024a52bbc3c90 (patch)
treedd1ea79c8b7e3fd2213e6319b3ae78a06a2d0441 /psutil.go
parentf4605dbbd165348362ea38b6313b0818196cc675 (diff)
compiles and runs. maybe it's a plugin? maybe not
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'psutil.go')
-rw-r--r--psutil.go25
1 files changed, 17 insertions, 8 deletions
diff --git a/psutil.go b/psutil.go
index 2fb370e..957e8dc 100644
--- a/psutil.go
+++ b/psutil.go
@@ -1,10 +1,12 @@
package main
import (
+ "io/fs"
"io/ioutil"
"github.com/faiface/pixel"
"github.com/faiface/pixel/pixelgl"
+ "go.wit.com/log"
)
// Pixel Shader utility functions
@@ -14,14 +16,13 @@ import (
//
// example:
//
-// var uTimeVar float32
-// var uMouseVar mgl32.Vec4
-//
-// EasyBindUniforms(win.GetCanvas(),
-// "u_time", &uTimeVar,
-// "u_mouse", &uMouseVar,
-// )
+// var uTimeVar float32
+// var uMouseVar mgl32.Vec4
//
+// EasyBindUniforms(win.GetCanvas(),
+// "u_time", &uTimeVar,
+// "u_mouse", &uMouseVar,
+// )
func EasyBindUniforms(c *pixelgl.Canvas, unifs ...interface{}) {
if len(unifs)%2 != 0 {
panic("needs to be divisable by 2")
@@ -46,7 +47,15 @@ func CenterWindow(win *pixelgl.Window) {
// LoadFileToString loads the contents of a file into a string
func LoadFileToString(filename string) (string, error) {
- b, err := ioutil.ReadFile(filename)
+ embedf, err1 := fs.ReadFile(glFile, filename)
+ if err1 == nil {
+ log.Println("found embedded file:", filename)
+ return string(embedf), nil
+ } else {
+ log.Println("did not find embedded file:", filename)
+ log.Println("err", err1)
+ }
+ b, err := ioutil.ReadFile("/tmp/" + filename)
if err != nil {
return "", err
}