fix sound selector
+ favicon + temporary debug log for sound in RectangleClient
This commit is contained in:
BIN
srcs/requirements/svelte/api_front/public/favicon.ico
Normal file
BIN
srcs/requirements/svelte/api_front/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.1 KiB |
@@ -6,7 +6,7 @@
|
||||
|
||||
<title>Potato Pong</title>
|
||||
|
||||
<link rel='icon' type='image/png' href='/favicon.png'>
|
||||
<link rel='icon' type='image/x-icon' href='/favicon.ico'>
|
||||
<link rel='stylesheet' href='/global.css'>
|
||||
<link rel='stylesheet' href='/build/bundle.css'>
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
let optionsAreNotSet = true
|
||||
|
||||
let soundMutedFlag = false;
|
||||
let sound = "on"; // possible de faire un boolean avec svelte et radio buttons ?
|
||||
let multi_balls = false;
|
||||
let moving_walls = false;
|
||||
let matchOptions : enumeration.MatchOptions = enumeration.MatchOptions.noOption;
|
||||
@@ -23,9 +23,14 @@
|
||||
|
||||
// En async au cas où pour la suite mais apriori inutile, les check se feront sûrement au onMount
|
||||
const init = async() => {
|
||||
console.log(soundMutedFlag);
|
||||
if (sound === "off") {
|
||||
initAudio(true);
|
||||
}
|
||||
else if (sound === "on") {
|
||||
initAudio(false);
|
||||
}
|
||||
console.log(sound);
|
||||
|
||||
initAudio(soundMutedFlag);
|
||||
if (multi_balls === true) {
|
||||
matchOptions |= enumeration.MatchOptions.multiBalls;
|
||||
}
|
||||
@@ -86,9 +91,9 @@
|
||||
<div>
|
||||
<!-- svelte-ignore a11y-label-has-associated-control -->
|
||||
<label>sound :</label>
|
||||
<input type="radio" id="sound_on" name="sound_selector" bind:group={soundMutedFlag} value=false checked>
|
||||
<input type="radio" id="sound_on" name="sound_selector" bind:group={sound} value="on">
|
||||
<label for="sound_on">on</label>
|
||||
<input type="radio" id="sound_off" name="sound_selector" bind:group={soundMutedFlag} value=true>
|
||||
<input type="radio" id="sound_off" name="sound_selector" bind:group={sound} value="off">
|
||||
<label for="sound_off">off</label>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
@@ -81,7 +81,9 @@ export class BallClient extends Ball implements GraphicComponent {
|
||||
}
|
||||
bounce(collider?: Rectangle) {
|
||||
this._bounceAlgo(collider);
|
||||
soundPongArr[ Math.floor(random(0, soundPongArr.length)) ].play();
|
||||
let i = Math.floor(random(0, soundPongArr.length));
|
||||
soundPongArr[ i ].play();
|
||||
console.log(`sound_i=${i}`); // debug log
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user