blob: a9b30c503764a8997f57abbabb238d0ea3c51e7e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import kotlinx.browser.document
import org.w3c.dom.HTMLElement
object Logger {
private val logMessage = document.getElementById("log-message") as HTMLElement
private val logPosition = document.getElementById("log-position") as HTMLElement
fun log(message: String) {
logMessage.textContent = message
console.log(message)
}
fun logPosition(camera: Camera) {
with(camera) {
var normalisedRotation = rotation % 360
if(normalisedRotation < 0) normalisedRotation += 360
logPosition.textContent = "x: ${xPos.toRoundedString()} y: ${yPos.toRoundedString()} rotation: $normalisedRotation"
}
}
}
|