Rename PushOffscreen -> PushRenderTarget

This commit is contained in:
Hajime Hoshi 2014-12-11 04:02:46 +09:00
parent d340baf97d
commit 4addf8f9af
5 changed files with 16 additions and 16 deletions

View File

@ -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(

View File

@ -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())

View File

@ -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

View File

@ -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)
}) })
} }

View File

@ -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)