diff options
Diffstat (limited to 'src/rhlibrary')
-rw-r--r-- | src/rhlibrary/main.go | 7 | ||||
-rw-r--r-- | src/rhlibrary/mainwindow.go | 9 |
2 files changed, 9 insertions, 7 deletions
diff --git a/src/rhlibrary/main.go b/src/rhlibrary/main.go index 45c443f..1676c18 100644 --- a/src/rhlibrary/main.go +++ b/src/rhlibrary/main.go @@ -84,16 +84,13 @@ func main() { } defer db.Cleanup() - p, err := player.NewPlayer("/home/equinox/helsinki/rivenhell/contrib/rhlibrary/snd") + p, err := player.NewPlayer("/home/equinox/helsinki/rivenhell/contrib/rhlibrary/snd", rhl, rhdl) if err != nil { rhl.Println("Error initializing Player:", err) return } - pi := p.GetInterface() - pi.Load(1, 1) - pi.Play() - mw, err := NewMainWindow(640, 360) + mw, err := NewMainWindow(p.GetInterface(), 640, 360) if err != nil { rhl.Println("Error initializing Main Window:", err) return diff --git a/src/rhlibrary/mainwindow.go b/src/rhlibrary/mainwindow.go index 67620df..1d8f0be 100644 --- a/src/rhlibrary/mainwindow.go +++ b/src/rhlibrary/mainwindow.go @@ -25,6 +25,7 @@ package main import ( + "code.helsinki.at/rhrd-go/player" "github.com/gotk3/gotk3/gtk" ) @@ -33,16 +34,20 @@ func init() { } type MainWindow struct { - win *gtk.Window + win *gtk.Window + player *player.PlayerChan } func (mw *MainWindow) ShowAndRun() { mw.win.ShowAll() + mw.player.Load(1, 1) + mw.player.Play() gtk.Main() } -func NewMainWindow(width, height int) (mw *MainWindow, err error) { +func NewMainWindow(player *player.PlayerChan, width, height int) (mw *MainWindow, err error) { mw = &MainWindow{} + mw.player = player if mw.win, err = gtk.WindowNew(gtk.WINDOW_TOPLEVEL); err != nil { return } |