From: Ruben Beltran del Rio Date: Tue, 5 Jul 2022 21:34:03 +0000 (+0200) Subject: Create the sensor, move values to config X-Git-Url: https://git.r.bdr.sh/rbdr/canvas/commitdiff_plain/2df937df1372359babd123d1361e702a1a4b8168?ds=sidebyside;hp=3717f7fbf9ec110b51fe002cdced5d73ebd6136b Create the sensor, move values to config --- diff --git a/src/lib/components/hud.svelte b/src/lib/components/hud.svelte index ce32e0d..f79658a 100644 --- a/src/lib/components/hud.svelte +++ b/src/lib/components/hud.svelte @@ -1,14 +1,15 @@ diff --git a/src/lib/components/sensor.svelte b/src/lib/components/sensor.svelte index e69de29..da968a3 100644 --- a/src/lib/components/sensor.svelte +++ b/src/lib/components/sensor.svelte @@ -0,0 +1,34 @@ + diff --git a/src/lib/config.js b/src/lib/config.js new file mode 100644 index 0000000..3d243ed --- /dev/null +++ b/src/lib/config.js @@ -0,0 +1,2 @@ +export const coordinateLength = 6; +export const maxSize = Math.pow(16, coordinateLength); diff --git a/src/lib/math.js b/src/lib/math.js new file mode 100644 index 0000000..c745cdc --- /dev/null +++ b/src/lib/math.js @@ -0,0 +1,8 @@ +/** + * Modulo that acts well with negative numbers. + * @param {number} dividend the number to divide + * @param {number} divisor the divisor to calculate the remainder + */ +export const modulo = function modulo (dividend, divisor) { + return ((dividend % divisor) + divisor) % divisor +}; diff --git a/src/routes/index.svelte b/src/routes/index.svelte index 7d5a3ff..2943d23 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -1,12 +1,11 @@