2024-10-24 11:32:31 +02:00
|
|
|
<script lang="ts">
|
|
|
|
import { onMount } from "svelte";
|
|
|
|
|
|
|
|
import Village from "../board/Village.svelte";
|
|
|
|
import update from "../update";
|
|
|
|
import BuildingCreator from "./BuildingCreator.svelte";
|
|
|
|
import Resources from "./Resources.svelte";
|
2024-10-24 15:12:21 +02:00
|
|
|
import BuildingPanel from "./BuildingPanel.svelte";
|
2024-10-24 11:32:31 +02:00
|
|
|
|
|
|
|
|
|
|
|
onMount(() => {
|
|
|
|
let frame: number;
|
|
|
|
|
|
|
|
function loop(timestamp: number) {
|
|
|
|
frame = requestAnimationFrame(loop);
|
|
|
|
update(timestamp);
|
|
|
|
}
|
|
|
|
frame = requestAnimationFrame(loop);
|
|
|
|
|
|
|
|
return () => {
|
|
|
|
cancelAnimationFrame(frame);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<section class="hud">
|
|
|
|
<header>
|
|
|
|
<Resources />
|
|
|
|
</header>
|
|
|
|
<div class="buildings">
|
|
|
|
<Village />
|
|
|
|
</div>
|
|
|
|
</section>
|
|
|
|
<section class="overlay">
|
|
|
|
<BuildingCreator />
|
2024-10-24 15:12:21 +02:00
|
|
|
<BuildingPanel />
|
2024-10-24 11:32:31 +02:00
|
|
|
</section>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
.buildings {
|
|
|
|
margin-top: 2em;
|
|
|
|
}
|
|
|
|
|
|
|
|
.overlay {
|
|
|
|
left: 0;
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
}
|
|
|
|
</style>
|