mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-25 03:08:54 +01:00
opengl: Add Resume() and Pause()
This commit is contained in:
parent
a96a00b545
commit
f03a99e89a
@ -96,10 +96,12 @@ func (c *graphicsContext) Pause() error {
|
|||||||
if err := graphics.Finalize(ui.GLContext()); err != nil {
|
if err := graphics.Finalize(ui.GLContext()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
ui.GLContext().Pause()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *graphicsContext) Resume() error {
|
func (c *graphicsContext) Resume() error {
|
||||||
|
ui.GLContext().Resume()
|
||||||
if !c.imageTasksDone {
|
if !c.imageTasksDone {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -104,6 +104,19 @@ func (c *Context) Init() error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Context) Pause() {
|
||||||
|
c.locationCache = newLocationCache()
|
||||||
|
c.lastFramebuffer = ZeroFramebuffer
|
||||||
|
c.lastViewportWidth = 0
|
||||||
|
c.lastViewportHeight = 0
|
||||||
|
c.lastCompositeMode = CompositeModeUnknown
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Resume() {
|
||||||
|
gl.Enable(gl.BLEND)
|
||||||
|
c.BlendFunc(CompositeModeSourceOver)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Context) BlendFunc(mode CompositeMode) {
|
func (c *Context) BlendFunc(mode CompositeMode) {
|
||||||
c.RunOnContextThread(func() error {
|
c.RunOnContextThread(func() error {
|
||||||
if c.lastCompositeMode == mode {
|
if c.lastCompositeMode == mode {
|
||||||
|
@ -118,6 +118,20 @@ func (c *Context) init() {
|
|||||||
c.BlendFunc(CompositeModeSourceOver)
|
c.BlendFunc(CompositeModeSourceOver)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Context) Pause() {
|
||||||
|
c.locationCache = newLocationCache()
|
||||||
|
c.lastFramebuffer = ZeroFramebuffer
|
||||||
|
c.lastViewportWidth = 0
|
||||||
|
c.lastViewportHeight = 0
|
||||||
|
c.lastCompositeMode = CompositeModeUnknown
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Resume() {
|
||||||
|
gl := c.gl
|
||||||
|
gl.Enable(gl.BLEND)
|
||||||
|
c.BlendFunc(CompositeModeSourceOver)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Context) BlendFunc(mode CompositeMode) {
|
func (c *Context) BlendFunc(mode CompositeMode) {
|
||||||
if c.lastCompositeMode == mode {
|
if c.lastCompositeMode == mode {
|
||||||
return
|
return
|
||||||
|
@ -80,6 +80,19 @@ func NewContext() (*Context, error) {
|
|||||||
return c, nil
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *Context) Pause() {
|
||||||
|
c.locationCache = newLocationCache()
|
||||||
|
c.lastFramebuffer = ZeroFramebuffer
|
||||||
|
c.lastViewportWidth = 0
|
||||||
|
c.lastViewportHeight = 0
|
||||||
|
c.lastCompositeMode = CompositeModeUnknown
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *Context) Resume() {
|
||||||
|
c.gl.Enable(mgl.BLEND)
|
||||||
|
c.BlendFunc(CompositeModeSourceOver)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *Context) WaitUntilInitializingDone() {
|
func (c *Context) WaitUntilInitializingDone() {
|
||||||
// TODO: Call this function at an approriate place
|
// TODO: Call this function at an approriate place
|
||||||
<-c.initialized
|
<-c.initialized
|
||||||
|
Loading…
Reference in New Issue
Block a user