Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move driver graphics out of main package #10

Merged
merged 1 commit into from May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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)
}