UNTESTED: ebiten v2

This commit is contained in:
2020-11-21 19:27:09 +00:00
parent c5e6abb798
commit 92fa0fc5d6
22 changed files with 92 additions and 132 deletions

View File

@@ -10,7 +10,7 @@ import (
"path/filepath"
"time"
"github.com/hajimehoshi/ebiten"
"github.com/hajimehoshi/ebiten/v2"
"code.ur.gs/lupine/ordoor/internal/maps"
"code.ur.gs/lupine/ordoor/internal/sets"
@@ -173,11 +173,7 @@ func (e *env) Update(screenX, screenY int) error {
func (e *env) Draw(screen *ebiten.Image) error {
gameMap := e.gameMap
rect := gameMap.Rect()
imd, err := ebiten.NewImage(rect.Dx(), rect.Dy(), ebiten.FilterDefault)
if err != nil {
return err
}
imd := ebiten.NewImage(rect.Dx(), rect.Dy())
for y := int(rect.Min.Y); y < int(rect.Max.Y); y++ {
for x := int(rect.Min.X); x < int(rect.Max.X); x++ {
@@ -193,7 +189,9 @@ func (e *env) Draw(screen *ebiten.Image) error {
cam.Scale(e.state.zoom, e.state.zoom) // apply current zoom factor
cam.Rotate(0.785) // Apply isometric angle
return screen.DrawImage(imd, &ebiten.DrawImageOptions{GeoM: cam})
screen.DrawImage(imd, &ebiten.DrawImageOptions{GeoM: cam})
return nil
}
// Converts pixel coordinates to cell coordinates