From 61f813aa1ab67ffcf0be66e6690c04a1c501c21e Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Fri, 18 Mar 2022 21:09:00 +0800 Subject: - fix dungeon map heads not loading - potential fix features breaking when first loading in --- features/hud/HudTextElement.js | 45 ++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 21 deletions(-) (limited to 'features/hud/HudTextElement.js') diff --git a/features/hud/HudTextElement.js b/features/hud/HudTextElement.js index 8177c43..2acbe67 100644 --- a/features/hud/HudTextElement.js +++ b/features/hud/HudTextElement.js @@ -82,28 +82,31 @@ class HudTextElement{ } renderRaw(){ - let [text, blackText] = this.getText() + try{ + let [text, blackText] = 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: + 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) - 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: - 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; - } - }) - Renderer.scale(1, 1) + Renderer.drawString(line, this.locationSetting.x/this.locationSetting.scale, this.locationSetting.y/this.locationSetting.scale +9*i) + break; + } + }) + Renderer.scale(1, 1) + }catch(e){ //incase of wrong opengl context + } } } -- cgit