Skip to content

Commit

Permalink
cleaned up mobile css slightly
Browse files Browse the repository at this point in the history
  • Loading branch information
leomcelroy committed Aug 17, 2022
1 parent 92f022d commit 534d912
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 10 deletions.
1 change: 1 addition & 0 deletions dispatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ const ACTIONS = {
},
RENDER_MOBILE({ text }, state) {
render(document.querySelector(".root"), viewMobile(text));
// screen.orientation.lock('landscape');
},
RENDER(args, state) {
render(document.querySelector(".root"), view(state));
Expand Down
10 changes: 10 additions & 0 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ body {
padding: 20px;
}

.no-select {
-webkit-touch-callout: none; /* iOS Safari */
-webkit-user-select: none; /* Safari */
-khtml-user-select: none; /* Konqueror HTML */
-moz-user-select: none; /* Old versions of Firefox */
-ms-user-select: none; /* Internet Explorer/Edge */
user-select: none; /* Non-prefixed version, currently
supported by Chrome, Edge, Opera and Firefox */
}

.root {
display: flex;
flex-direction: column;
Expand Down
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sprig</title>
<link rel="manifest" href="manifest.json">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<script type="module" src="https://unpkg.com/[email protected]/dist/ionicons/ionicons.esm.js"></script>
Expand Down
4 changes: 4 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"display": "standalone",
"orientation": "landscape"
}
25 changes: 15 additions & 10 deletions mobile/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export const view = (text) => html`
margin: 0;
width: 100vw;
height: 100vh;
overflow: none;
}
.mobile-view {
Expand Down Expand Up @@ -49,6 +50,10 @@ export const view = (text) => html`
justify-content: center;
}
.mobile-button:active {
background: grey;
}
.input-button-w {
position: absolute;
top: calc(50% - 75px);
Expand Down Expand Up @@ -79,13 +84,13 @@ export const view = (text) => html`
right: calc(5% + 25px);
}
.input-button-j {
.input-button-l {
position: absolute;
top: calc(50% - 25px);
right: calc(5% - 25px);
}
.input-button-l {
.input-button-j {
position: absolute;
top: calc(50% - 25px);
right: calc(5% + 75px);;
Expand All @@ -100,20 +105,20 @@ export const view = (text) => html`
</style>
<div class="mobile-view">
<div class="wasd">
<div class="mobile-button input-button-w" @click=${() => dispatchKey("w")}>w</div>
<div class="mobile-button input-button-a" @click=${() => dispatchKey("a")}>a</div>
<div class="mobile-button input-button-s" @click=${() => dispatchKey("s")}>s</div>
<div class="mobile-button input-button-d" @click=${() => dispatchKey("d")}>d</div>
<div class="mobile-button no-select input-button-w" @click=${() => dispatchKey("w")}>w</div>
<div class="mobile-button no-select input-button-a" @click=${() => dispatchKey("a")}>a</div>
<div class="mobile-button no-select input-button-s" @click=${() => dispatchKey("s")}>s</div>
<div class="mobile-button no-select input-button-d" @click=${() => dispatchKey("d")}>d</div>
</div>
<div class="game-canvas-container">
<canvas class="game-canvas"></canvas>
<canvas class="game-text"></canvas>
</div>
<div class="wasd">
<div class="mobile-button input-button-i" @click=${() => dispatchKey("i")}>i</div>
<div class="mobile-button input-button-j" @click=${() => dispatchKey("j")}>j</div>
<div class="mobile-button input-button-k" @click=${() => dispatchKey("k")}>k</div>
<div class="mobile-button input-button-l" @click=${() => dispatchKey("l")}>l</div>
<div class="mobile-button no-select input-button-i" @click=${() => dispatchKey("i")}>i</div>
<div class="mobile-button no-select input-button-j" @click=${() => dispatchKey("j")}>j</div>
<div class="mobile-button no-select input-button-k" @click=${() => dispatchKey("k")}>k</div>
<div class="mobile-button no-select input-button-l" @click=${() => dispatchKey("l")}>l</div>
</div>
</div>
<div class="mobile-run" @click=${() => runGame(text)}>run</div>
Expand Down

0 comments on commit 534d912

Please sign in to comment.