Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 37 additions & 27 deletions src/components/DOM/BGM/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,45 @@ const BGM = () => {
return `${minutes}:${seconds}`;
};

const safeDuration = trackDuration || 0;

return (
<>
{bgmLoaded && (
<div className={styles.bgmMenu}>
<span className={styles.bgmButtons}>
<input
className={bgmPlaying ? "" : styles.paused}
type="image"
src={bgmPlaying ? pause : play}
onClick={togglePlayback}
/>
<input type="image" src={next} onClick={nextTrack} />
</span>
<input
className={styles.trackProgress}
type="range"
min={0}
max={trackDuration}
step={0.1}
value={playbackPosition}
onChange={(e) => playFromPosition(parseFloat(e.target.value))}
/>
<span className={styles.trackDuration}>
{convertTime(playbackPosition)} / {convertTime(trackDuration)}
</span>
</div>
)}
</>
<div className={styles.bgmMenu}>
<span className={styles.bgmButtons}>
<input
className={bgmPlaying ? "" : styles.paused}
type="image"
src={bgmPlaying ? pause : play}
onClick={togglePlayback}
disabled={!bgmLoaded}
/>
<input
type="image"
src={next}
onClick={nextTrack}
disabled={!bgmLoaded}
/>
</span>

<input
className={styles.trackProgress}
type="range"
min={0}
max={safeDuration || 1}
step={0.1}
value={bgmLoaded ? playbackPosition : 0}
onChange={(e) => playFromPosition(parseFloat(e.target.value))}
disabled={!bgmLoaded}
/>

<span className={styles.trackDuration}>
{bgmLoaded
? `${convertTime(playbackPosition)} / ${convertTime(trackDuration)}`
: "Loading..."}
</span>
</div>
);
};


export default BGM;
15 changes: 12 additions & 3 deletions src/components/DOM/DMenu/Options.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ import { CompactPicker } from "react-color";
import { useState } from "react";

import Slider from "./Slider";
import { useAudio, useDice } from "../../../contexts";
import { useDice, useSFX } from "../../../contexts";

import styles from "./Options.module.scss";
import { validDice } from "../../../utils";
import Credits from "./Credits";

const Options = ({}) => {
const { volumes, updateVolume } = useAudio();
const { diceAttributes, diceOptions, updateAttributes, updateOptions } =
const { volumes, updateVolume } = useSFX();
const { diceAttributes, diceOptions, updateAttributes, updateOptions, gravity, setGravity } =
useDice();
const [selectedForColor, setSelectedForColor] = useState("D4");
const [selectedForSize, setSelectedForSize] = useState("D4");
Expand Down Expand Up @@ -103,6 +103,15 @@ const Options = ({}) => {
: diceAttributes.sizes[selectedForSize] ?? 0
}
/>
<Slider
className={styles.slider}
label="Gravity"
min={1}
max={12}
step={0.1}
update={(value) => setGravity([0, -value, 0])}
value={gravity ? -gravity[1] : 9.81}
/>
{!diceOptions.globalSize && (
<div className={styles.sizeButtons}>
{validDice.map((d) => (
Expand Down
6 changes: 1 addition & 5 deletions src/components/R3F/Dx/D10.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,11 +66,7 @@ const D10 = (props) => {
return retVal;
}, [geometryArgs]);

return (
<Dx {...props} geometry={geometry}>
<polyhedronGeometry args={[...geometryArgs, props.radius, 0]} />
</Dx>
);
return <Dx {...props} geometry={geometry} />;
};

export default D10;
6 changes: 1 addition & 5 deletions src/components/R3F/Dx/D12.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ const D12 = (props) => {
return retVal;
}, []);

return (
<Dx {...props} geometry={geometry}>
<dodecahedronGeometry args={[props.radius]} />
</Dx>
);
return <Dx {...props} geometry={geometry} />;
};

export default D12;
6 changes: 1 addition & 5 deletions src/components/R3F/Dx/D20.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ const D20 = (props) => {
return retVal;
}, []);

return (
<Dx {...props} geometry={geometry}>
<icosahedronGeometry args={[props.radius, 0]} />
</Dx>
);
return <Dx {...props} geometry={geometry} />;
};

export default D20;
6 changes: 1 addition & 5 deletions src/components/R3F/Dx/D4.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ const D4 = (props) => {
return retVal;
}, []);

return (
<Dx {...props} geometry={geometry} inertiaMod={D4_CONST.INERTIA_MOD}>
<tetrahedronGeometry args={[props.radius, 0]} />
</Dx>
);
return <Dx {...props} geometry={geometry} inertiaMod={D4_CONST.INERTIA_MOD} />;
};

export default D4;
6 changes: 1 addition & 5 deletions src/components/R3F/Dx/D6.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ const D6 = (props) => {
return retVal;
}, [geometryArgs]);

return (
<Dx {...props} geometry={geometry}>
<polyhedronGeometry args={[...geometryArgs, props.radius, 0]} />
</Dx>
);
return <Dx {...props} geometry={geometry} />;
};

export default D6;
6 changes: 1 addition & 5 deletions src/components/R3F/Dx/D8.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ const D8 = (props) => {
return retVal;
}, []);

return (
<Dx geometry={geometry} {...props}>
<octahedronGeometry args={[props.radius]} />
</Dx>
);
return <Dx {...props} geometry={geometry} />;
};

export default D8;
Loading