Skip to content

Commit

Permalink
Removed debug prints and debug sample annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
smilefx committed Feb 6, 2025
1 parent 9f10a77 commit 0cf7eab
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 47 deletions.
9 changes: 0 additions & 9 deletions bgw-docs/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 0 additions & 5 deletions bgw-docs/parser/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -122,23 +122,18 @@ 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 {
Expand Down
9 changes: 0 additions & 9 deletions bgw-docs/website/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<T : ComponentView>(
componentView: T,
Expand Down Expand Up @@ -83,10 +79,6 @@ class MovementAnimation<T : ComponentView>(
* @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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -34,25 +37,50 @@ import tools.aqua.bgw.visual.ColorVisual
internal class ExampleAnimationScene : BoardGameScene(width = 622, height = 300) {
val map = mutableMapOf<String, String>()

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() {
Expand All @@ -63,6 +91,10 @@ internal class ExampleAnimationScene : BoardGameScene(width = 622, height = 300)
playAnimation(movementAnimationBy)
}

fun playDiceAnimation() {
playAnimation(diceAnimation)
}

private fun <T : ComponentView> playAnimationAndSerialize(
anim: KProperty0<Animation>,
prop: KProperty0<T>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
}
Expand Down

0 comments on commit 0cf7eab

Please sign in to comment.