From b0bcbd4e25febd4bfaa445a259c5034dd687ba26 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Wed, 13 Jan 2016 21:18:45 +0100 Subject: mainwindow now handles player directly 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 } -- cgit v0.10.2