Rename TextureLocation to TexturePart

This commit is contained in:
Hajime Hoshi 2013-06-23 02:16:22 +09:00
parent 2b04f74614
commit edceec9220
3 changed files with 8 additions and 8 deletions

View File

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

View File

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

View File

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