mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-24 18:58:54 +01:00
Rename PushOffscreen -> PushRenderTarget
This commit is contained in:
parent
d340baf97d
commit
4addf8f9af
@ -66,16 +66,16 @@ func (s *SceneManager) Draw(context ebiten.GraphicsContext, textures *Textures)
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
from := textures.GetRenderTarget("scene_manager_transition_from")
|
from := textures.GetRenderTarget("scene_manager_transition_from")
|
||||||
context.PushOffscreen(from)
|
context.PushRenderTarget(from)
|
||||||
context.Clear()
|
context.Clear()
|
||||||
s.current.Draw(context, textures)
|
s.current.Draw(context, textures)
|
||||||
context.PopOffscreen()
|
context.PopRenderTarget()
|
||||||
|
|
||||||
to := textures.GetRenderTarget("scene_manager_transition_to")
|
to := textures.GetRenderTarget("scene_manager_transition_to")
|
||||||
context.PushOffscreen(to)
|
context.PushRenderTarget(to)
|
||||||
context.Clear()
|
context.Clear()
|
||||||
s.next.Draw(context, textures)
|
s.next.Draw(context, textures)
|
||||||
context.PopOffscreen()
|
context.PopRenderTarget()
|
||||||
|
|
||||||
color := ebiten.ColorMatrixI()
|
color := ebiten.ColorMatrixI()
|
||||||
ebiten.DrawWhole(
|
ebiten.DrawWhole(
|
||||||
|
@ -36,9 +36,9 @@ func (g *Game) Draw(gr ebiten.GraphicsContext) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
gr.PushOffscreen(g.canvasRenderTarget)
|
gr.PushRenderTarget(g.canvasRenderTarget)
|
||||||
gr.Fill(0xff, 0xff, 0xff)
|
gr.Fill(0xff, 0xff, 0xff)
|
||||||
gr.PopOffscreen()
|
gr.PopRenderTarget()
|
||||||
}
|
}
|
||||||
ebiten.DrawWhole(gr.RenderTarget(g.canvasRenderTarget), screenWidth, screenHeight, ebiten.GeometryMatrixI(), ebiten.ColorMatrixI())
|
ebiten.DrawWhole(gr.RenderTarget(g.canvasRenderTarget), screenWidth, screenHeight, ebiten.GeometryMatrixI(), ebiten.ColorMatrixI())
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ type GraphicsContext interface {
|
|||||||
Fill(r, g, b uint8)
|
Fill(r, g, b uint8)
|
||||||
Texture(id TextureID) Drawer
|
Texture(id TextureID) Drawer
|
||||||
RenderTarget(id RenderTargetID) Drawer
|
RenderTarget(id RenderTargetID) Drawer
|
||||||
PushOffscreen(id RenderTargetID)
|
PushRenderTarget(id RenderTargetID)
|
||||||
PopOffscreen()
|
PopRenderTarget()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter represents the type of filter to be used when a texture or a render
|
// Filter represents the type of filter to be used when a texture or a render
|
||||||
|
@ -58,15 +58,15 @@ func (c *graphicsContext) RenderTarget(id ebiten.RenderTargetID) (d ebiten.Drawe
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *graphicsContext) PopOffscreen() {
|
func (c *graphicsContext) PopRenderTarget() {
|
||||||
c.canvas.use(func() {
|
c.canvas.use(func() {
|
||||||
c.canvas.graphicsContext.PopOffscreen()
|
c.canvas.graphicsContext.PopRenderTarget()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *graphicsContext) PushOffscreen(id ebiten.RenderTargetID) {
|
func (c *graphicsContext) PushRenderTarget(id ebiten.RenderTargetID) {
|
||||||
c.canvas.use(func() {
|
c.canvas.use(func() {
|
||||||
c.canvas.graphicsContext.PushOffscreen(id)
|
c.canvas.graphicsContext.PushRenderTarget(id)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,22 +84,22 @@ func (c *GraphicsContext) RenderTarget(id ebiten.RenderTargetID) ebiten.Drawer {
|
|||||||
return &textureWithContext{idsInstance.toTexture(id), c}
|
return &textureWithContext{idsInstance.toTexture(id), c}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GraphicsContext) PushOffscreen(renderTargetID ebiten.RenderTargetID) {
|
func (c *GraphicsContext) PushRenderTarget(renderTargetID ebiten.RenderTargetID) {
|
||||||
c.currentIDs = append(c.currentIDs, renderTargetID)
|
c.currentIDs = append(c.currentIDs, renderTargetID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GraphicsContext) PopOffscreen() {
|
func (c *GraphicsContext) PopRenderTarget() {
|
||||||
c.currentIDs = c.currentIDs[:len(c.currentIDs)-1]
|
c.currentIDs = c.currentIDs[:len(c.currentIDs)-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GraphicsContext) PreUpdate() {
|
func (c *GraphicsContext) PreUpdate() {
|
||||||
c.currentIDs = []ebiten.RenderTargetID{c.defaultID}
|
c.currentIDs = []ebiten.RenderTargetID{c.defaultID}
|
||||||
c.PushOffscreen(c.screenID)
|
c.PushRenderTarget(c.screenID)
|
||||||
c.Clear()
|
c.Clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *GraphicsContext) PostUpdate() {
|
func (c *GraphicsContext) PostUpdate() {
|
||||||
c.PopOffscreen()
|
c.PopRenderTarget()
|
||||||
c.Clear()
|
c.Clear()
|
||||||
|
|
||||||
scale := float64(c.screenScale)
|
scale := float64(c.screenScale)
|
||||||
|
Loading…
Reference in New Issue
Block a user