mirror of
https://github.com/OpenDiablo2/OpenDiablo2
synced 2024-12-27 20:46:32 -05:00
Increase draw distance up and down (#209)
* Scroll slowly in map test by holding shift * Increase draw distance up and down Avoid issues with long tiles popping in and out of view. (As long as camera is reasonably within bounds)
This commit is contained in:
parent
9117616b0c
commit
e70378d627
@ -218,16 +218,32 @@ func (v *MapEngineTest) Update(tickTime float64) {
|
||||
shiftPressed := v.uiManager.KeyPressed(ebiten.KeyShift)
|
||||
|
||||
if v.uiManager.KeyPressed(ebiten.KeyDown) {
|
||||
v.mapEngine.OffsetY -= tickTime * 800
|
||||
if v.uiManager.KeyPressed(ebiten.KeyShift) {
|
||||
v.mapEngine.OffsetY -= tickTime * 200
|
||||
} else {
|
||||
v.mapEngine.OffsetY -= tickTime * 800
|
||||
}
|
||||
}
|
||||
if v.uiManager.KeyPressed(ebiten.KeyUp) {
|
||||
v.mapEngine.OffsetY += tickTime * 800
|
||||
if v.uiManager.KeyPressed(ebiten.KeyShift) {
|
||||
v.mapEngine.OffsetY += tickTime * 200
|
||||
} else {
|
||||
v.mapEngine.OffsetY += tickTime * 800
|
||||
}
|
||||
}
|
||||
if v.uiManager.KeyPressed(ebiten.KeyLeft) {
|
||||
v.mapEngine.OffsetX += tickTime * 800
|
||||
if v.uiManager.KeyPressed(ebiten.KeyShift) {
|
||||
v.mapEngine.OffsetX += tickTime * 200
|
||||
} else {
|
||||
v.mapEngine.OffsetX += tickTime * 800
|
||||
}
|
||||
}
|
||||
if v.uiManager.KeyPressed(ebiten.KeyRight) {
|
||||
v.mapEngine.OffsetX -= tickTime * 800
|
||||
if v.uiManager.KeyPressed(ebiten.KeyShift) {
|
||||
v.mapEngine.OffsetX -= tickTime * 200
|
||||
} else {
|
||||
v.mapEngine.OffsetX -= tickTime * 800
|
||||
}
|
||||
}
|
||||
|
||||
if inpututil.IsKeyJustPressed(ebiten.KeyF7) {
|
||||
|
@ -180,7 +180,7 @@ func (v *Engine) GenTilesCache(region *EngineRegion) {
|
||||
func (v *Engine) RenderRegion(region EngineRegion, target *ebiten.Image) {
|
||||
for tileIdx := range region.Tiles {
|
||||
sx, sy := d2helper.IsoToScreen(region.Tiles[tileIdx].tileX+region.Rect.Left, region.Tiles[tileIdx].tileY+region.Rect.Top, int(v.OffsetX), int(v.OffsetY))
|
||||
if sx > -160 && sy > -160 && sx <= 880 && sy <= 1000 {
|
||||
if sx > -160 && sy > -380 && sx <= 880 && sy <= 1240 {
|
||||
v.RenderPass1(region.Region, region.Tiles[tileIdx].offX, region.Tiles[tileIdx].offY, region.Tiles[tileIdx].tileX, region.Tiles[tileIdx].tileY, target)
|
||||
if v.ShowTiles > 0 {
|
||||
v.DrawTileLines(region.Region, region.Tiles[tileIdx].offX, region.Tiles[tileIdx].offY, region.Tiles[tileIdx].tileX, region.Tiles[tileIdx].tileY, target)
|
||||
@ -190,13 +190,13 @@ func (v *Engine) RenderRegion(region EngineRegion, target *ebiten.Image) {
|
||||
}
|
||||
for tileIdx := range region.Tiles {
|
||||
sx, sy := d2helper.IsoToScreen(region.Tiles[tileIdx].tileX+region.Rect.Left, region.Tiles[tileIdx].tileY+region.Rect.Top, int(v.OffsetX), int(v.OffsetY))
|
||||
if sx > -160 && sy > -160 && sx <= 880 && sy <= 1000 {
|
||||
if sx > -160 && sy > -380 && sx <= 880 && sy <= 1240 {
|
||||
v.RenderPass2(region.Region, region.Tiles[tileIdx].offX, region.Tiles[tileIdx].offY, region.Tiles[tileIdx].tileX, region.Tiles[tileIdx].tileY, target)
|
||||
}
|
||||
}
|
||||
for tileIdx := range region.Tiles {
|
||||
sx, sy := d2helper.IsoToScreen(region.Tiles[tileIdx].tileX+region.Rect.Left, region.Tiles[tileIdx].tileY+region.Rect.Top, int(v.OffsetX), int(v.OffsetY))
|
||||
if sx > -160 && sy > -160 && sx <= 880 && sy <= 1000 {
|
||||
if sx > -160 && sy > -380 && sx <= 880 && sy <= 1240 {
|
||||
v.RenderPass3(region.Region, region.Tiles[tileIdx].offX, region.Tiles[tileIdx].offY, region.Tiles[tileIdx].tileX, region.Tiles[tileIdx].tileY, target)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user