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