mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-23 08:11:33 +11:00
show mobile controls on a small screen (#624)
This commit is contained in:
commit
754435ad1e
|
@ -19,6 +19,10 @@ const MobileControls = styled.div`
|
|||
flex-direction: column;
|
||||
margin-bottom: 40px;
|
||||
|
||||
@media (min-width: 500px) {
|
||||
display: none;
|
||||
}
|
||||
|
||||
touch-action: none;
|
||||
|
||||
img {
|
||||
|
|
|
@ -63,6 +63,12 @@ const GameSide = styled.div`
|
|||
}
|
||||
`;
|
||||
|
||||
const ShowOnWideScreen = styled.div`
|
||||
@media (max-width: 500px) {
|
||||
display: none;
|
||||
}
|
||||
`;
|
||||
|
||||
const isTouchScreen = () => navigator.maxTouchPoints > 1;
|
||||
|
||||
function shouldStartPlaying(isTouchScreen: boolean | undefined) {
|
||||
|
@ -108,9 +114,9 @@ const MgbaWithControllerSides = () => {
|
|||
</GameSide>
|
||||
</GamePanelWrapper>
|
||||
</GameDisplay>
|
||||
{shouldUseTouchScreenInput ? (
|
||||
<MobileController mgba={mgbaHandle} />
|
||||
) : (
|
||||
|
||||
<MobileController mgba={mgbaHandle} />
|
||||
<ShowOnWideScreen>
|
||||
<CenteredBlock>
|
||||
<p>
|
||||
Press escape to open the menu where you can view or change controls
|
||||
|
@ -119,7 +125,7 @@ const MgbaWithControllerSides = () => {
|
|||
on the main menu to switch game.
|
||||
</p>
|
||||
</CenteredBlock>
|
||||
)}
|
||||
</ShowOnWideScreen>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue