diff options
author | Ninjune <enderknight537@gmail.com> | 2022-12-22 03:21:02 -0600 |
---|---|---|
committer | Ninjune <enderknight537@gmail.com> | 2022-12-22 03:21:02 -0600 |
commit | 329dccf50ed5e9f87531580f679522238b6a019b (patch) | |
tree | 3053852d322db744822a7dd2a05fd59d2b1e90b7 /render/guis/timerGui.js | |
parent | 1ffc0a89be42fcde95a04a87cc00dbc347b27ece (diff) | |
download | coleweight-329dccf50ed5e9f87531580f679522238b6a019b.tar.gz coleweight-329dccf50ed5e9f87531580f679522238b6a019b.tar.bz2 coleweight-329dccf50ed5e9f87531580f679522238b6a019b.zip |
v1.8.3
Diffstat (limited to 'render/guis/timerGui.js')
-rw-r--r-- | render/guis/timerGui.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/render/guis/timerGui.js b/render/guis/timerGui.js new file mode 100644 index 0000000..0487f2b --- /dev/null +++ b/render/guis/timerGui.js @@ -0,0 +1,43 @@ +import settings from "../../settings"; +import constants from "../../util/constants"; + + +const timerGui = new Gui() + +export function openTimerGui() +{ + timerGui.open() +} + +register("dragged", (dx, dy, x, y) => { + if (!timerGui.isOpen()) return + constants.timerdata.x = x + constants.timerdata.y = y + constants.timerdata.save() +}); + +register("renderOverlay", () => { + if (timerGui.isOpen()) + { + let txt = "Drag to move." + Renderer.drawStringWithShadow(txt, Renderer.screen.getWidth()/2 - Renderer.getStringWidth(txt)/2, Renderer.screen.getHeight()/2) + } + if (!settings.timerVisible) return + + let timerHr = Math.floor(constants.timerdata.timer/60/60), message + + if(timerHr >= 1) + message = `&aTimer: &b${timerHr}h ${Math.floor(constants.timerdata.timer/60) - timerHr*60}m` + else + 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', () => { + constants.timerdata.timer = 0 +}) + +register("step", () => { + constants.timerdata.timer += 1 +}).setFps(1)
\ No newline at end of file |