Skip to content

Commit

Permalink
Add titile scene
Browse files Browse the repository at this point in the history
  • Loading branch information
hayatroid committed Mar 27, 2024
1 parent e3c65e0 commit 5549e32
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
<script setup lang="ts">
import { ref } from 'vue'
import Title from './components/Title.vue'
import Game from './components/Game.vue'
const id = ref<number>(0)
const is_playing = ref<boolean>(false)
const gameStart = () => {
id.value = 0
is_playing.value = true
}
</script>

<template>
<Game :id="id" :key="id" @complete="id++" />
<Title v-if="!is_playing" @game-start="gameStart()" />
<Game v-else :id="id" :key="id" @complete="id++" />
</template>

<style scoped>
Expand Down
4 changes: 4 additions & 0 deletions src/components/Title.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
<script setup lang="ts">
const emits = defineEmits<{
gameStart: []
}>()
</script>

<template>
<button @click="emits('gameStart')">ゲームスタート!</button>
</template>

<style scoped>
Expand Down

0 comments on commit 5549e32

Please sign in to comment.