Updated credits.

This commit is contained in:
Sander Schobers 2021-08-13 19:46:58 +02:00
parent 4adfdbe006
commit 3198659d11

View File

@ -36,7 +36,9 @@ func newCredits(app *appContext, ctx ui.Context) *credits {
"zntg: an abstraction for rendering (UIs)", "zntg: an abstraction for rendering (UIs)",
" - https://opslag.de/schobers/zntg", "", " - https://opslag.de/schobers/zntg", "",
"allg5: an Allegro abstraction for Go", "allg5: an Allegro abstraction for Go",
" - https://opslag.de/schobers/allg5", " - https://opslag.de/schobers/allg5", "",
"ut: a utility library",
" - https://opslag.de/schobers/ut", "",
"", "",
"**... and also using**", "**... and also using**",
"Allegro: cross-platform development library", "Allegro: cross-platform development library",
@ -58,6 +60,10 @@ func newCredits(app *appContext, ctx ui.Context) *credits {
" - https://github.com/nfnt/resize", "", " - https://github.com/nfnt/resize", "",
"testify: a testing library for Go", "testify: a testing library for Go",
" - https://github.com/stretchr/testify", "", " - https://github.com/stretchr/testify", "",
"beep: a sound library",
" - https://github.com/faiface/beep", "",
"oto: a low level sound library",
" - https://https://github.com/hajimehoshi/oto", "",
"", "",
"# THANKS", "# THANKS",
"", "",
@ -79,7 +85,9 @@ func (c *credits) Handle(ctx ui.Context, e ui.Event) bool {
s := c.content[c.hovering] s := c.content[c.hovering]
if strings.HasPrefix(s, " - https://") { if strings.HasPrefix(s, " - https://") {
url := s[3:] url := s[3:]
c.openBrowser(url) if err := c.openBrowser(url); err != nil {
log.Println(err)
}
} }
} }
case *ui.KeyDownEvent: case *ui.KeyDownEvent:
@ -146,20 +154,16 @@ func (c *credits) fonts(ctx ui.Context) []ui.Font {
return fonts return fonts
} }
func (c *credits) openBrowser(url string) { func (c *credits) openBrowser(url string) error {
var err error
switch runtime.GOOS { switch runtime.GOOS {
case "linux": case "linux":
err = exec.Command("xdg-open", url).Start() return exec.Command("xdg-open", url).Start()
case "windows": case "windows":
err = exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start() return exec.Command("rundll32", "url.dll,FileProtocolHandler", url).Start()
case "darwin": case "darwin":
err = exec.Command("open", url).Start() return exec.Command("open", url).Start()
default: default:
err = fmt.Errorf("unsupported platform") return fmt.Errorf("unsupported platform")
}
if err != nil {
log.Println(err)
} }
} }