This commit is contained in:
Hajime Hoshi 2013-06-24 00:43:41 +09:00
parent 809f889631
commit dfc07f9a44
3 changed files with 8 additions and 8 deletions

View File

@ -17,7 +17,7 @@ type Monochrome struct {
func New() *Monochrome {
return &Monochrome{
ch: make(chan bool),
ch: make(chan bool),
colorMatrix: matrix.IdentityColor(),
}
}
@ -55,11 +55,11 @@ func (game *Monochrome) Init(tf graphics.TextureFactory) {
func mean(a, b matrix.Color, k float64) matrix.Color {
dim := a.Dim()
result := matrix.Color{}
for i := 0; i < dim - 1; i++ {
for i := 0; i < dim-1; i++ {
for j := 0; j < dim; j++ {
result.Elements[i][j] =
a.Elements[i][j] * (1 - k) +
b.Elements[i][j] * k
a.Elements[i][j]*(1-k) +
b.Elements[i][j]*k
}
}
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})
geometryMatrix := matrix.IdentityGeometry()
tx := game.ScreenWidth() / 2 - game.ebitenTexture.Width / 2
ty := game.ScreenHeight() / 2 - game.ebitenTexture.Height / 2
tx := game.ScreenWidth()/2 - game.ebitenTexture.Width/2
ty := game.ScreenHeight()/2 - game.ebitenTexture.Height/2
geometryMatrix.Translate(float64(tx), float64(ty))
g.DrawTexture(game.ebitenTexture.ID,
geometryMatrix, game.colorMatrix)

View File

@ -57,7 +57,7 @@ func (game *Rotating) Draw(g graphics.GraphicsContext, offscreen graphics.Textur
geometryMatrix := matrix.IdentityGeometry()
tx, ty := float64(game.ebitenTexture.Width), float64(game.ebitenTexture.Height)
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)
centerX := float64(game.ScreenWidth()) / 2
centerY := float64(game.ScreenHeight()) / 2

View File

@ -42,7 +42,7 @@ func display() {
//export mouse
func mouse(button, state, x, y C.int) {
}
//export idle