mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 19:28:57 +01:00
Use runtime.LockOSThread at main
This commit is contained in:
parent
dd979ac4d6
commit
24a735dd0b
@ -24,6 +24,7 @@ type Game interface {
|
|||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||||
|
runtime.LockOSThread()
|
||||||
|
|
||||||
gameName := ""
|
gameName := ""
|
||||||
if 2 <= len(os.Args) {
|
if 2 <= len(os.Args) {
|
||||||
|
@ -19,14 +19,9 @@ import (
|
|||||||
"github.com/hajimehoshi/go-ebiten/graphics"
|
"github.com/hajimehoshi/go-ebiten/graphics"
|
||||||
"github.com/hajimehoshi/go-ebiten/graphics/opengl"
|
"github.com/hajimehoshi/go-ebiten/graphics/opengl"
|
||||||
"github.com/hajimehoshi/go-ebiten/ui"
|
"github.com/hajimehoshi/go-ebiten/ui"
|
||||||
"runtime"
|
|
||||||
"unsafe"
|
"unsafe"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
runtime.LockOSThread()
|
|
||||||
}
|
|
||||||
|
|
||||||
type UI struct {
|
type UI struct {
|
||||||
screenWidth int
|
screenWidth int
|
||||||
screenHeight int
|
screenHeight int
|
||||||
@ -87,7 +82,7 @@ func (u *UI) LoadTextures(map[int]string) {
|
|||||||
|
|
||||||
func (u *UI) LoadResources(f func(graphics.TextureFactory)) {
|
func (u *UI) LoadResources(f func(graphics.TextureFactory)) {
|
||||||
C.BeginDrawing(u.window)
|
C.BeginDrawing(u.window)
|
||||||
f(u.graphicsDevice.TextureFactory())
|
f(u.graphicsDevice)
|
||||||
C.EndDrawing(u.window)
|
C.EndDrawing(u.window)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user