Skip to content
Merged
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
1 change: 1 addition & 0 deletions e63334287a3deaa3/ironveil/es.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions e63334287a3deaa3/ironveil/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ <h2>Before you play</h2>
</div></div>

<div class="screen card-wrap" id="pause"><div class="card">
<h2>Paused</h2><p id="p-obj" data-noi18n></p>
<div class="t-btns"><button class="btn go" id="b-resume">Resume</button><button class="btn" id="b-psettings">Settings</button><button class="btn" id="b-pcontrols">Controls</button><button class="btn" id="b-restart">Restart mission</button><button class="btn" id="b-quit">Quit</button></div>
<h2>Paused</h2><p id="p-obj" data-noi18n></p><p id="p-tip" hidden>For full screen on iPhone: tap the aA button in the address bar, then Hide Toolbar. Turn the phone sideways for the widest view.</p>
<div class="t-btns"><button class="btn go" id="b-resume">Resume</button><button class="btn" id="b-psettings">Settings</button><button class="btn" id="b-pcontrols">Controls</button><button class="btn" id="b-full" hidden>Full screen</button><button class="btn" id="b-restart">Restart mission</button><button class="btn" id="b-quit">Quit</button></div>
</div></div>

<div class="screen card-wrap" id="dead"><div class="card">
Expand Down
6 changes: 6 additions & 0 deletions e63334287a3deaa3/ironveil/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
const S = MO.settings, on = (id, fn) => $(id).addEventListener('click', fn);
on('b-accept', () => { try { localStorage.setItem('ironveil:terms', '1'); } catch (e) {} show('title'); });
on('b-deploy', () => deploy(false)); on('b-again', () => deploy(false)); on('b-retry', () => deploy(true)); on('b-restart', () => { MO.audio.pause(false); deploy(false); });
// full screen where the browser allows a page to do it (Android, iPad, computers); iPhone Safari doesn't, so it gets a tip
const de = document.documentElement, canFull = !!(de.requestFullscreen || de.webkitRequestFullscreen), isFull = () => !!(document.fullscreenElement || document.webkitFullscreenElement);
$('b-full').hidden = !canFull; $('p-tip').hidden = canFull || !MO.touch;
const fullText = () => { $('b-full').textContent = MO.T(isFull() ? 'Exit full screen' : 'Full screen'); };
on('b-full', () => { try { if (isFull()) (document.exitFullscreen || document.webkitExitFullscreen).call(document); else { const p = (de.requestFullscreen || de.webkitRequestFullscreen).call(de, { navigationUI: 'hide' }); if (p && p.catch) p.catch(() => {}); } } catch (e) {} setTimeout(() => { fullText(); if (!isFull()) $('p-tip').hidden = false; }, 500); });
document.addEventListener('fullscreenchange', fullText); document.addEventListener('webkitfullscreenchange', fullText); fullText();
on('b-missions', missionList); on('b-mclose', () => show('title')); on('b-next', () => { const n = MO.missions.list.find((d) => d.num === MO.missions.current.num + 1); if (n) go(n.id); });
on('b-resume', () => pause(false)); on('b-quit', toTitle); on('b-dquit', toTitle); on('b-gquit', toTitle);
const open = (which) => () => { back = MO.screen; show(which); };
Expand Down
9 changes: 8 additions & 1 deletion e63334287a3deaa3/ironveil/js/render.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,13 @@
gl_FragColor = vec4(t * uFade, 1.0); }`, { tA: { value: null }, tB: { value: null }, uPx: { value: new THREE.Vector2() }, uExp: { value: 1 }, uBloom: { value: 0.09 }, uTime: { value: 0 }, uHurt: { value: 0 }, uLow: { value: 0 }, uFade: { value: 1 }, uFlash: { value: 0 }, uAim: { value: 0 } });
R.exposure = 1; R.hooks = []; R.w = 0; R.h = 0;
R.resize();
window.addEventListener('resize', R.resize);
// iPhone Safari sends 'resize' before the page has its new size (hiding the toolbar, turning the phone), so also
// watch the game area itself, and check again a moment after anything that can change the size
const later = () => { R.resize(); setTimeout(R.resize, 120); setTimeout(R.resize, 400); setTimeout(R.resize, 900); };
window.addEventListener('resize', later); window.addEventListener('orientationchange', later);
document.addEventListener('fullscreenchange', later); document.addEventListener('webkitfullscreenchange', later);
if (window.visualViewport) window.visualViewport.addEventListener('resize', later);
if (window.ResizeObserver) new ResizeObserver(() => R.resize()).observe(canvas.parentElement);
return r;
};

Expand All @@ -85,6 +91,7 @@
}
R.resize = () => {
const el = R.renderer.domElement.parentElement, w = el.clientWidth || innerWidth, h = el.clientHeight || innerHeight;
if (w === R.vw && h === R.vh && R.dpr === devicePixelRatio) return; R.dpr = devicePixelRatio;
R.renderer.setPixelRatio(Math.min(window.devicePixelRatio || 1, MO.touch ? 1.5 : 1.25) * R.Q.scale);
R.renderer.setSize(w, h, false);
R.camera.aspect = R.wcam.aspect = w / h; R.camera.updateProjectionMatrix(); R.wcam.updateProjectionMatrix();
Expand Down
Loading