merge setPosition and focusOn into setViewport
This commit is contained in:
parent
a1c96b0524
commit
d62b116e5d
9 changed files with 44 additions and 116 deletions
|
@ -8,33 +8,22 @@
|
|||
WA.camera.onCameraUpdate((worldView) => console.log(worldView));
|
||||
WA.onInit().then(() => {
|
||||
console.log('After WA init');
|
||||
const setPositionButton = document.getElementById('setPositionButton');
|
||||
const focusOnButton = document.getElementById('focusOnButton');
|
||||
const setViewportButton = document.getElementById('setViewportButton');
|
||||
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');
|
||||
const lockField = document.getElementById('lock');
|
||||
|
||||
setPositionButton.addEventListener('click', () => {
|
||||
console.log('SET POSITION BUTTON PRESSED');
|
||||
console.log(smoothField.checked);
|
||||
WA.camera.setPosition(
|
||||
parseInt(xField.value),
|
||||
parseInt(yField.value),
|
||||
parseInt(widthField.value),
|
||||
parseInt(heightField.value),
|
||||
smoothField.checked,
|
||||
);
|
||||
});
|
||||
|
||||
focusOnButton.addEventListener('click', () => {
|
||||
WA.camera.focusOn(
|
||||
setViewportButton.addEventListener('click', () => {
|
||||
WA.camera.setViewport(
|
||||
parseInt(xField.value),
|
||||
parseInt(yField.value),
|
||||
parseInt(widthField.value),
|
||||
parseInt(heightField.value),
|
||||
lockField.checked,
|
||||
smoothField.checked,
|
||||
);
|
||||
});
|
||||
|
@ -52,9 +41,9 @@ Y: <input type="text" id="y" value="64" /><br/>
|
|||
width: <input type="text" id="width" value="600" /><br/>
|
||||
height: <input type="text" id="height" value="400" /><br/>
|
||||
Smooth: <input type="checkbox" id="smooth" value=1 /><br/>
|
||||
Lock: <input type="checkbox" id="lock" value=1 /><br/>
|
||||
|
||||
<button id="setPositionButton">Set Position</button>
|
||||
<button id="focusOnButton">Focus On</button>
|
||||
<button id="setViewportButton">Set Viewport</button>
|
||||
<button id="followPlayerButton">Follow Player</button>
|
||||
|
||||
</body>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue