diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/CtrlLib.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/CtrlLib.kt index 5ff83e43..134aed04 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/CtrlLib.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/CtrlLib.kt @@ -114,7 +114,7 @@ class CtrlLib( "- 1: right click or two fingers\n" + "- 2: middle click or three fingers\n\n" + "If you need to check that the touch/mouse button is still active, see `ctrl.touching` instead.", - CTRL_TOUCHED_EXAMPLE + CTRL_TOUCHED_EXAMPLE, ) inner class touched : OneArgFunction() { diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SfxLib.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SfxLib.kt index 41d0580f..7d79d47c 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SfxLib.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SfxLib.kt @@ -240,7 +240,7 @@ class SfxLib( fun LuaTable.toWave(mod: Modulation?, env: Envelope): SoundGenerator { val noteIndex = this["note"].toint() val volume = this["volume"].toint() / 255f - if(noteIndex == 0 || volume <= 0) { + if (noteIndex == 0 || volume <= 0) { return Silence2(Note.C0, null, null, 0f) } return when (this["type"].tojstring()) { diff --git a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SprLib.kt b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SprLib.kt index de684c82..510b7472 100644 --- a/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SprLib.kt +++ b/tiny-engine/src/commonMain/kotlin/com/github/minigdx/tiny/lua/SprLib.kt @@ -88,8 +88,8 @@ class SprLib(val gameOptions: GameOptions, val resourceAccess: GameResourceAcces "Switch to another spritesheet. " + "The index of the spritesheet is given by it's position in the spritesheets field from the `_tiny.json` file." + "The first spritesheet is at the index 0. It retuns the previous spritesheet. " + - "The spritesheet can also be referenced by its filename.", - example = SPR_SHEET_EXAMPLE + "The spritesheet can also be referenced by its filename.", + example = SPR_SHEET_EXAMPLE, ) internal inner class sheet : OneArgFunction() { diff --git a/tiny-engine/src/jvmMain/kotlin/com/github/minigdx/tiny/platform/glfw/GlfwPlatform.kt b/tiny-engine/src/jvmMain/kotlin/com/github/minigdx/tiny/platform/glfw/GlfwPlatform.kt index d5875568..3d28b441 100644 --- a/tiny-engine/src/jvmMain/kotlin/com/github/minigdx/tiny/platform/glfw/GlfwPlatform.kt +++ b/tiny-engine/src/jvmMain/kotlin/com/github/minigdx/tiny/platform/glfw/GlfwPlatform.kt @@ -261,8 +261,6 @@ class GlfwPlatform( } override fun screenshot() { - // FIXME: it doesn't play well with camera - // FIXME: debug and camera doesn't play well also. val buffer = lastBuffer ?: return recordScope.launch { @@ -273,7 +271,12 @@ class GlfwPlatform( for (y in 0 until height) { for (x in 0 until width) { - val colorData = buffer.gamePalette.getRGBA(buffer.pixel(x, y)) + val colorData = buffer.gamePalette.getRGBA( + buffer.pixel( + x = buffer.camera.x + x, + y = buffer.camera.y + y, + ), + ) val r = colorData[0].toInt() and 0xff val g = colorData[1].toInt() and 0xff val b = colorData[2].toInt() and 0xff