mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-13 04:22:05 +01:00
go fmt
This commit is contained in:
parent
7cea6f4bc8
commit
2b4dc28d91
@ -68,18 +68,15 @@ func (s *GameScene) Update(state *GameState) {
|
||||
s.currentPieceAngle = s.field.RotatePieceRight(piece, x, y, angle)
|
||||
moved = angle != s.currentPieceAngle
|
||||
}
|
||||
if l := state.Input.StateForKey(ui.KeyLeft);
|
||||
l == 1 || (10 <= l && l % 2 == 0) {
|
||||
if l := state.Input.StateForKey(ui.KeyLeft); l == 1 || (10 <= l && l%2 == 0) {
|
||||
s.currentPieceX = s.field.MovePieceToLeft(piece, x, y, angle)
|
||||
moved = x != s.currentPieceX
|
||||
}
|
||||
if r := state.Input.StateForKey(ui.KeyRight);
|
||||
r == 1 || (10 <= r && r % 2 == 0) {
|
||||
if r := state.Input.StateForKey(ui.KeyRight); r == 1 || (10 <= r && r%2 == 0) {
|
||||
s.currentPieceX = s.field.MovePieceToRight(piece, x, y, angle)
|
||||
moved = y != s.currentPieceX
|
||||
}
|
||||
if d := state.Input.StateForKey(ui.KeyDown);
|
||||
(d - 1) % 2 == 0 {
|
||||
if d := state.Input.StateForKey(ui.KeyDown); (d-1)%2 == 0 {
|
||||
s.currentPieceY = s.field.DropPiece(piece, x, y, angle)
|
||||
moved = y != s.currentPieceY
|
||||
}
|
||||
|
@ -170,12 +170,12 @@ func (p *Piece) isBlocked(i, j int, angle Angle) bool {
|
||||
case Angle0:
|
||||
case Angle90:
|
||||
i2 = j
|
||||
j2 = size-1-i
|
||||
j2 = size - 1 - i
|
||||
case Angle180:
|
||||
i2 = size-1-i
|
||||
j2 = size-1-j
|
||||
i2 = size - 1 - i
|
||||
j2 = size - 1 - j
|
||||
case Angle270:
|
||||
i2 = size-1-j
|
||||
i2 = size - 1 - j
|
||||
j2 = i
|
||||
}
|
||||
return p.blocks[i2][j2]
|
||||
@ -218,8 +218,8 @@ func (p *Piece) Draw(context graphics.Context, fieldX, fieldY int, pieceX, piece
|
||||
}
|
||||
|
||||
geoMat := matrix.IdentityGeometry()
|
||||
x := fieldX + pieceX * blockWidth
|
||||
y := fieldY + pieceY * blockHeight
|
||||
x := fieldX + pieceX*blockWidth
|
||||
y := fieldY + pieceY*blockHeight
|
||||
geoMat.Translate(float64(x), float64(y))
|
||||
|
||||
drawBlocks(context, blocks, geoMat)
|
||||
|
@ -31,8 +31,8 @@ func (s *TitleScene) Draw(context graphics.Context) {
|
||||
drawLogo(context, "BLOCKS")
|
||||
|
||||
message := "PRESS SPACE TO START"
|
||||
x := (ScreenWidth-textWidth(message)) / 2
|
||||
y := ScreenHeight-48
|
||||
x := (ScreenWidth - textWidth(message)) / 2
|
||||
y := ScreenHeight - 48
|
||||
drawTextWithShadow(context, message, x, y, 1, color.RGBA{0x80, 0, 0, 0xff})
|
||||
}
|
||||
|
||||
@ -52,8 +52,8 @@ func drawTitleBackground(context graphics.Context, c int) {
|
||||
}
|
||||
}
|
||||
|
||||
dx := (-c/4) % textureWidth
|
||||
dy := (c/4) % textureHeight
|
||||
dx := (-c / 4) % textureWidth
|
||||
dy := (c / 4) % textureHeight
|
||||
geo := matrix.IdentityGeometry()
|
||||
geo.Translate(float64(dx), float64(dy))
|
||||
clr := matrix.IdentityColor()
|
||||
|
Loading…
Reference in New Issue
Block a user