diff --git a/bgw-docs/build.gradle.kts b/bgw-docs/build.gradle.kts index 87bb96285..6e7b73e69 100644 --- a/bgw-docs/build.gradle.kts +++ b/bgw-docs/build.gradle.kts @@ -80,23 +80,14 @@ val GENERATE_SAMPLES_DEFAULT = false fun buildPropertyFile() { val propertyFile = "Config.kt" rootDir.resolve("bgw-gui/src/jsMain/kotlin/tools/aqua/bgw/${propertyFile}").apply { - println("Generate properties into $absolutePath") parentFile.mkdirs() writeText(generateProperties()) } rootDir.resolve("bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/application/${propertyFile}").apply { - println("Generate properties into $absolutePath") parentFile.mkdirs() writeText(generateProperties("application")) } - - val useSockets = project.findProperty("useSockets")?.toString()?.toBoolean() ?: USE_SOCKET_DEFAULT - val generateSamples = - project.findProperty("generateSamples")?.toString()?.toBoolean() ?: GENERATE_SAMPLES_DEFAULT - - println("useSockets: $useSockets") - println("generateSamples: $generateSamples") } fun generateProperties(suffix: String = ""): String { diff --git a/bgw-docs/parser/build.gradle.kts b/bgw-docs/parser/build.gradle.kts index e9c835959..34e2ce902 100644 --- a/bgw-docs/parser/build.gradle.kts +++ b/bgw-docs/parser/build.gradle.kts @@ -122,13 +122,11 @@ val GENERATE_SAMPLES_DEFAULT = false fun buildPropertyFile() { val propertyFile = "Config.kt" rootDir.resolve("bgw-gui/src/jsMain/kotlin/tools/aqua/bgw/${propertyFile}").apply { - println("Generate properties into $absolutePath") parentFile.mkdirs() writeText(generateProperties()) } rootDir.resolve("bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/application/${propertyFile}").apply { - println("Generate properties into $absolutePath") parentFile.mkdirs() writeText(generateProperties("application")) } @@ -136,9 +134,6 @@ fun buildPropertyFile() { val useSockets = project.findProperty("useSockets")?.toString()?.toBoolean() ?: USE_SOCKET_DEFAULT val generateSamples = project.findProperty("generateSamples")?.toString()?.toBoolean() ?: GENERATE_SAMPLES_DEFAULT - - println("useSockets: $useSockets") - println("generateSamples: $generateSamples") } fun generateProperties(suffix: String = ""): String { diff --git a/bgw-docs/website/build.gradle.kts b/bgw-docs/website/build.gradle.kts index 23b39e68f..2d5ba1eda 100644 --- a/bgw-docs/website/build.gradle.kts +++ b/bgw-docs/website/build.gradle.kts @@ -76,23 +76,14 @@ val GENERATE_SAMPLES_DEFAULT = false fun buildPropertyFile() { val propertyFile = "Config.kt" rootDir.resolve("bgw-gui/src/jsMain/kotlin/tools/aqua/bgw/${propertyFile}").apply { - println("Generate properties into $absolutePath") parentFile.mkdirs() writeText(generateProperties()) } rootDir.resolve("bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/application/${propertyFile}").apply { - println("Generate properties into $absolutePath") parentFile.mkdirs() writeText(generateProperties("application")) } - - val useSockets = project.findProperty("useSockets")?.toString()?.toBoolean() ?: USE_SOCKET_DEFAULT - val generateSamples = - project.findProperty("generateSamples")?.toString()?.toBoolean() ?: GENERATE_SAMPLES_DEFAULT - - println("useSockets: $useSockets") - println("generateSamples: $generateSamples") } fun generateProperties(suffix: String = ""): String { diff --git a/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/animation/MovementAnimation.kt b/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/animation/MovementAnimation.kt index f5d0bf21b..d4f41a6a9 100644 --- a/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/animation/MovementAnimation.kt +++ b/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/animation/MovementAnimation.kt @@ -44,10 +44,6 @@ import tools.aqua.bgw.util.Coordinate * @see ComponentView * * @since 0.1 - * - * @sample tools.aqua.bgw.main.examples.ExampleAnimationScene.greyToken - * @sample tools.aqua.bgw.main.examples.ExampleAnimationScene.movementAnimationTo - * @sample tools.aqua.bgw.main.examples.ExampleAnimationScene.playMovementAnimationTo */ class MovementAnimation( componentView: T, @@ -83,10 +79,6 @@ class MovementAnimation( * @see ComponentView * * @since 0.1 - * - * @sample tools.aqua.bgw.main.examples.ExampleAnimationScene.redToken - * @sample tools.aqua.bgw.main.examples.ExampleAnimationScene.movementAnimationBy - * @sample tools.aqua.bgw.main.examples.ExampleAnimationScene.playMovementAnimationBy */ constructor( componentView: T, diff --git a/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/components/uicomponents/Button.kt b/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/components/uicomponents/Button.kt index d4dce7965..a4faf34ed 100644 --- a/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/components/uicomponents/Button.kt +++ b/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/components/uicomponents/Button.kt @@ -42,9 +42,6 @@ import tools.aqua.bgw.visual.Visual * @param visual Visual for this button. Default: [ColorVisual.WHITE] * * @since 0.1 - * - * @sample tools.aqua.bgw.main.examples.ExampleUIScene.button - * @sample tools.aqua.bgw.main.examples.ExampleUIScene.button2 */ open class Button( posX: Number = 0, diff --git a/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/main/examples/ExampleAnimationScene.kt b/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/main/examples/ExampleAnimationScene.kt index 13922ae23..f6c52890e 100644 --- a/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/main/examples/ExampleAnimationScene.kt +++ b/bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/main/examples/ExampleAnimationScene.kt @@ -22,10 +22,13 @@ import jsonMapper import kotlin.reflect.KProperty0 import kotlinx.serialization.encodeToString import tools.aqua.bgw.animation.Animation +import tools.aqua.bgw.animation.DiceAnimation import tools.aqua.bgw.animation.MovementAnimation import tools.aqua.bgw.components.ComponentView +import tools.aqua.bgw.components.gamecomponentviews.DiceView import tools.aqua.bgw.components.gamecomponentviews.TokenView import tools.aqua.bgw.core.BoardGameScene +import tools.aqua.bgw.core.Color import tools.aqua.bgw.main.examples.ExampleAnimationScene as AnimationScene import tools.aqua.bgw.mapper.AnimationMapper import tools.aqua.bgw.visual.ColorVisual @@ -34,25 +37,50 @@ import tools.aqua.bgw.visual.ColorVisual internal class ExampleAnimationScene : BoardGameScene(width = 622, height = 300) { val map = mutableMapOf() - val greyToken = - TokenView(posX = 100, posY = 50, width = 100, height = 160, visual = ColorVisual.LIGHT_GRAY) + val greenToken = + TokenView( + posX = 100, posY = 100, width = 100, height = 100, visual = ColorVisual(Color(0xc6ff6e))) - val redToken = - TokenView(posX = 100, posY = 50, width = 100, height = 160, visual = ColorVisual.LIGHT_GRAY) + val blueToken = + TokenView( + posX = 100, posY = 100, width = 100, height = 100, visual = ColorVisual(Color(0x6dbeff))) /** Creates a movement animation that moves the token from x = 100 to x = 200 in 1 second. */ val movementAnimationTo = - MovementAnimation(componentView = greyToken, fromX = 100.0, toX = 200.0, duration = 1000) + MovementAnimation(componentView = greenToken, fromX = 100.0, toX = 200.0, duration = 1000) - /** Creates a movement animation that moves the token by x = 200 and y = 50 in 2 seconds. */ + /** Creates a movement animation that moves the token by x = 200 and y = -50 in 0.5 seconds. */ val movementAnimationBy = - MovementAnimation(componentView = redToken, byX = 200.0, byY = 50.0, duration = 2000) + MovementAnimation(componentView = blueToken, byX = 200.0, byY = -50.0, duration = 500) + + val diceCustomSide = + DiceView( + posX = 261, + posY = 100, + width = 100, + height = 100, + visuals = + listOf( + ColorVisual(Color(0xc6ff6e)), + ColorVisual(Color(0xffc656)), + ColorVisual(Color(0xfa6c56)), + ColorVisual(Color(0xef4444)), + ColorVisual(Color(0xbb6dff)), + ColorVisual(Color(0x6dbeff)))) + + /** + * Creates a dice animation that rolls the dice to side 3 (red) in 1 second. It shuffles the + * visual 20 times in that duration until landing on the desired side. + */ + val diceAnimation = DiceAnimation(dice = diceCustomSide, toSide = 3, speed = 20, duration = 1000) init { - setComponentAndSerialize(::greyToken) - setComponentAndSerialize(::redToken) - playAnimationAndSerialize(::movementAnimationTo, ::greyToken) - playAnimationAndSerialize(::movementAnimationBy, ::redToken) + setComponentAndSerialize(::greenToken) + setComponentAndSerialize(::blueToken) + setComponentAndSerialize(::diceCustomSide) + playAnimationAndSerialize(::movementAnimationTo, ::greenToken) + playAnimationAndSerialize(::movementAnimationBy, ::blueToken) + playAnimationAndSerialize(::diceAnimation, ::diceCustomSide) } fun playMovementAnimationTo() { @@ -63,6 +91,10 @@ internal class ExampleAnimationScene : BoardGameScene(width = 622, height = 300) playAnimation(movementAnimationBy) } + fun playDiceAnimation() { + playAnimation(diceAnimation) + } + private fun playAnimationAndSerialize( anim: KProperty0, prop: KProperty0 diff --git a/buildSrc/src/main/kotlin/tools.aqua.bgw.multiplatform-conventions.gradle.kts b/buildSrc/src/main/kotlin/tools.aqua.bgw.multiplatform-conventions.gradle.kts index 888ddce26..653d007f5 100644 --- a/buildSrc/src/main/kotlin/tools.aqua.bgw.multiplatform-conventions.gradle.kts +++ b/buildSrc/src/main/kotlin/tools.aqua.bgw.multiplatform-conventions.gradle.kts @@ -45,13 +45,11 @@ val wrappersVersion = "-pre.831" fun buildDefaultPropertyFile() { println("Build default property files") rootDir.resolve("bgw-gui/src/jsMain/kotlin/tools/aqua/bgw/${propertyFile}").apply { - println("Generate properties into $absolutePath") parentFile.mkdirs() writeText(generateDefaultProperties()) } rootDir.resolve("bgw-gui/src/jvmMain/kotlin/tools/aqua/bgw/application/${propertyFile}").apply { - println("Generate properties into $absolutePath") parentFile.mkdirs() writeText(generateDefaultProperties("application")) }