mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
graphics: Refactoring: remove ui goroutines
This commit is contained in:
parent
1062902872
commit
5cfefaf1a2
@ -49,13 +49,7 @@ func Init() {
|
||||
|
||||
u := &userInterface{
|
||||
window: window,
|
||||
funcs: make(chan func()),
|
||||
}
|
||||
go func() {
|
||||
for f := range u.funcs {
|
||||
f()
|
||||
}
|
||||
}()
|
||||
go func() {
|
||||
runtime.LockOSThread()
|
||||
u.window.MakeContextCurrent()
|
||||
@ -67,14 +61,8 @@ func Init() {
|
||||
}
|
||||
|
||||
func ExecOnUIThread(f func()) {
|
||||
// TODO: Rename this function: f is actually NOT executed on UI threads
|
||||
ch := make(chan struct{})
|
||||
currentUI.funcs <- func() {
|
||||
defer close(ch)
|
||||
f()
|
||||
}
|
||||
<-ch
|
||||
}
|
||||
|
||||
func Start(width, height, scale int, title string) (actualScale int, err error) {
|
||||
return currentUI.start(width, height, scale, title)
|
||||
@ -112,7 +100,6 @@ type userInterface struct {
|
||||
height int
|
||||
scale int
|
||||
actualScale int
|
||||
funcs chan func()
|
||||
}
|
||||
|
||||
func (u *userInterface) start(width, height, scale int, title string) (actualScale int, err error) {
|
||||
|
Loading…
Reference in New Issue
Block a user