Skip to content

Commit

Permalink
Merge pull request #10 from andydotxyz/drivergraphics
Browse files Browse the repository at this point in the history
Move driver graphics out of main package
  • Loading branch information
HFO4 committed May 13, 2019
2 parents c8aabed + d38d483 commit 38cf886
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
6 changes: 6 additions & 0 deletions driver/gui.go
Expand Up @@ -75,6 +75,12 @@ func (lcd *LCD) NewInput(b []byte) {
}

func (lcd *LCD) Run(drawSignal chan bool) {
pixelgl.Run(func() {
lcd.run(drawSignal)
})
}

func (lcd *LCD) run(drawSignal chan bool) {
cfg := pixelgl.WindowConfig{
Title: lcd.title,
Bounds: pixel.R(0, 0, 160*3, 142*3),
Expand Down
12 changes: 4 additions & 8 deletions main.go
Expand Up @@ -7,7 +7,6 @@ import (
"github.com/HFO4/gbc-in-cloud/driver"
"github.com/HFO4/gbc-in-cloud/gb"
"github.com/HFO4/gbc-in-cloud/server"
"github.com/faiface/pixel/pixelgl"
"log"
"os"
)
Expand Down Expand Up @@ -50,8 +49,9 @@ func startGUI() {
core.SpeedMultiple = 0
core.ToggleSound = SoundOn
core.Init(ROMPath)
go core.DisplayDriver.Run(core.DrawSignal)
core.Run()

go core.Run()
core.DisplayDriver.Run(core.DrawSignal)
}

func runServer() {
Expand Down Expand Up @@ -85,7 +85,7 @@ func runServer() {
streamServer.Run()
}

func run() {
func main() {
flag.Parse()
if h {
flag.Usage()
Expand All @@ -102,7 +102,3 @@ func run() {
return
}
}

func main() {
pixelgl.Run(run)
}

0 comments on commit 38cf886

Please sign in to comment.