mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-12 22:17:26 +01:00
Renamed methods
This commit is contained in:
parent
71606b78a9
commit
03fae7032a
@ -56,8 +56,7 @@ func (game *RotatingImage) Draw(g graphics.GraphicsContext, offscreen graphics.T
|
||||
centerY := float64(game.ScreenHeight()) / 2
|
||||
geometryMatrix.Translate(centerX-tx/2, centerY-ty/2)
|
||||
|
||||
g.DrawTexture(game.ebitenTexture.ID,
|
||||
graphics.Rect{0, 0, int(tx), int(ty)},
|
||||
g.DrawTexture(game.ebitenTexture,
|
||||
geometryMatrix,
|
||||
matrix.IdentityColor())
|
||||
}
|
||||
|
@ -61,6 +61,7 @@ func (sprite *Sprite) Update() {
|
||||
type Sprites struct {
|
||||
ebitenTexture graphics.Texture
|
||||
sprites []*Sprite
|
||||
angle int
|
||||
}
|
||||
|
||||
func NewSprites() *Sprites {
|
||||
@ -102,6 +103,7 @@ func (game *Sprites) Update() {
|
||||
for _, sprite := range game.sprites {
|
||||
sprite.Update()
|
||||
}
|
||||
game.angle++
|
||||
}
|
||||
|
||||
func (game *Sprites) Draw(g graphics.GraphicsContext, offscreen graphics.Texture) {
|
||||
@ -120,8 +122,9 @@ func (game *Sprites) Draw(g graphics.GraphicsContext, offscreen graphics.Texture
|
||||
}
|
||||
locations = append(locations, location)
|
||||
}
|
||||
g.DrawTextures(texture.ID, locations,
|
||||
matrix.IdentityGeometry(), matrix.IdentityColor())
|
||||
geometryMatrix := matrix.IdentityGeometry()
|
||||
g.DrawTextureParts(texture.ID, locations,
|
||||
geometryMatrix, matrix.IdentityColor())
|
||||
}
|
||||
|
||||
func init() {
|
||||
|
@ -27,12 +27,13 @@ type TextureLocation struct {
|
||||
type GraphicsContext interface {
|
||||
Clear()
|
||||
Fill(color color.Color)
|
||||
DrawTexture(textureId TextureID,
|
||||
source Rect,
|
||||
geometryMatrix matrix.Geometry, colorMatrix matrix.Color)
|
||||
DrawTextures(textureId TextureID,
|
||||
DrawTexture(texture Texture,
|
||||
geometryMatrix matrix.Geometry,
|
||||
colorMatrix matrix.Color)
|
||||
DrawTextureParts(textureId TextureID,
|
||||
locations []TextureLocation,
|
||||
geometryMatrix matrix.Geometry, colorMatrix matrix.Color)
|
||||
geometryMatrix matrix.Geometry,
|
||||
colorMatrix matrix.Color)
|
||||
SetOffscreen(textureId TextureID)
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,7 @@ func (device *Device) Update() {
|
||||
{0, scale, 0},
|
||||
},
|
||||
}
|
||||
g.DrawTexture(device.offscreenTexture.ID,
|
||||
graphics.Rect{
|
||||
0, 0, device.screenWidth, device.screenHeight,
|
||||
},
|
||||
g.DrawTexture(device.offscreenTexture,
|
||||
geometryMatrix, matrix.IdentityColor())
|
||||
g.flush()
|
||||
}
|
||||
|
@ -66,14 +66,15 @@ func (context *GraphicsContext) DrawRect(x, y, width, height int, clr color.Colo
|
||||
}
|
||||
|
||||
func (context *GraphicsContext) DrawTexture(
|
||||
textureID graphics.TextureID, source graphics.Rect,
|
||||
texture graphics.Texture,
|
||||
geometryMatrix matrix.Geometry, colorMatrix matrix.Color) {
|
||||
source := graphics.Rect{0, 0, texture.Width, texture.Height}
|
||||
locations := []graphics.TextureLocation{{0, 0, source}}
|
||||
context.DrawTextures(textureID, locations,
|
||||
context.DrawTextureParts(texture.ID, locations,
|
||||
geometryMatrix, colorMatrix)
|
||||
}
|
||||
|
||||
func (context *GraphicsContext) DrawTextures(
|
||||
func (context *GraphicsContext) DrawTextureParts(
|
||||
textureID graphics.TextureID, locations []graphics.TextureLocation,
|
||||
geometryMatrix matrix.Geometry, colorMatrix matrix.Color) {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user