aboutsummaryrefslogtreecommitdiff
path: root/src/lib/components/hud.svelte
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2022-07-05 19:11:31 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2022-07-05 19:11:31 +0200
commit3717f7fbf9ec110b51fe002cdced5d73ebd6136b (patch)
tree6caa301bddd630dddfcc524c33c8d35d78baa05d /src/lib/components/hud.svelte
parentf106543fe9cf1def42f2af9f011acf0c83ddd411 (diff)
Move things to components
Diffstat (limited to 'src/lib/components/hud.svelte')
-rw-r--r--src/lib/components/hud.svelte30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/lib/components/hud.svelte b/src/lib/components/hud.svelte
new file mode 100644
index 0000000..ce32e0d
--- /dev/null
+++ b/src/lib/components/hud.svelte
@@ -0,0 +1,30 @@
+<script>
+ export let x;
+ export let y;
+
+ const kCoordinateLength = 6;
+ const kSeparatorRegex = /([0-9a-z]{2})/g;
+
+ const formatCoordinate = function formatCoordinate(coordinate) {
+ return coordinate
+ .toString(16)
+ .padStart(kCoordinateLength, 0)
+ .replace(kSeparatorRegex, '$1 ');
+ }
+</script>
+
+<div class="hud">
+ { formatCoordinate(x) } × { formatCoordinate(y) }
+</div>
+
+<style>
+ .hud {
+ background-color: #fff;
+ padding: 4px;
+ position: fixed;
+ bottom: 2px;
+ right: 2px;
+ font-smooth: never;
+ -webkit-font-smoothing : none;
+ }
+</style>