diff options
author | Ninjune x <enderknight537@gmail.com> | 2022-11-17 16:56:06 -0600 |
---|---|---|
committer | Ninjune x <enderknight537@gmail.com> | 2022-11-17 16:56:06 -0600 |
commit | fb63481d2c5b7b468df6c5ebdee30178bc9155f5 (patch) | |
tree | 3ec467f8acb9594c7b5547426a3b640856dc7e37 /render/timerGui.js | |
parent | 9085ac77ce364572b14f132b64ead5cde2194607 (diff) | |
download | coleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.tar.gz coleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.tar.bz2 coleweight-fb63481d2c5b7b468df6c5ebdee30178bc9155f5.zip |
1.6.0 Changelog in releasesv1.6.1
Diffstat (limited to 'render/timerGui.js')
-rw-r--r-- | render/timerGui.js | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/render/timerGui.js b/render/timerGui.js new file mode 100644 index 0000000..a46451f --- /dev/null +++ b/render/timerGui.js @@ -0,0 +1,54 @@ +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"); + +export function openTimerGui() +{ + timerMove.open() +} + +register("dragged", (dx, dy, x, y) => { + if (!timerMove.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()) + { + let txt = "Click anywhere 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(timerHr >= 1) + timerGui.addLine(`&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`) +}) + +register('worldLoad', () => { + constants.timerdata.timer = 0 +}) + +register("step", () => { + constants.timerdata.timer += 1 +}).setFps(1)
\ No newline at end of file |