2019-11-08 01:37:21 -05:00
|
|
|
package tests
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/hajimehoshi/ebiten"
|
|
|
|
|
2019-11-10 08:51:02 -05:00
|
|
|
_map "github.com/OpenDiablo2/OpenDiablo2/d2render/d2mapengine"
|
2019-11-08 01:37:21 -05:00
|
|
|
|
2019-11-10 03:36:53 -05:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2common"
|
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2core"
|
2019-11-10 08:51:02 -05:00
|
|
|
"github.com/OpenDiablo2/OpenDiablo2/d2data/d2mpq"
|
2019-11-08 01:37:21 -05:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMapGenerationPerformance(t *testing.T) {
|
2019-11-10 08:51:02 -05:00
|
|
|
d2mpq.InitializeCryptoBuffer()
|
2019-11-10 03:36:53 -05:00
|
|
|
d2common.ConfigBasePath = "../"
|
2019-11-08 11:05:51 -05:00
|
|
|
|
2019-11-10 03:36:53 -05:00
|
|
|
engine := d2core.CreateEngine()
|
|
|
|
gameState := d2core.CreateGameState()
|
2019-11-08 01:37:21 -05:00
|
|
|
mapEngine := _map.CreateMapEngine(gameState, engine.SoundManager, engine)
|
|
|
|
mapEngine.GenerateAct1Overworld()
|
|
|
|
surface, _ := ebiten.NewImage(800, 600, ebiten.FilterNearest)
|
|
|
|
for y := 0; y < 1000; y++ {
|
|
|
|
mapEngine.Render(surface)
|
|
|
|
mapEngine.OffsetY = float64(-y)
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|