import ( "math" "os" "path/filepath" "sort" "strconv" "strings" "time" rl "github.com/gen2brain/raylib-go/raylib" ) We have a global mouse offset specifically for panels that render GUI elements to a texture and then draw the texture elsewhere. var globalMouseOffset = rl.Vector2{} func GetMo
(localPath string)
| 73 | // } |
| 74 | |
| 75 | func LocalRelativePath(localPath string) string { |
| 76 | |
| 77 | // Running apps from Finder in MacOS makes the working directory the home directory, which is nice, because |
| 78 | // now I have to make this function to do what should be done anyway and give me a relative path starting from |
| 79 | // the executable so that I can load assets from the assets directory. :,) |
| 80 | |
| 81 | exePath, _ := os.Executable() |
| 82 | |
| 83 | workingDirectory := filepath.Dir(exePath) |
| 84 | |
| 85 | if globals.ReleaseMode == ReleaseModeDev { |
| 86 | // Not in release mode, so current working directory is the root. |
| 87 | workingDirectory, _ = os.Getwd() |
| 88 | } |
| 89 | |
| 90 | out := filepath.Join(workingDirectory, filepath.FromSlash(localPath)) |
| 91 | |
| 92 | return out |
| 93 | |
| 94 | } |
| 95 | |
| 96 | type Vector struct { |
| 97 | X, Y float32 |
no outgoing calls
no test coverage detected