mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Rename TextureLocation to TexturePart
This commit is contained in:
parent
2b04f74614
commit
edceec9220
@ -20,7 +20,7 @@ type Sprite struct {
|
||||
vy int
|
||||
}
|
||||
|
||||
func NewSprite(screenWidth, screenHeight, width, height int) *Sprite {
|
||||
func newSprite(screenWidth, screenHeight, width, height int) *Sprite {
|
||||
maxX := screenWidth - width
|
||||
maxY := screenHeight - height
|
||||
sprite := &Sprite{
|
||||
@ -89,7 +89,7 @@ func (game *Sprites) Init(tf graphics.TextureFactory) {
|
||||
game.ebitenTexture = tf.NewTextureFromImage(img)
|
||||
game.sprites = []*Sprite{}
|
||||
for i := 0; i < 1000; i++ {
|
||||
sprite := NewSprite(
|
||||
sprite := newSprite(
|
||||
game.ScreenWidth(),
|
||||
game.ScreenHeight(),
|
||||
game.ebitenTexture.Width,
|
||||
@ -108,10 +108,10 @@ func (game *Sprites) Draw(g graphics.GraphicsContext, offscreen graphics.Texture
|
||||
g.Fill(&color.RGBA{R: 128, G: 128, B: 255, A: 255})
|
||||
|
||||
// Draw the sprites
|
||||
locations := make([]graphics.TextureLocation, 0, len(game.sprites))
|
||||
locations := make([]graphics.TexturePart, 0, len(game.sprites))
|
||||
texture := game.ebitenTexture
|
||||
for _, sprite := range game.sprites {
|
||||
location := graphics.TextureLocation{
|
||||
location := graphics.TexturePart{
|
||||
LocationX: sprite.x,
|
||||
LocationY: sprite.y,
|
||||
Source: graphics.Rect{
|
||||
|
@ -18,7 +18,7 @@ type Rect struct {
|
||||
Height int
|
||||
}
|
||||
|
||||
type TextureLocation struct {
|
||||
type TexturePart struct {
|
||||
LocationX int
|
||||
LocationY int
|
||||
Source Rect
|
||||
@ -32,7 +32,7 @@ type GraphicsContext interface {
|
||||
geometryMatrix matrix.Geometry,
|
||||
colorMatrix matrix.Color)
|
||||
DrawTextureParts(textureId TextureID,
|
||||
locations []TextureLocation,
|
||||
locations []TexturePart,
|
||||
geometryMatrix matrix.Geometry,
|
||||
colorMatrix matrix.Color)
|
||||
SetOffscreen(textureId TextureID)
|
||||
|
@ -121,13 +121,13 @@ func (context *GraphicsContext) DrawTexture(
|
||||
texture graphics.Texture,
|
||||
geometryMatrix matrix.Geometry, colorMatrix matrix.Color) {
|
||||
source := graphics.Rect{0, 0, texture.Width, texture.Height}
|
||||
locations := []graphics.TextureLocation{{0, 0, source}}
|
||||
locations := []graphics.TexturePart{{0, 0, source}}
|
||||
context.DrawTextureParts(texture.ID, locations,
|
||||
geometryMatrix, colorMatrix)
|
||||
}
|
||||
|
||||
func (context *GraphicsContext) DrawTextureParts(
|
||||
textureID graphics.TextureID, locations []graphics.TextureLocation,
|
||||
textureID graphics.TextureID, locations []graphics.TexturePart,
|
||||
geometryMatrix matrix.Geometry, colorMatrix matrix.Color) {
|
||||
|
||||
texture := context.textures[textureID]
|
||||
|
Loading…
Reference in New Issue
Block a user