2021-12-16 16:08:41 +01:00
|
|
|
<!doctype html>
|
|
|
|
<html lang="en">
|
|
|
|
<head>
|
|
|
|
<script src="<?php echo $_SERVER["FRONT_URL"] ?>/iframe_api.js"></script>
|
|
|
|
<script>
|
|
|
|
window.addEventListener('load', () => {
|
2021-12-17 11:05:11 +01:00
|
|
|
//@ts-ignore
|
|
|
|
WA.camera.onCameraUpdate((worldView) => console.log(worldView));
|
2021-12-16 16:08:41 +01:00
|
|
|
WA.onInit().then(() => {
|
|
|
|
console.log('After WA init');
|
2022-01-14 11:41:37 +01:00
|
|
|
const setCameraButton = document.getElementById('setCameraButton');
|
2021-12-16 16:08:41 +01:00
|
|
|
const followPlayerButton = document.getElementById('followPlayerButton');
|
|
|
|
const xField = document.getElementById('x');
|
|
|
|
const yField = document.getElementById('y');
|
|
|
|
const widthField = document.getElementById('width');
|
|
|
|
const heightField = document.getElementById('height');
|
|
|
|
const smoothField = document.getElementById('smooth');
|
2022-01-13 16:08:16 +01:00
|
|
|
const lockField = document.getElementById('lock');
|
2021-12-16 16:08:41 +01:00
|
|
|
|
2022-01-14 11:41:37 +01:00
|
|
|
setCameraButton.addEventListener('click', () => {
|
|
|
|
WA.camera.set(
|
2021-12-16 16:08:41 +01:00
|
|
|
parseInt(xField.value),
|
|
|
|
parseInt(yField.value),
|
2022-01-13 16:43:58 +01:00
|
|
|
widthField.value ? parseInt(widthField.value) : undefined,
|
|
|
|
heightField.value ? parseInt(heightField.value) : undefined,
|
2022-01-13 16:08:16 +01:00
|
|
|
lockField.checked,
|
2021-12-16 16:08:41 +01:00
|
|
|
smoothField.checked,
|
|
|
|
);
|
|
|
|
});
|
|
|
|
|
|
|
|
followPlayerButton.addEventListener('click', () => {
|
|
|
|
WA.camera.followPlayer(smoothField.checked);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
})
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2022-01-13 18:54:38 +01:00
|
|
|
X: <input type="text" id="x" value="496" /><br/>
|
|
|
|
Y: <input type="text" id="y" value="655" /><br/>
|
|
|
|
width: <input type="text" id="width" value="480" /><br/>
|
|
|
|
height: <input type="text" id="height" value="286" /><br/>
|
2021-12-16 16:08:41 +01:00
|
|
|
Smooth: <input type="checkbox" id="smooth" value=1 /><br/>
|
2022-01-13 16:08:16 +01:00
|
|
|
Lock: <input type="checkbox" id="lock" value=1 /><br/>
|
2021-12-16 16:08:41 +01:00
|
|
|
|
2022-01-14 11:41:37 +01:00
|
|
|
<button id="setCameraButton">Set Camera</button>
|
2021-12-16 16:08:41 +01:00
|
|
|
<button id="followPlayerButton">Follow Player</button>
|
|
|
|
|
|
|
|
</body>
|
|
|
|
</html>
|