diff options
| author | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-07-05 19:11:31 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <ruben@unlimited.pizza> | 2022-07-05 19:11:31 +0200 |
| commit | 3717f7fbf9ec110b51fe002cdced5d73ebd6136b (patch) | |
| tree | 6caa301bddd630dddfcc524c33c8d35d78baa05d /src/lib/components/hud.svelte | |
| parent | f106543fe9cf1def42f2af9f011acf0c83ddd411 (diff) | |
Move things to components
Diffstat (limited to 'src/lib/components/hud.svelte')
| -rw-r--r-- | src/lib/components/hud.svelte | 30 |
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> |