aboutsummaryrefslogtreecommitdiff
path: root/render/timerGui.js
diff options
context:
space:
mode:
Diffstat (limited to 'render/timerGui.js')
-rw-r--r--render/timerGui.js33
1 files changed, 11 insertions, 22 deletions
diff --git a/render/timerGui.js b/render/timerGui.js
index a46451f..87171ff 100644
--- a/render/timerGui.js
+++ b/render/timerGui.js
@@ -2,47 +2,36 @@ import settings from "../settings";
import constants from "../util/constants";
-const timerMove = new Gui(),
- timerGui = new Display()
-
-timerGui.setBackgroundColor(Renderer.color(0, 0, 0, 50));
-timerGui.setBackground("full");
+const timerGui = new Gui()
export function openTimerGui()
{
- timerMove.open()
+ timerGui.open()
}
register("dragged", (dx, dy, x, y) => {
- if (!timerMove.isOpen()) return
+ if (!timerGui.isOpen()) return
constants.timerdata.x = x
constants.timerdata.y = y
constants.timerdata.save()
});
register("renderOverlay", () => {
- timerGui.setShouldRender(false)
- timerGui.clearLines()
- timerGui.setRenderLoc(constants.timerdata.x, constants.timerdata.y)
-
- if (timerMove.isOpen())
+ if (timerGui.isOpen())
{
- let txt = "Click anywhere to move!"
+ let txt = "Drag to move."
Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2)
- timerGui.addLines([`&aTimer: &b0h 0m`])
- timerGui.setShouldRender(true)
- return
}
-
- if(!settings.timerVisible) return
- timerGui.setShouldRender(true)
- let timerHr = Math.floor(constants.timerdata.timer/60/60)
+ if (!settings.timerVisible) return
+ let timerHr = Math.floor(constants.timerdata.timer/60/60), message
if(timerHr >= 1)
- timerGui.addLine(`&aTimer: &b${timerHr}h ${Math.floor(constants.timerdata.timer/60) - timerHr*60}m`)
+ message = `&aTimer: &b${timerHr}h ${Math.floor(constants.timerdata.timer/60) - timerHr*60}m`
else
- timerGui.addLine(`&aTimer: &b${Math.floor(constants.timerdata.timer/60)}m ${Math.floor(constants.timerdata.timer%60)}s`)
+ message = `&aTimer: &b${Math.floor(constants.timerdata.timer/60)}m ${Math.floor(constants.timerdata.timer%60)}s`
+
+ Renderer.drawStringWithShadow(message, constants.timerdata.x, constants.timerdata.y)
})
register('worldLoad', () => {