diff options
author | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-06 21:40:49 +0800 |
---|---|---|
committer | Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> | 2022-05-06 21:40:49 +0800 |
commit | f0cfad5af93244618d5a60c88b1c0a4837e629ae (patch) | |
tree | 062a301f34c8e6d3284fa845676b23b2ab8d7f9a /features/hud | |
parent | e2e2d676ee056e9f44f6c67e29f0952b9ef956b2 (diff) | |
download | SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.tar.gz SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.tar.bz2 SoopyV2-f0cfad5af93244618d5a60c88b1c0a4837e629ae.zip |
+ Many performance improvements
+ Fix rescue mission waypoints
Diffstat (limited to 'features/hud')
-rw-r--r-- | features/hud/HudTextElement.js | 47 | ||||
-rw-r--r-- | features/hud/index.js | 3 |
2 files changed, 24 insertions, 26 deletions
diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js index 8646e45..3d09319 100644 --- a/features/hud/HudTextElement.js +++ b/features/hud/HudTextElement.js @@ -31,6 +31,7 @@ class HudTextElement { } setText(text = "") { + if (text === this.text) return this this.text = text if (this.locationSetting && this.locationSetting.shadowType === 2) { @@ -111,30 +112,28 @@ class HudTextElement { } renderRaw() { - try { - let text = this.getText() - - text.forEach((line, i) => { - Renderer.scale(this.locationSetting.scale, this.locationSetting.scale) - switch (this.locationSetting.shadowType) { - case 0: - Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) - break; - case 1: - Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) - break; - case 2: - let blackText = this.getBlackText() - Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) - Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) - Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i) - Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i) - - Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) - break; - } - }) - } catch (e) { }//incase of wrong opengl context + let text = this.getText() + + text.forEach((line, i) => { + Renderer.scale(this.locationSetting.scale, this.locationSetting.scale) + switch (this.locationSetting.shadowType) { + case 0: + Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) + break; + case 1: + Renderer.drawStringWithShadow(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) + break; + case 2: + let blackText = this.getBlackText() + Renderer.drawString(blackText[i], (this.locationSetting.x + 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) + Renderer.drawString(blackText[i], (this.locationSetting.x - 1) / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) + Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y + 1) / this.locationSetting.scale + 9 * i) + Renderer.drawString(blackText[i], this.locationSetting.x / this.locationSetting.scale, (this.locationSetting.y - 1) / this.locationSetting.scale + 9 * i) + + Renderer.drawString(line, this.locationSetting.x / this.locationSetting.scale, this.locationSetting.y / this.locationSetting.scale + 9 * i) + break; + } + }) } } diff --git a/features/hud/index.js b/features/hud/index.js index f3761d7..44ee38a 100644 --- a/features/hud/index.js +++ b/features/hud/index.js @@ -225,7 +225,7 @@ class Hud extends Feature { this.registerEvent("renderOverlay", this.renderHud) this.registerStep(true, 5, this.step) this.registerStep(false, 5, this.step_5second) - this.registerEvent("renderWorld", this.renderWorld) + this.registerEvent("renderWorld", this.renderWorld).registeredWhen(() => this.fpsEnabledSetting.getValue() && this.fpsFastSetting.getValue()) this.registerEvent("worldLoad", this.worldLoad) this.petLevels = {} @@ -378,7 +378,6 @@ class Hud extends Feature { } renderWorld() { - if (!this.fpsEnabledSetting.getValue() || !this.fpsFastSetting.getValue()) return this.framesSince++ let instant = this.Instant.now() |