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

Large diffs are not rendered by default.

364 changes: 189 additions & 175 deletions dist-web/assets/index-CLk3m9pJ.js → dist-web/assets/index-Cf6tBKHh.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist-web/assets/index-Dpa5W6zO.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist-web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link href="https://fonts.googleapis.com/css2?family=VT323&family=Press+Start+2P&display=swap" rel="stylesheet" />
<script type="module" crossorigin src="./assets/index-CLk3m9pJ.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-PfENYlSH.css">
<script type="module" crossorigin src="./assets/index-Cf6tBKHh.js"></script>
<link rel="stylesheet" crossorigin href="./assets/index-BIRVDxh0.css">
</head>
<body>
<!-- 3D WebGL Canvas -->
Expand Down
293 changes: 7 additions & 286 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@
"license": "MIT",
"dependencies": {
"@sinclair/typebox": "^0.34.14",
"nipplejs": "^1.0.4",
"xxhash-wasm": "^1.1.0",
"zustand": "^5.0.15"
},
Expand Down
22 changes: 19 additions & 3 deletions src/demo/games/echoes-of-blackwood/game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,14 @@ export class EchoesOfBlackwoodGame {
private update(dt: number): void {
if ((window as unknown as { __renderoniPaused?: boolean }).__renderoniPaused) return;
const keys = this.keys;
const mobileMove = this.engine.input.getMoveVector();
const mobileLook = this.engine.input.consumeLookDelta();
this.yawAngle -= mobileLook.dx * 0.004;
this.pitchAngle -= mobileLook.dy * 0.004;
this.pitchAngle = Math.max(-Math.PI / 2.1, Math.min(Math.PI / 2.1, this.pitchAngle));

if (this.engine.input.consumeButtonPress('interact')) this.tryInteract();
if (this.engine.input.consumeButtonPress('flashlight')) this.toggleFlashlight();

// 1. Smooth Keyboard Turning (ArrowLeft / ArrowRight)
const turnSpeed = 2.4;
Expand All @@ -212,8 +220,8 @@ export class EchoesOfBlackwoodGame {
const rightX = Math.cos(this.yawAngle);
const rightZ = -Math.sin(this.yawAngle);

let dirX = 0;
let dirZ = 0;
let dirX = forwardX * mobileMove.z + rightX * mobileMove.x;
let dirZ = forwardZ * mobileMove.z + rightZ * mobileMove.x;
if (keys['KeyW'] || keys['ArrowUp']) { dirX += forwardX; dirZ += forwardZ; }
if (keys['KeyS'] || keys['ArrowDown']) { dirX -= forwardX; dirZ -= forwardZ; }
if (keys['KeyD']) { dirX += rightX; dirZ += rightZ; }
Expand Down Expand Up @@ -481,7 +489,7 @@ export class EchoesOfBlackwoodGame {
useHorrorStore.getState().dismissInspect();
return;
}
if (!this.isLocked) {
if (!this.isLocked && navigator.maxTouchPoints === 0) {
this.canvas.requestPointerLock();
}
};
Expand All @@ -493,6 +501,14 @@ export class EchoesOfBlackwoodGame {
window.addEventListener('mousemove', onMouseMove);
document.addEventListener('pointerlockchange', onPointerLockChange);
this.canvas.addEventListener('click', onClick);
this.engine.input.attachMobileControls({
lookElement: this.canvas,
buttons: [
{ name: 'interact', label: 'USE', ariaLabel: 'Interact' },
{ name: 'flashlight', label: 'LIGHT', ariaLabel: 'Toggle flashlight' },
],
joystickColor: '#ef4444',
});

this.unbindInput.push(() => {
window.removeEventListener('keydown', onKeyDown);
Expand Down
Loading