adds first pass api client functionality, updates manifest to include entire app

This commit is contained in:
Sundog Jones 2024-07-01 11:54:51 -04:00
parent b516b526ba
commit 51a6d89cea
2 changed files with 20 additions and 3 deletions

View File

@ -67,6 +67,8 @@
<div id="map-view"></div> <div id="map-view"></div>
<div id="player-map-icon"><div class="playerMapIcon"><div>👤</div></div></div> <div id="player-map-icon"><div class="playerMapIcon"><div>👤</div></div></div>
<script language="javascript"> <script language="javascript">
var player;
var globalZoom = 19; // default zoom level var globalZoom = 19; // default zoom level
var globalPosition = new THREE.Vector3(); var globalPosition = new THREE.Vector3();
@ -137,10 +139,16 @@ AFRAME.registerComponent('camera-logger', {
L.DomUtil.addClass(marker._icon, 'small-marker'); L.DomUtil.addClass(marker._icon, 'small-marker');
} }
}); });
var debugText = "<p>Time: " + this.data.seconds + "</p>\n";
debugText += "<p>Position: " + worldPos.x.toFixed(6) + ", " + worldPos.z.toFixed(6) + "</p>\n";
debugText += "<p>Distance to marker[0]: " + globalMap.distance(currentPosition, globalMarkers[0]._latlng).toFixed(1) + " meters</p>\n";
if (player && player.nickname) {
debugText = "<p><strong>You are " + player.nickname + "</strong></p>\n" + debugText;
}
document.querySelector('#debug-view').innerHTML = "<p>Time: " + this.data.seconds document.querySelector('#debug-view').innerHTML = debugText;
+ "</p><p>Camera Position: (" + worldPos.x.toFixed(6) + ", " + worldPos.y.toFixed(2) + ", " + worldPos.z.toFixed(6) + ")</p>"
+ "</p><p>Distance to marker[0]: " + globalMap.distance(currentPosition, globalMarkers[0]._latlng).toFixed(1) + " meters</p>";
}); });
}, },
@ -157,6 +165,14 @@ AFRAME.registerComponent('camera-logger', {
} }
}, },
}); });
// fetch player info from API
fetch("https://wander.reclaim.technology/webserver/api/me.php").then((response) => {
return response.text();
}).then((playerJSON) => {
player = JSON.parse(playerJSON);
});
</script> </script>
<div id="ar-view"> <div id="ar-view">
<a-scene vr-mode-ui='enabled: false' arjs='sourceType: webcam; videoTexture: true; debugUIEnabled: true' renderer='antialias: true; alpha: true'> <a-scene vr-mode-ui='enabled: false' arjs='sourceType: webcam; videoTexture: true; debugUIEnabled: true' renderer='antialias: true; alpha: true'>

View File

@ -14,5 +14,6 @@
} }
], ],
"start_url": "https://wander.reclaim.technology/webserver/play/", "start_url": "https://wander.reclaim.technology/webserver/play/",
"scope": "https://wander.reclaim.technology/",
"display": "fullscreen" "display": "fullscreen"
} }