diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2020-12-31 14:23:45 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2020-12-31 14:23:45 +0000 |
| commit | 29e52544d389f88a4af836ae1d82b838ed7a10c7 (patch) | |
| tree | 4c80995e8ed0f5b2bdcc55404d18ee03ed474fd1 /src/main/kotlin/Logger.kt | |
| parent | 3c3322ef1a7aca3517ff94f723004fb809dec6cd (diff) | |
| download | kotlin-raycaster-29e52544d389f88a4af836ae1d82b838ed7a10c7.tar.xz kotlin-raycaster-29e52544d389f88a4af836ae1d82b838ed7a10c7.zip | |
Fix texture loading. Add log overlay
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 |