UNTESTED: ebiten v2
This commit is contained in:
@@ -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
|
||||
|
Reference in New Issue
Block a user