fix cookie and font renderer bugs

This commit is contained in:
LabyStudio
2022-02-20 16:24:32 +01:00
parent 300e05c7e3
commit b82d211ff9
2 changed files with 3 additions and 3 deletions
+1 -1
View File
@@ -21,7 +21,7 @@ window.GameSettings = class {
save() {
for (let prop in this) {
document.cookie = prop + "=" + (this[prop] || "") + "; path=/";
document.cookie = prop + "=" + (this[prop] || "") + "; path=/; expires=Fri, 31 Dec 9999 23:59:59 GMT";
}
}
@@ -13,7 +13,7 @@ window.FontRenderer = class {
let bitMap = this.createBitMap(this.texture);
// Calculate character width
for (let i = 0; i < 128; i++) {
for (let i = 0; i < 256; i++) {
this.charWidths[i] = this.calculateCharacterWidthAt(bitMap, i % FontRenderer.BITMAP_SIZE, Math.floor(i / FontRenderer.BITMAP_SIZE)) + 2;
}
}
@@ -33,7 +33,7 @@ window.FontRenderer = class {
let alpha = bitMap[i + 3];
// Return width if there is a white pixel
if (red !== 0 || green !== 0 || blue !== 0 || alpha !== 0) {
if (red > 1 || green > 1 || blue > 1 || alpha > 1) {
return x - indexX * FontRenderer.FIELD_SIZE;
}
}