diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-01-13 20:18:45 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-01-13 20:18:45 (GMT) |
commit | b0bcbd4e25febd4bfaa445a259c5034dd687ba26 (patch) | |
tree | 7ac006504642b3ba837d61d28ac30e950e80dadc /src/rhlibrary | |
parent | ecfe71e1a703e7c3a2b1f35bf3639f0f6a155bc5 (diff) |
mainwindow now handles player directly
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 } |