From 504d8f4550f81d2df133331138dc20f0532cb0a9 Mon Sep 17 00:00:00 2001 From: mint Date: Thu, 6 May 2021 13:40:39 -0400 Subject: [PATCH] added rounding function --- rhythmblock.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/rhythmblock.lua b/rhythmblock.lua index bc365f0..1181d28 100644 --- a/rhythmblock.lua +++ b/rhythmblock.lua @@ -2,9 +2,13 @@ accentColor = colors.gray buttonColor = colors.lightGray backgroundColor = colors.black +function round(n) + return n % 1 >= 0.5 and math.ceil(n) or math.floor(n) +end + width, height = term.getSize() -centerWidth = math.round(width / 2) -centerHeight = math.round(width / 2) +centerWidth = round(width / 2) +centerHeight = round(width / 2) peripherals = peripheral.getNames() playing = false if #peripherals < 0 then