mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-12 20:18:59 +01:00
Rename methods: Identity* -> *I
This commit is contained in:
parent
7d4540d863
commit
d47dd79e1c
@ -45,10 +45,10 @@ func drawText(
|
||||
locationX += charWidth
|
||||
}
|
||||
|
||||
geoMat := matrix.IdentityGeometry()
|
||||
geoMat := matrix.GeometryI()
|
||||
geoMat.Scale(float64(scale), float64(scale))
|
||||
geoMat.Translate(float64(x), float64(y))
|
||||
clrMat := matrix.IdentityColor()
|
||||
clrMat := matrix.ColorI()
|
||||
clrMat.Scale(clr)
|
||||
context.Texture(fontTextureId).Draw(parts, geoMat, clrMat)
|
||||
}
|
||||
|
@ -101,12 +101,12 @@ func (s *GameScene) Draw(context graphics.Context, textures Textures) {
|
||||
context.Fill(0xff, 0xff, 0xff)
|
||||
|
||||
field := textures.GetTexture("empty")
|
||||
geoMat := matrix.IdentityGeometry()
|
||||
geoMat := matrix.GeometryI()
|
||||
geoMat.Scale(
|
||||
float64(fieldWidth)/float64(emptyWidth),
|
||||
float64(fieldHeight)/float64(emptyHeight))
|
||||
geoMat.Translate(20, 20) // magic number?
|
||||
colorMat := matrix.IdentityColor()
|
||||
colorMat := matrix.ColorI()
|
||||
colorMat.Scale(color.RGBA{0, 0, 0, 0x80})
|
||||
graphics.DrawWhole(
|
||||
context.Texture(field),
|
||||
@ -115,7 +115,7 @@ func (s *GameScene) Draw(context graphics.Context, textures Textures) {
|
||||
geoMat,
|
||||
colorMat)
|
||||
|
||||
geoMat = matrix.IdentityGeometry()
|
||||
geoMat = matrix.GeometryI()
|
||||
geoMat.Translate(20, 20)
|
||||
s.field.Draw(context, textures, geoMat)
|
||||
|
||||
|
@ -148,7 +148,7 @@ func drawBlocks(
|
||||
}
|
||||
}
|
||||
blocksTexture := textures.GetTexture("blocks")
|
||||
context.Texture(blocksTexture).Draw(parts, geo, matrix.IdentityColor())
|
||||
context.Texture(blocksTexture).Draw(parts, geo, matrix.ColorI())
|
||||
}
|
||||
|
||||
func (p *Piece) InitialPosition() (int, int) {
|
||||
@ -226,7 +226,7 @@ func (p *Piece) Draw(
|
||||
}
|
||||
}
|
||||
|
||||
geoMat := matrix.IdentityGeometry()
|
||||
geoMat := matrix.GeometryI()
|
||||
x := fieldX + pieceX*blockWidth
|
||||
y := fieldY + pieceY*blockHeight
|
||||
geoMat.Translate(float64(x), float64(y))
|
||||
|
@ -61,12 +61,12 @@ func (s *SceneManager) Draw(context graphics.Context, textures Textures) {
|
||||
s.next.Draw(context, textures)
|
||||
|
||||
context.ResetOffscreen()
|
||||
color := matrix.IdentityColor()
|
||||
color := matrix.ColorI()
|
||||
graphics.DrawWhole(
|
||||
context.RenderTarget(from),
|
||||
ScreenWidth,
|
||||
ScreenHeight,
|
||||
matrix.IdentityGeometry(),
|
||||
matrix.GeometryI(),
|
||||
color)
|
||||
|
||||
alpha := float64(s.transitionCount) / float64(transitionMaxCount)
|
||||
@ -75,7 +75,7 @@ func (s *SceneManager) Draw(context graphics.Context, textures Textures) {
|
||||
context.RenderTarget(to),
|
||||
ScreenWidth,
|
||||
ScreenHeight,
|
||||
matrix.IdentityGeometry(),
|
||||
matrix.GeometryI(),
|
||||
color)
|
||||
}
|
||||
|
||||
|
@ -54,9 +54,9 @@ func drawTitleBackground(context graphics.Context, textures Textures, c int) {
|
||||
|
||||
dx := (-c / 4) % textureWidth
|
||||
dy := (c / 4) % textureHeight
|
||||
geo := matrix.IdentityGeometry()
|
||||
geo := matrix.GeometryI()
|
||||
geo.Translate(float64(dx), float64(dy))
|
||||
clr := matrix.IdentityColor()
|
||||
clr := matrix.ColorI()
|
||||
context.Texture(backgroundTextureId).Draw(parts, geo, clr)
|
||||
}
|
||||
|
||||
|
@ -11,7 +11,7 @@ type Color struct {
|
||||
Elements [colorDim - 1][colorDim]float64
|
||||
}
|
||||
|
||||
func IdentityColor() Color {
|
||||
func ColorI() Color {
|
||||
return Color{
|
||||
[colorDim - 1][colorDim]float64{
|
||||
{1, 0, 0, 0, 0},
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func TestColorIdentity(t *testing.T) {
|
||||
matrix := IdentityColor()
|
||||
matrix := ColorI()
|
||||
got := matrix.IsIdentity()
|
||||
want := true
|
||||
if want != got {
|
||||
|
@ -10,7 +10,7 @@ type Geometry struct {
|
||||
Elements [geometryDim - 1][geometryDim]float64
|
||||
}
|
||||
|
||||
func IdentityGeometry() Geometry {
|
||||
func GeometryI() Geometry {
|
||||
return Geometry{
|
||||
[geometryDim - 1][geometryDim]float64{
|
||||
{1, 0, 0},
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
)
|
||||
|
||||
func TestGeometryIdentity(t *testing.T) {
|
||||
matrix := IdentityGeometry()
|
||||
matrix := GeometryI()
|
||||
got := matrix.IsIdentity()
|
||||
want := true
|
||||
if want != got {
|
||||
|
@ -69,9 +69,9 @@ func (c *Context) Update(draw func(graphics.Context)) {
|
||||
c.Clear()
|
||||
|
||||
scale := float64(c.screenScale)
|
||||
geo := matrix.IdentityGeometry()
|
||||
geo := matrix.GeometryI()
|
||||
geo.Scale(scale, scale)
|
||||
graphics.DrawWhole(c.RenderTarget(c.screenId), c.screenWidth, c.screenHeight, geo, matrix.IdentityColor())
|
||||
graphics.DrawWhole(c.RenderTarget(c.screenId), c.screenWidth, c.screenHeight, geo, matrix.ColorI())
|
||||
|
||||
flush()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user