diff options
Diffstat (limited to 'src/main/kotlin/Logger.kt')
| -rw-r--r-- | src/main/kotlin/Logger.kt | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/main/kotlin/Logger.kt b/src/main/kotlin/Logger.kt new file mode 100644 index 0000000..a9b30c5 --- /dev/null +++ b/src/main/kotlin/Logger.kt @@ -0,0 +1,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" + } + } + + +}
\ No newline at end of file |