mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Rename DrawTexture -> DrawImage
This commit is contained in:
parent
79b67db0d8
commit
ee61db3478
@ -57,7 +57,7 @@ func (d *debugPrintState) drawText(r *ebiten.RenderTarget, str string, x, y int,
|
||||
geom.Concat(ebiten.TranslateGeometry(float64(x)+1, float64(y)))
|
||||
clrm := ebiten.ColorMatrixI()
|
||||
clrm.Concat(ebiten.ScaleColor(clr))
|
||||
r.DrawTexture(d.textTexture, parts, geom, clrm)
|
||||
r.DrawImage(d.textTexture, parts, geom, clrm)
|
||||
}
|
||||
|
||||
func (d *debugPrintState) DebugPrint(r *ebiten.RenderTarget, str string) {
|
||||
|
@ -53,7 +53,7 @@ func (g *Game) Update(r *ebiten.RenderTarget) error {
|
||||
for i := 0; i < 10; i++ {
|
||||
geo := ebiten.TranslateGeometry(15+float64(i)*(diff), 20)
|
||||
clr := ebiten.ScaleColor(color.RGBA{0xff, 0xff, 0xff, 0x80})
|
||||
if err := ebiten.DrawWholeTexture(g.tmpRenderTarget, g.ebitenTexture, geo, clr); err != nil {
|
||||
if err := ebiten.DrawWholeImage(g.tmpRenderTarget, g.ebitenTexture, geo, clr); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
@ -62,7 +62,7 @@ func (g *Game) Update(r *ebiten.RenderTarget) error {
|
||||
for i := 0; i < 10; i++ {
|
||||
geo := ebiten.TranslateGeometry(0, float64(i)*(diff))
|
||||
clr := ebiten.ColorMatrixI()
|
||||
if err := ebiten.DrawWholeTexture(r, g.tmpRenderTarget.Texture(), geo, clr); err != nil {
|
||||
if err := ebiten.DrawWholeImage(r, g.tmpRenderTarget.Texture(), geo, clr); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ func drawText(r *ebiten.RenderTarget, textures *Textures, str string, ox, oy, sc
|
||||
geoMat := ebiten.ScaleGeometry(float64(scale), float64(scale))
|
||||
geoMat.Concat(ebiten.TranslateGeometry(float64(ox), float64(oy)))
|
||||
clrMat := ebiten.ScaleColor(clr)
|
||||
r.DrawTexture(fontTextureId, parts, geoMat, clrMat)
|
||||
r.DrawImage(fontTextureId, parts, geoMat, clrMat)
|
||||
}
|
||||
|
||||
func drawTextWithShadow(r *ebiten.RenderTarget, textures *Textures, str string, x, y, scale int, clr color.Color) {
|
||||
|
@ -117,7 +117,7 @@ func (s *GameScene) Draw(r *ebiten.RenderTarget, textures *Textures) {
|
||||
geoMat := ebiten.ScaleGeometry(float64(fieldWidth)/float64(w), float64(fieldHeight)/float64(h))
|
||||
geoMat.Concat(ebiten.TranslateGeometry(20, 20)) // TODO: magic number?
|
||||
colorMat := ebiten.ScaleColor(color.RGBA{0, 0, 0, 0x80})
|
||||
ebiten.DrawWholeTexture(r, field, geoMat, colorMat)
|
||||
ebiten.DrawWholeImage(r, field, geoMat, colorMat)
|
||||
|
||||
geoMat = ebiten.GeometryMatrixI()
|
||||
geoMat.Concat(ebiten.TranslateGeometry(20, 20))
|
||||
|
@ -153,7 +153,7 @@ func drawBlocks(r *ebiten.RenderTarget, textures *Textures, blocks [][]BlockType
|
||||
}
|
||||
}
|
||||
blocksTexture := textures.GetTexture("blocks")
|
||||
r.DrawTexture(blocksTexture, parts, geo, ebiten.ColorMatrixI())
|
||||
r.DrawImage(blocksTexture, parts, geo, ebiten.ColorMatrixI())
|
||||
}
|
||||
|
||||
func (p *Piece) InitialPosition() (int, int) {
|
||||
|
@ -74,11 +74,11 @@ func (s *SceneManager) Draw(r *ebiten.RenderTarget, textures *Textures) {
|
||||
s.next.Draw(to, textures)
|
||||
|
||||
color := ebiten.ColorMatrixI()
|
||||
ebiten.DrawWholeTexture(r, from.Texture(), ebiten.GeometryMatrixI(), color)
|
||||
ebiten.DrawWholeImage(r, from.Texture(), ebiten.GeometryMatrixI(), color)
|
||||
|
||||
alpha := float64(s.transitionCount) / float64(transitionMaxCount)
|
||||
color.Elements[3][3] = alpha
|
||||
ebiten.DrawWholeTexture(r, to.Texture(), ebiten.GeometryMatrixI(), color)
|
||||
ebiten.DrawWholeImage(r, to.Texture(), ebiten.GeometryMatrixI(), color)
|
||||
}
|
||||
|
||||
func (s *SceneManager) GoTo(scene Scene) {
|
||||
|
@ -70,7 +70,7 @@ func drawTitleBackground(r *ebiten.RenderTarget, textures *Textures, c int) {
|
||||
geo := ebiten.GeometryMatrixI()
|
||||
geo.Concat(ebiten.TranslateGeometry(float64(dx), float64(dy)))
|
||||
clr := ebiten.ColorMatrixI()
|
||||
r.DrawTexture(backgroundTexture, parts, geo, clr)
|
||||
r.DrawImage(backgroundTexture, parts, geo, clr)
|
||||
}
|
||||
|
||||
func drawLogo(r *ebiten.RenderTarget, textures *Textures, str string) {
|
||||
|
@ -60,7 +60,7 @@ func (g *Game) Update(r *ebiten.RenderTarget) error {
|
||||
geo.Concat(ebiten.TranslateGeometry(screenWidth/2, screenHeight/2))
|
||||
//clr := ebiten.RotateHue(float64(g.count%180) * 2 * math.Pi / 180)
|
||||
clr := ebiten.ColorMatrixI()
|
||||
ebiten.DrawWholeTexture(r, g.gophersTexture, geo, clr)
|
||||
ebiten.DrawWholeImage(r, g.gophersTexture, geo, clr)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -37,10 +37,10 @@ type Game struct {
|
||||
|
||||
func (g *Game) Update(r *ebiten.RenderTarget) error {
|
||||
geo := ebiten.ScaleGeometry(1.0/mosaicRatio, 1.0/mosaicRatio)
|
||||
ebiten.DrawWholeTexture(g.gophersRenderTarget, g.gophersTexture, geo, ebiten.ColorMatrixI())
|
||||
ebiten.DrawWholeImage(g.gophersRenderTarget, g.gophersTexture, geo, ebiten.ColorMatrixI())
|
||||
|
||||
geo = ebiten.ScaleGeometry(mosaicRatio/2.0, mosaicRatio/2.0)
|
||||
ebiten.DrawWholeTexture(r, g.gophersRenderTarget.Texture(), geo, ebiten.ColorMatrixI())
|
||||
ebiten.DrawWholeImage(r, g.gophersRenderTarget.Texture(), geo, ebiten.ColorMatrixI())
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -54,10 +54,10 @@ func (g *Game) Update(r *ebiten.RenderTarget) error {
|
||||
clr := ebiten.ScaleColor(color.RGBA{0xff, 0x40, 0x40, 0xff})
|
||||
theta := 2.0 * math.Pi * float64(g.count%60) / 60.0
|
||||
clr.Concat(ebiten.RotateHue(theta))
|
||||
ebiten.DrawWholeTexture(g.canvasRenderTarget, g.brushRenderTarget.Texture(), geo, clr)
|
||||
ebiten.DrawWholeImage(g.canvasRenderTarget, g.brushRenderTarget.Texture(), geo, clr)
|
||||
}
|
||||
|
||||
ebiten.DrawWholeTexture(r, g.canvasRenderTarget.Texture(), ebiten.GeometryMatrixI(), ebiten.ColorMatrixI())
|
||||
ebiten.DrawWholeImage(r, g.canvasRenderTarget.Texture(), ebiten.GeometryMatrixI(), ebiten.ColorMatrixI())
|
||||
|
||||
ebitenutil.DebugPrint(r, fmt.Sprintf("(%d, %d)", mx, my))
|
||||
return nil
|
||||
|
@ -48,7 +48,7 @@ func (g *Game) Update(r *ebiten.RenderTarget) error {
|
||||
geo := ebiten.TranslateGeometry(-maxWidth/2, -float64(h)/2)
|
||||
geo.Concat(ebiten.ScaleGeometry(0.4, 0.4))
|
||||
geo.Concat(ebiten.TranslateGeometry(screenWidth/2, screenHeight/2))
|
||||
r.DrawTexture(g.gophersTexture, parts, geo, ebiten.ColorMatrixI())
|
||||
r.DrawImage(g.gophersTexture, parts, geo, ebiten.ColorMatrixI())
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -35,12 +35,12 @@ type TexturePart struct {
|
||||
}
|
||||
|
||||
// DrawWholeTexture draws the whole texture.
|
||||
func DrawWholeTexture(r *RenderTarget, texture *Texture, geo GeometryMatrix, color ColorMatrix) error {
|
||||
func DrawWholeImage(r *RenderTarget, texture *Texture, geo GeometryMatrix, color ColorMatrix) error {
|
||||
w, h := texture.Size()
|
||||
parts := []TexturePart{
|
||||
{Rect{0, 0, float64(w), float64(h)}, Rect{0, 0, float64(w), float64(h)}},
|
||||
}
|
||||
return r.DrawTexture(texture, parts, geo, color)
|
||||
return r.DrawImage(texture, parts, geo, color)
|
||||
}
|
||||
|
||||
// Filter represents the type of filter to be used when a texture is maginified or minified.
|
||||
|
@ -69,7 +69,7 @@ func (c *graphicsContext) postUpdate() error {
|
||||
parts := []TexturePart{
|
||||
{Rect{0, 0, float64(w), float64(h)}, Rect{0, 0, float64(w), float64(h)}},
|
||||
}
|
||||
if err := c.defaultR.DrawTexture(c.screen.texture, parts, geo, clr); err != nil {
|
||||
if err := c.defaultR.DrawImage(c.screen.texture, parts, geo, clr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ func (r *innerRenderTarget) Fill(clr color.Color) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *innerRenderTarget) DrawTexture(texture *Texture, parts []TexturePart, geo GeometryMatrix, color ColorMatrix) error {
|
||||
func (r *innerRenderTarget) DrawImage(texture *Texture, parts []TexturePart, geo GeometryMatrix, color ColorMatrix) error {
|
||||
if err := r.glRenderTarget.SetAsViewport(); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -141,9 +141,9 @@ func (r *RenderTarget) Fill(clr color.Color) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (r *RenderTarget) DrawTexture(texture *Texture, parts []TexturePart, geo GeometryMatrix, color ColorMatrix) (err error) {
|
||||
func (r *RenderTarget) DrawImage(texture *Texture, parts []TexturePart, geo GeometryMatrix, color ColorMatrix) (err error) {
|
||||
r.syncer.Sync(func() {
|
||||
err = r.inner.DrawTexture(texture, parts, geo, color)
|
||||
err = r.inner.DrawImage(texture, parts, geo, color)
|
||||
})
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user