Profectus/src/components/TPS.vue

34 lines
599 B
Vue
Raw Permalink Normal View History

<template>
2023-05-11 23:32:10 -05:00
<div class="tpsDisplay" v-if="!tps.isNan()">TPS: {{ formatWhole(tps) }}</div>
</template>
2022-01-13 22:25:47 -06:00
<script setup lang="ts">
2022-03-03 21:39:48 -06:00
import state from "game/state";
2022-06-26 19:17:22 -05:00
import Decimal, { formatWhole } from "util/bignum";
2023-05-11 23:32:10 -05:00
import { computed } from "vue";
2022-01-13 22:25:47 -06:00
const tps = computed(() =>
Decimal.div(
state.lastTenTicks.length,
state.lastTenTicks.reduce((acc, curr) => acc + curr, 0)
)
);
</script>
<style scoped>
.tpsDisplay {
position: absolute;
left: 10px;
bottom: 10px;
z-index: 100;
}
.low {
color: var(--danger);
}
.fade-leave-to {
opacity: 0;
}
</style>