-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: π Sounds not working in web build
β Closes: #111
- Loading branch information
1 parent
2a9e0d8
commit f79fbcf
Showing
5 changed files
with
70 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import React, { useEffect } from "react"; | ||
import Title from "../common/Title"; | ||
import Subtitle from "../common/Subtitle"; | ||
import { StartScreenProps } from "../../types/menu"; | ||
import { version } from "../../../package.json"; | ||
|
||
function StartGame({ setScreen }: StartScreenProps) { | ||
|
||
useEffect(() => { | ||
const handleKeyPress = () => { | ||
setScreen('splash'); | ||
} | ||
|
||
document.addEventListener('keydown', handleKeyPress); | ||
document.addEventListener('mousedown', handleKeyPress); | ||
|
||
return () => { | ||
document.removeEventListener('keydown', handleKeyPress); | ||
document.removeEventListener('mousedown', handleKeyPress); | ||
} | ||
}, []) | ||
|
||
return ( | ||
<div> | ||
<Title text="Press any button to start a game" /> | ||
<Subtitle text={version} classes="white absolute bottom-with-small-margin left no-margin z-index-1 text-shadow" /> | ||
</div> | ||
) | ||
} | ||
|
||
export default StartGame; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
export const isElectron = () => { | ||
// Renderer process | ||
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') { | ||
return true; | ||
} | ||
|
||
// Main process | ||
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) { | ||
return true; | ||
} | ||
|
||
// Detect the user agent when the `nodeIntegration` option is set to true | ||
if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) { | ||
return true; | ||
} | ||
|
||
return false; | ||
} |