mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
opengl: Refactoring
This commit is contained in:
parent
4090258904
commit
f7fa4ed8f9
@ -74,7 +74,7 @@ type Context struct {
|
||||
context
|
||||
}
|
||||
|
||||
var theContext *Context
|
||||
var theContext = &Context{}
|
||||
|
||||
func GetContext() *Context {
|
||||
return theContext
|
||||
|
@ -78,10 +78,6 @@ type context struct {
|
||||
init bool
|
||||
}
|
||||
|
||||
func init() {
|
||||
theContext = &Context{}
|
||||
}
|
||||
|
||||
func (c *Context) reset() error {
|
||||
if err := mainthread.Run(func() error {
|
||||
if c.init {
|
||||
|
@ -119,10 +119,6 @@ type context struct {
|
||||
lastProgramID programID
|
||||
}
|
||||
|
||||
func init() {
|
||||
theContext = &Context{}
|
||||
}
|
||||
|
||||
func (c *Context) ensureGL() {
|
||||
if c.gl != (js.Value{}) {
|
||||
return
|
||||
|
@ -76,15 +76,11 @@ type context struct {
|
||||
}
|
||||
|
||||
func Init() {
|
||||
c := &Context{}
|
||||
c.gl, c.worker = mgl.NewContext()
|
||||
theContext = c
|
||||
theContext.gl, theContext.worker = mgl.NewContext()
|
||||
}
|
||||
|
||||
func InitWithContext(context mgl.Context) {
|
||||
c := &Context{}
|
||||
c.gl = context
|
||||
theContext = c
|
||||
theContext.gl = context
|
||||
}
|
||||
|
||||
func (c *Context) DoWork(chError <-chan error, chDone <-chan struct{}) error {
|
||||
|
Loading…
Reference in New Issue
Block a user