mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-01-27 03:02:49 +01:00
go fmt
This commit is contained in:
parent
809f889631
commit
dfc07f9a44
@ -17,7 +17,7 @@ type Monochrome struct {
|
|||||||
|
|
||||||
func New() *Monochrome {
|
func New() *Monochrome {
|
||||||
return &Monochrome{
|
return &Monochrome{
|
||||||
ch: make(chan bool),
|
ch: make(chan bool),
|
||||||
colorMatrix: matrix.IdentityColor(),
|
colorMatrix: matrix.IdentityColor(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,11 +55,11 @@ func (game *Monochrome) Init(tf graphics.TextureFactory) {
|
|||||||
func mean(a, b matrix.Color, k float64) matrix.Color {
|
func mean(a, b matrix.Color, k float64) matrix.Color {
|
||||||
dim := a.Dim()
|
dim := a.Dim()
|
||||||
result := matrix.Color{}
|
result := matrix.Color{}
|
||||||
for i := 0; i < dim - 1; i++ {
|
for i := 0; i < dim-1; i++ {
|
||||||
for j := 0; j < dim; j++ {
|
for j := 0; j < dim; j++ {
|
||||||
result.Elements[i][j] =
|
result.Elements[i][j] =
|
||||||
a.Elements[i][j] * (1 - k) +
|
a.Elements[i][j]*(1-k) +
|
||||||
b.Elements[i][j] * k
|
b.Elements[i][j]*k
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
@ -103,8 +103,8 @@ func (game *Monochrome) Draw(g graphics.GraphicsContext, offscreen graphics.Text
|
|||||||
g.Fill(&color.RGBA{R: 128, G: 128, B: 255, A: 255})
|
g.Fill(&color.RGBA{R: 128, G: 128, B: 255, A: 255})
|
||||||
|
|
||||||
geometryMatrix := matrix.IdentityGeometry()
|
geometryMatrix := matrix.IdentityGeometry()
|
||||||
tx := game.ScreenWidth() / 2 - game.ebitenTexture.Width / 2
|
tx := game.ScreenWidth()/2 - game.ebitenTexture.Width/2
|
||||||
ty := game.ScreenHeight() / 2 - game.ebitenTexture.Height / 2
|
ty := game.ScreenHeight()/2 - game.ebitenTexture.Height/2
|
||||||
geometryMatrix.Translate(float64(tx), float64(ty))
|
geometryMatrix.Translate(float64(tx), float64(ty))
|
||||||
g.DrawTexture(game.ebitenTexture.ID,
|
g.DrawTexture(game.ebitenTexture.ID,
|
||||||
geometryMatrix, game.colorMatrix)
|
geometryMatrix, game.colorMatrix)
|
||||||
|
@ -57,7 +57,7 @@ func (game *Rotating) Draw(g graphics.GraphicsContext, offscreen graphics.Textur
|
|||||||
geometryMatrix := matrix.IdentityGeometry()
|
geometryMatrix := matrix.IdentityGeometry()
|
||||||
tx, ty := float64(game.ebitenTexture.Width), float64(game.ebitenTexture.Height)
|
tx, ty := float64(game.ebitenTexture.Width), float64(game.ebitenTexture.Height)
|
||||||
geometryMatrix.Translate(-tx/2, -ty/2)
|
geometryMatrix.Translate(-tx/2, -ty/2)
|
||||||
geometryMatrix.Rotate(float64(game.x) * 2 * math.Pi / float64(game.Fps() * 10))
|
geometryMatrix.Rotate(float64(game.x) * 2 * math.Pi / float64(game.Fps()*10))
|
||||||
geometryMatrix.Translate(tx/2, ty/2)
|
geometryMatrix.Translate(tx/2, ty/2)
|
||||||
centerX := float64(game.ScreenWidth()) / 2
|
centerX := float64(game.ScreenWidth()) / 2
|
||||||
centerY := float64(game.ScreenHeight()) / 2
|
centerY := float64(game.ScreenHeight()) / 2
|
||||||
|
@ -42,7 +42,7 @@ func display() {
|
|||||||
|
|
||||||
//export mouse
|
//export mouse
|
||||||
func mouse(button, state, x, y C.int) {
|
func mouse(button, state, x, y C.int) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//export idle
|
//export idle
|
||||||
|
Loading…
Reference in New Issue
Block a user