mirror of
https://github.com/tobspr/shapez.io.git
synced 2024-10-27 20:34:29 +00:00
Minor fixes, improve rendering performance
This commit is contained in:
parent
b05182a1cc
commit
9f0435b51d
@ -32,7 +32,7 @@ export const globalConfig = {
|
|||||||
|
|
||||||
// Map
|
// Map
|
||||||
mapChunkSize: 32,
|
mapChunkSize: 32,
|
||||||
mapChunkPrerenderMinZoom: 0.7,
|
mapChunkPrerenderMinZoom: 1.5,
|
||||||
mapChunkOverviewMinZoom: 0.7,
|
mapChunkOverviewMinZoom: 0.7,
|
||||||
|
|
||||||
// Belt speeds
|
// Belt speeds
|
||||||
|
@ -77,7 +77,9 @@ export class HUDBuildingsToolbar extends BaseHUDPart {
|
|||||||
spriteWrapper.innerHTML = sprite.getAsHTML(iconSize * dimensions.x, iconSize * dimensions.y);
|
spriteWrapper.innerHTML = sprite.getAsHTML(iconSize * dimensions.x, iconSize * dimensions.y);
|
||||||
binding.add(() => this.selectBuildingForPlacement(metaBuilding));
|
binding.add(() => this.selectBuildingForPlacement(metaBuilding));
|
||||||
|
|
||||||
this.trackClicks(itemContainer, () => this.selectBuildingForPlacement(metaBuilding), {});
|
this.trackClicks(itemContainer, () => this.selectBuildingForPlacement(metaBuilding), {
|
||||||
|
clickSound: null,
|
||||||
|
});
|
||||||
|
|
||||||
this.buildingHandles[metaBuilding.id] = {
|
this.buildingHandles[metaBuilding.id] = {
|
||||||
metaBuilding,
|
metaBuilding,
|
||||||
@ -131,6 +133,7 @@ export class HUDBuildingsToolbar extends BaseHUDPart {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.root.soundProxy.playUiClick();
|
||||||
this.sigBuildingSelected.dispatch(metaBuilding);
|
this.sigBuildingSelected.dispatch(metaBuilding);
|
||||||
this.onSelectedPlacementBuildingChanged(metaBuilding);
|
this.onSelectedPlacementBuildingChanged(metaBuilding);
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,7 @@ export class StaticMapEntitySystem extends GameSystem {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const drawEntitiesOutside = parameters.zoomLevel < globalConfig.mapChunkPrerenderMinZoom;
|
||||||
const drawOutlinesOnly = parameters.zoomLevel < globalConfig.mapChunkOverviewMinZoom;
|
const drawOutlinesOnly = parameters.zoomLevel < globalConfig.mapChunkOverviewMinZoom;
|
||||||
|
|
||||||
const contents = chunk.contents;
|
const contents = chunk.contents;
|
||||||
@ -55,10 +56,11 @@ export class StaticMapEntitySystem extends GameSystem {
|
|||||||
if (spriteKey) {
|
if (spriteKey) {
|
||||||
// Check if origin is contained to avoid drawing entities multiple times
|
// Check if origin is contained to avoid drawing entities multiple times
|
||||||
if (
|
if (
|
||||||
staticComp.origin.x >= chunk.tileX &&
|
drawEntitiesOutside ||
|
||||||
|
(staticComp.origin.x >= chunk.tileX &&
|
||||||
staticComp.origin.x < chunk.tileX + globalConfig.mapChunkSize &&
|
staticComp.origin.x < chunk.tileX + globalConfig.mapChunkSize &&
|
||||||
staticComp.origin.y >= chunk.tileY &&
|
staticComp.origin.y >= chunk.tileY &&
|
||||||
staticComp.origin.y < chunk.tileY + globalConfig.mapChunkSize
|
staticComp.origin.y < chunk.tileY + globalConfig.mapChunkSize)
|
||||||
) {
|
) {
|
||||||
const sprite = Loader.getSprite(spriteKey);
|
const sprite = Loader.getSprite(spriteKey);
|
||||||
staticComp.drawSpriteOnFullEntityBounds(parameters, sprite, 2, false);
|
staticComp.drawSpriteOnFullEntityBounds(parameters, sprite, 2, false);
|
||||||
|
Loading…
Reference in New Issue
Block a user