simplify script loading
This commit is contained in:
parent
86ef3a0e82
commit
75ba1e8134
12
cmd/root.go
12
cmd/root.go
|
@ -18,7 +18,6 @@ package cmd
|
|||
|
||||
import (
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
|
||||
|
@ -41,19 +40,10 @@ func (s *script) load(path string) error {
|
|||
}
|
||||
defer f.Close()
|
||||
|
||||
data, err := io.ReadAll(f)
|
||||
if err != nil {
|
||||
err = json.NewDecoder(f).Decode(s)
|
||||
return err
|
||||
}
|
||||
|
||||
err = json.Unmarshal(data, s)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func handleWindowEvent(event *sdl.WindowEvent, m *milkDropWindow) {
|
||||
switch event.Event {
|
||||
case sdl.WINDOWEVENT_RESIZED:
|
||||
|
|
Loading…
Reference in New Issue