1
0
mirror of https://github.com/tobspr/shapez.io.git synced 2026-03-02 03:39:21 +00:00

Add smooth_zooming mod example, Fix UI toggle, (hopefully) fix vram issues, add latest discounts

This commit is contained in:
tobspr
2022-05-20 17:11:39 +02:00
parent 18f7ff1fea
commit c2c3bd67f4
7 changed files with 89 additions and 14 deletions

View File

@@ -132,17 +132,7 @@ $zindex: 100;
}
body.uiHidden {
.ingame_buildingsToolbar,
#ingame_HUD_PlacementHints,
#ingame_HUD_GameMenu,
#ingame_HUD_PinnedShapes,
#ingame_HUD_PuzzleBackToMenu,
#ingame_HUD_PuzzleNextPuzzle,
#ingame_HUD_PuzzleEditorReview,
#ingame_HUD_Notifications,
#ingame_HUD_TutorialHints,
#ingame_HUD_Waypoints,
#ingame_HUD_Waypoints_Hint {
> div {
display: none !important;
}
}

View File

@@ -68,7 +68,11 @@ export class BufferMaintainer {
// Filter sub cache
subCache.forEach((cacheEntry, subKey) => {
if (cacheEntry.lastUse < minIteration) {
if (
cacheEntry.lastUse < minIteration ||
// @ts-ignore
cacheEntry.canvas._contextLost
) {
unusedSubKeys.push(subKey);
freeCanvas(cacheEntry.canvas);
++deletedKeys;

View File

@@ -161,7 +161,20 @@ export function makeOffscreenBuffer(w, h, { smooth = true, reusable = true, labe
// Initial state
context.save();
canvas.addEventListener("webglcontextlost", () => {
console.warn("canvas::webglcontextlost", canvas);
// @ts-ignore
canvas._contextLost = true;
});
canvas.addEventListener("contextlost", () => {
console.warn("canvas::contextlost", canvas);
// @ts-ignore
canvas._contextLost = true;
});
}
// @ts-ignore
canvas._contextLost = false;
// @ts-ignore
canvas.label = label;

View File

@@ -119,7 +119,8 @@ export const globalConfig = {
currentDiscount: {
amount: 50,
until: Date.parse("April 25 2022 23:59 +2:00"),
from: Date.parse("May 23 2022 17:00 +2:00"),
until: Date.parse("May 30 2022 23:59 +2:00"),
active: false, // computed later
},
@@ -170,4 +171,6 @@ if (G_IS_DEV && globalConfig.debug.noArtificialDelays) {
}
globalConfig.currentDiscount.active =
!G_IS_STANDALONE && new Date().getTime() < globalConfig.currentDiscount.until;
!G_IS_STANDALONE &&
new Date().getTime() < globalConfig.currentDiscount.until &&
new Date().getTime() > globalConfig.currentDiscount.from;

View File

@@ -225,6 +225,12 @@ export class MapView extends BaseMap {
const dpi = this.backgroundCacheDPI;
parameters.context.scale(1 / dpi, 1 / dpi);
// @ts-ignore
if (this.cachedBackgroundCanvas._contextLost) {
freeCanvas(this.cachedBackgroundCanvas);
this.internalInitializeCachedBackgroundCanvases();
}
parameters.context.fillStyle = parameters.context.createPattern(
this.cachedBackgroundCanvas,
"repeat"