diff --git a/gradle.properties b/gradle.properties index 3727d6e..6025622 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,7 @@ -korgePluginVersion=1.12.8.0 +korgePluginVersion=1.13.0.1 +#korimVersion=1.12.23-SNAPSHOT +#korgwVersion=1.12.12-SNAPSHOT +#korgeVersion=1.13.0-SNAPSHOT #korgeVersion=1.12.8-SNAPSHOT #korimVersion=1.12.15 #korimVersion=1.12.11-SNAPSHOT diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 62d4c05..490fda8 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 6623300..622ab64 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index fbd7c51..2fe81a7 100755 --- a/gradlew +++ b/gradlew @@ -82,7 +82,6 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -130,7 +129,6 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index a9f778a..9109989 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -84,7 +84,6 @@ set CMD_LINE_ARGS=%* set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - @rem Execute Gradle "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% diff --git a/sample-asteroids/sample.html b/sample-asteroids/sample.html new file mode 100644 index 0000000..f3177c2 --- /dev/null +++ b/sample-asteroids/sample.html @@ -0,0 +1,24 @@ + + + + + + diff --git a/sample-asteroids/src/commonMain/kotlin/main.kt b/sample-asteroids/src/commonMain/kotlin/main.kt index cb5e99b..f615828 100644 --- a/sample-asteroids/src/commonMain/kotlin/main.kt +++ b/sample-asteroids/src/commonMain/kotlin/main.kt @@ -1,5 +1,7 @@ import com.soywiz.kds.* import com.soywiz.klock.* +import com.soywiz.klock.hr.hrMicroseconds +import com.soywiz.klock.hr.hrMilliseconds import com.soywiz.korev.* import com.soywiz.korge.* import com.soywiz.korge.view.* @@ -48,8 +50,8 @@ suspend fun main() = Korge( } var bulletReload = 0.0 - addUpdater { time -> - val scale = time / 16.milliseconds + addHrUpdater { time -> + val scale = time / 16.hrMilliseconds if (pressing(Key.LEFT)) ship.rotation -= 3.degrees * scale if (pressing(Key.RIGHT)) ship.rotation += 3.degrees * scale if (pressing(Key.UP)) ship.advance(2.0 * scale) @@ -100,17 +102,17 @@ class Asteroid(val assets: Assets, val asteroidSize: Int = 3) : Image(assets.ast scale = asteroidSize.toDouble() / 3.0 name = "asteroid" speed = 0.6 - addUpdater { time -> - val scale = time / 16.milliseconds + addHrUpdater { time -> + val scale = time / 16.hrMilliseconds val dx = angle.cosine * scale val dy = angle.sine * scale x += dx y += dy + rotationDegrees += scale if (y < 0 && dy < 0) angle += 45.degrees if (x < 0 && dx < 0) angle += 45.degrees if (x > WIDTH && dx > 0) angle += 45.degrees if (y > HEIGHT && dy > 0) angle += 45.degrees - rotationDegrees += scale } } @@ -146,7 +148,7 @@ inline fun View.advance(amount: Number, rot: Angle = (-90).degrees) = advance(am class Assets(val views: Views, val shipSize: Int = 24) { val asteroidSize = shipSize * 2 val shipBitmap = NativeImage(shipSize, shipSize).context2d { - lineWidth = shipSize * 0.05 + lineWidth = 0.05 lineCap = LineCap.ROUND stroke(Colors.WHITE) { scale(shipSize) @@ -165,8 +167,8 @@ class Assets(val views: Views, val shipSize: Int = 24) { lineToV(height) } } - val asteroidBitmap = NativeImage(asteroidSize, asteroidSize).context2d { - lineWidth = asteroidSize * 0.05 + val asteroidBitmap = Bitmap32(asteroidSize, asteroidSize).context2d { // Let's use software vector rendering here, for testing purposes + lineWidth = 0.05 lineCap = LineCap.ROUND stroke(Colors.WHITE) { scale(asteroidSize) diff --git a/sample-atlas/src/commonMain/kotlin/main.kt b/sample-atlas/src/commonMain/kotlin/main.kt index 010dfa0..2f4b727 100644 --- a/sample-atlas/src/commonMain/kotlin/main.kt +++ b/sample-atlas/src/commonMain/kotlin/main.kt @@ -11,7 +11,7 @@ suspend fun main() = Korge(width = 640, height = 480, virtualWidth = 320, virtua suspend fun Stage.atlasMain() { val logos = resourcesVfs["logos.atlas.json"].readAtlas(views) - image(logos["korau.png"].texture).position(0, 0) - image(logos["korim.png"].texture).position(64, 32) - image(logos["korge.png"].texture).position(128, 64) + image(logos["korau.png"]).position(0, 0) + image(logos["korim.png"]).position(64, 32) + image(logos["korge.png"]).position(128, 64) } diff --git a/sample-atlas/src/commonTest/kotlin/test.kt b/sample-atlas/src/commonTest/kotlin/test.kt index a30f14a..3dfdb0a 100644 --- a/sample-atlas/src/commonTest/kotlin/test.kt +++ b/sample-atlas/src/commonTest/kotlin/test.kt @@ -18,10 +18,10 @@ class AtlasTest : ViewsForTesting() { @Test fun testAtlas() = suspendTest { val atlas = resourcesVfs["logos.atlas.json"].readAtlas(views) - assertEquals(3, atlas.textures.size) - assertEquals(Size(64, 64), atlas.textures["korau.png"]!!.texture.size) - assertEquals(Size(64, 64), atlas.textures["korge.png"]!!.texture.size) - assertEquals(Size(64, 64), atlas.textures["korim.png"]!!.texture.size) + assertEquals(3, atlas.entries.size) + assertEquals(Size(64, 64), atlas["korau.png"].size) + assertEquals(Size(64, 64), atlas["korge.png"].size) + assertEquals(Size(64, 64), atlas["korim.png"].size) } private val BmpSlice.size get() = Size(width, height) diff --git a/sample-lipsync/src/commonMain/kotlin/main.kt b/sample-lipsync/src/commonMain/kotlin/main.kt index bfc10fc..6a223d9 100644 --- a/sample-lipsync/src/commonMain/kotlin/main.kt +++ b/sample-lipsync/src/commonMain/kotlin/main.kt @@ -8,18 +8,18 @@ import com.soywiz.korio.file.std.* suspend fun main() = Korge { val atlas = resourcesVfs["lips.atlas.json"].readAtlas(views) - val lips = image(atlas["lisa-A.png"].texture) - val lips2 = image(atlas["lisa-A.png"].texture).position(400, 0) + val lips = image(atlas["lisa-A.png"]) + val lips2 = image(atlas["lisa-A.png"]).position(400, 0) addEventListener { println(it) if (it.name == "lisa") { - lips2.texture = atlas["lisa-${it.lip}.png"].texture + lips2.texture = atlas["lisa-${it.lip}.png"] } } launchImmediately { fun handler(it: LipSyncEvent) { views.dispatch(it) - lips.texture = atlas["lisa-${it.lip}.png"].texture + lips.texture = atlas["lisa-${it.lip}.png"] } resourcesVfs["001.voice.wav"].readVoice().play("lisa") { handler(it) } diff --git a/sample-pong/.gitignore b/sample-pong/.gitignore new file mode 100644 index 0000000..796b96d --- /dev/null +++ b/sample-pong/.gitignore @@ -0,0 +1 @@ +/build