From 2b4dc28d917a4dcb057ad84bf0e0246cb514a04b Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Tue, 7 Jan 2014 23:29:12 +0900 Subject: [PATCH] go fmt --- example/blocks/game_scene.go | 9 +++------ example/blocks/piece.go | 12 ++++++------ example/blocks/title_scene.go | 8 ++++---- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/example/blocks/game_scene.go b/example/blocks/game_scene.go index 3961ab609..a9d244333 100644 --- a/example/blocks/game_scene.go +++ b/example/blocks/game_scene.go @@ -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 } diff --git a/example/blocks/piece.go b/example/blocks/piece.go index 57d3fd171..9d4a8209e 100644 --- a/example/blocks/piece.go +++ b/example/blocks/piece.go @@ -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) diff --git a/example/blocks/title_scene.go b/example/blocks/title_scene.go index 7e2b33294..3014e21d9 100644 --- a/example/blocks/title_scene.go +++ b/example/blocks/title_scene.go @@ -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()