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 vy int
} }
func NewSprite(screenWidth, screenHeight, width, height int) *Sprite { func newSprite(screenWidth, screenHeight, width, height int) *Sprite {
maxX := screenWidth - width maxX := screenWidth - width
maxY := screenHeight - height maxY := screenHeight - height
sprite := &Sprite{ sprite := &Sprite{
@ -89,7 +89,7 @@ func (game *Sprites) Init(tf graphics.TextureFactory) {
game.ebitenTexture = tf.NewTextureFromImage(img) game.ebitenTexture = tf.NewTextureFromImage(img)
game.sprites = []*Sprite{} game.sprites = []*Sprite{}
for i := 0; i < 1000; i++ { for i := 0; i < 1000; i++ {
sprite := NewSprite( sprite := newSprite(
game.ScreenWidth(), game.ScreenWidth(),
game.ScreenHeight(), game.ScreenHeight(),
game.ebitenTexture.Width, 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}) g.Fill(&color.RGBA{R: 128, G: 128, B: 255, A: 255})
// Draw the sprites // Draw the sprites
locations := make([]graphics.TextureLocation, 0, len(game.sprites)) locations := make([]graphics.TexturePart, 0, len(game.sprites))
texture := game.ebitenTexture texture := game.ebitenTexture
for _, sprite := range game.sprites { for _, sprite := range game.sprites {
location := graphics.TextureLocation{ location := graphics.TexturePart{
LocationX: sprite.x, LocationX: sprite.x,
LocationY: sprite.y, LocationY: sprite.y,
Source: graphics.Rect{ Source: graphics.Rect{

View File

@ -18,7 +18,7 @@ type Rect struct {
Height int Height int
} }
type TextureLocation struct { type TexturePart struct {
LocationX int LocationX int
LocationY int LocationY int
Source Rect Source Rect
@ -32,7 +32,7 @@ type GraphicsContext interface {
geometryMatrix matrix.Geometry, geometryMatrix matrix.Geometry,
colorMatrix matrix.Color) colorMatrix matrix.Color)
DrawTextureParts(textureId TextureID, DrawTextureParts(textureId TextureID,
locations []TextureLocation, locations []TexturePart,
geometryMatrix matrix.Geometry, geometryMatrix matrix.Geometry,
colorMatrix matrix.Color) colorMatrix matrix.Color)
SetOffscreen(textureId TextureID) SetOffscreen(textureId TextureID)

View File

@ -121,13 +121,13 @@ func (context *GraphicsContext) DrawTexture(
texture graphics.Texture, texture graphics.Texture,
geometryMatrix matrix.Geometry, colorMatrix matrix.Color) { geometryMatrix matrix.Geometry, colorMatrix matrix.Color) {
source := graphics.Rect{0, 0, texture.Width, texture.Height} 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, context.DrawTextureParts(texture.ID, locations,
geometryMatrix, colorMatrix) geometryMatrix, colorMatrix)
} }
func (context *GraphicsContext) DrawTextureParts( func (context *GraphicsContext) DrawTextureParts(
textureID graphics.TextureID, locations []graphics.TextureLocation, textureID graphics.TextureID, locations []graphics.TexturePart,
geometryMatrix matrix.Geometry, colorMatrix matrix.Color) { geometryMatrix matrix.Geometry, colorMatrix matrix.Color) {
texture := context.textures[textureID] texture := context.textures[textureID]