mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-11-10 04:57:26 +01:00
Center the ebiten
This commit is contained in:
parent
93565f79a9
commit
d54c484165
@ -123,7 +123,8 @@ func (game *DemoGame) Draw(g graphics.GraphicsContext, offscreen graphics.Textur
|
||||
geometryMatrix.Translate(-tx/2, -ty/2)
|
||||
geometryMatrix.Rotate(float64(game.x) / 60)
|
||||
geometryMatrix.Translate(tx/2, ty/2)
|
||||
geometryMatrix.Translate(100, 100)
|
||||
centerX, centerY := float64(offscreen.Width) / 2, float64(offscreen.Height) / 2
|
||||
geometryMatrix.Translate(centerX - tx/2, centerY - ty/2)
|
||||
g.DrawTexture(game.ebitenTexture.ID,
|
||||
0, 0, int(tx), int(ty),
|
||||
geometryMatrix,
|
||||
|
Loading…
Reference in New Issue
Block a user