gctGenerator/site/.vuepress/components/codes/InstantRestart/config.vue
sup39 898ea733ac Rewrote drawText and related codes
- Reduced parameters to struct pointer + format string + varargs
- Rewrote QFT, Pattern Selector, Customized Display with the new drawText function
- Added PAL font (TODO: NTSC-U)
- Merged P/A/S Display and Speed Display to Customized Display
- Provided background options to Pattern Selector and Customized Display
2023-01-29 04:39:18 +09:00

66 lines
1.8 KiB
Vue

<template>
<div id="config">
<h3>{{l('h3Config')}}</h3>
<div>
<span>{{l('lblButton')}}</span>
<div v-for="info in buttonInfos" class="inline" :key="info.value">
<input type="checkbox" :checked="button & info.value"
@change="toggleButton($event, info.value)"><span>{{info.text}}</span>
</div>
</div>
<div>
<span>{{l('lblDPad')}}</span>
<div v-for="info in dpadButtonInfos" class="inline" :key="info.value">
<input type="checkbox" :checked="button & info.value"
@change="toggleButton($event, info.value)"><span>{{info.text}}</span>
</div>
</div>
<div v-if="button & buttonValues.Z" class="custom-block danger">
<p>{{l('pCautionZ')}}</p>
</div>
</div>
</template>
<script>
import { makeUpdateConfig } from '../utils.js';
import {getConfig, defaultConfig, lskey, buttonValues} from './codegen.js';
import labels from './labels.json';
export default {
methods: {
updateConfig: makeUpdateConfig(lskey, defaultConfig),
toggleButton(event, value) {
this.button = event.target.checked ?
this.button | value : // ON
this.button & ~value; // OFF
this.updateConfig();
},
l(id) {
return labels[id][this.$lang] ?? labels[id]['en-US'];
},
},
data() {
const {button} = getConfig();
return {
button,
// const
buttonInfos: [
'A', 'B', 'X', 'Y', 'L', 'R', 'Z',
].map(text => ({text, value: buttonValues[text]})),
dpadButtonInfos: [
{text: '←', value: buttonValues.DL},
{text: '↓', value: buttonValues.DD},
{text: '↑', value: buttonValues.DU},
{text: '→', value: buttonValues.DR},
],
buttonValues,
};
},
}
</script>
<style>
.inline {
display: inline-block;
}
</style>