Skip to content

Commit

Permalink
Update dependencies and Gradle (#338)
Browse files Browse the repository at this point in the history
* Version updates

- Vaadin version unified between framework and plugin
- Major Updates:
    - Gradle to 7.5
    - Kotlin to 1.7
    - OpenJFX to 18
    - Detekt to 1.21 (removes formatting from main plugin)
    - Git Versioning to 6 (changes type for tag patterns)
    - Kover to 0.6 (requires merging config)
    - Spotless to 6.9 (causes reformat)
- Various minor updates

* try updating the kotlin-dsl plugin version
  • Loading branch information
no-preserve-root authored Nov 28, 2022
1 parent 3ed72ef commit 63372fe
Show file tree
Hide file tree
Showing 40 changed files with 590 additions and 655 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,79 +102,66 @@ class ContainerExample : BoardGameApplication("Container Example") {
add(
Button(width = 80, posX = 220, text = "TOP").apply {
visual = ColorVisual.LIGHT_GRAY
onMouseClicked =
{
cardStack.alignment =
Alignment.of(VerticalAlignment.TOP, cardStack.alignment.horizontalAlignment)
linearLayout.alignment =
Alignment.of(
VerticalAlignment.TOP, linearLayout.alignment.horizontalAlignment)
}
onMouseClicked = {
cardStack.alignment =
Alignment.of(VerticalAlignment.TOP, cardStack.alignment.horizontalAlignment)
linearLayout.alignment =
Alignment.of(VerticalAlignment.TOP, linearLayout.alignment.horizontalAlignment)
}
})
add(
Button(width = 80, posX = 320, text = "CENTER").apply {
visual = ColorVisual.LIGHT_GRAY
onMouseClicked =
{
cardStack.alignment =
Alignment.of(
VerticalAlignment.CENTER, cardStack.alignment.horizontalAlignment)
linearLayout.alignment =
Alignment.of(
VerticalAlignment.CENTER, linearLayout.alignment.horizontalAlignment)
}
onMouseClicked = {
cardStack.alignment =
Alignment.of(VerticalAlignment.CENTER, cardStack.alignment.horizontalAlignment)
linearLayout.alignment =
Alignment.of(
VerticalAlignment.CENTER, linearLayout.alignment.horizontalAlignment)
}
})
add(
Button(width = 80, posX = 420, text = "BOTTOM").apply {
visual = ColorVisual.LIGHT_GRAY
onMouseClicked =
{
cardStack.alignment =
Alignment.of(
VerticalAlignment.BOTTOM, cardStack.alignment.horizontalAlignment)
linearLayout.alignment =
Alignment.of(
VerticalAlignment.BOTTOM, linearLayout.alignment.horizontalAlignment)
}
onMouseClicked = {
cardStack.alignment =
Alignment.of(VerticalAlignment.BOTTOM, cardStack.alignment.horizontalAlignment)
linearLayout.alignment =
Alignment.of(
VerticalAlignment.BOTTOM, linearLayout.alignment.horizontalAlignment)
}
})
add(
Button(width = 80, posX = 220, posY = 60, text = "LEFT").apply {
visual = ColorVisual.LIGHT_GRAY
onMouseClicked =
{
cardStack.alignment =
Alignment.of(
cardStack.alignment.verticalAlignment, HorizontalAlignment.LEFT)
linearLayout.alignment =
Alignment.of(
linearLayout.alignment.verticalAlignment, HorizontalAlignment.LEFT)
}
onMouseClicked = {
cardStack.alignment =
Alignment.of(cardStack.alignment.verticalAlignment, HorizontalAlignment.LEFT)
linearLayout.alignment =
Alignment.of(linearLayout.alignment.verticalAlignment, HorizontalAlignment.LEFT)
}
})
add(
Button(width = 80, posX = 320, posY = 60, text = "CENTER").apply {
visual = ColorVisual.LIGHT_GRAY
onMouseClicked =
{
cardStack.alignment =
Alignment.of(
cardStack.alignment.verticalAlignment, HorizontalAlignment.CENTER)
linearLayout.alignment =
Alignment.of(
linearLayout.alignment.verticalAlignment, HorizontalAlignment.CENTER)
}
onMouseClicked = {
cardStack.alignment =
Alignment.of(cardStack.alignment.verticalAlignment, HorizontalAlignment.CENTER)
linearLayout.alignment =
Alignment.of(
linearLayout.alignment.verticalAlignment, HorizontalAlignment.CENTER)
}
})
add(
Button(width = 80, posX = 420, posY = 60, text = "RIGHT").apply {
visual = ColorVisual.LIGHT_GRAY
onMouseClicked =
{
cardStack.alignment =
Alignment.of(
cardStack.alignment.verticalAlignment, HorizontalAlignment.RIGHT)
linearLayout.alignment =
Alignment.of(
linearLayout.alignment.verticalAlignment, HorizontalAlignment.RIGHT)
}
onMouseClicked = {
cardStack.alignment =
Alignment.of(cardStack.alignment.verticalAlignment, HorizontalAlignment.RIGHT)
linearLayout.alignment =
Alignment.of(
linearLayout.alignment.verticalAlignment, HorizontalAlignment.RIGHT)
}
})
add(
Button(width = 130, posX = 220, posY = 120, text = "VERTICAL").apply {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,9 @@ class UIComponentExample : BoardGameApplication("UIComponent Example") {
val progressBar =
ProgressBar(posX = 450, posY = 350, width = 300, progress = 0.5, barColor = Color.GREEN)

progressBar.onMouseClicked =
{
progressBar.progress =
if (progressBar.progress > 1.0) 0.0 else progressBar.progress + 0.05
}
progressBar.onMouseClicked = {
progressBar.progress = if (progressBar.progress > 1.0) 0.0 else progressBar.progress + 0.05
}

progressBar.progressProperty.addListener { _, newValue ->
when {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,66 +96,57 @@ class AnimationExample : BoardGameApplication("Animation example") {
private val die: DiceView = DiceView(posX = 1400, posY = 500, visuals = dieVisuals)

init {
buttonDelay.onMouseClicked =
{
gameScene.lock()
gameScene.playAnimation(
DelayAnimation(duration = 2000).apply {
onFinished =
{
println("Delay finished!")
gameScene.unlock()
showDialog(Dialog(DialogType.NONE, "", "", ""))
}
})
}
buttonMovement.onMouseClicked =
{
gameScene.playAnimation(
MovementAnimation(componentView = cardMovement, byX = 0, byY = -50, duration = 1000))
}
buttonRotation.onMouseClicked =
{
gameScene.playAnimation(
RotationAnimation(componentView = cardRotation, byAngle = 180.0, duration = 1000))
}
buttonOpacity.onMouseClicked =
{
gameScene.playAnimation(
FadeAnimation(
componentView = cardOpacity, fromOpacity = 1.0, toOpacity = 0.0, duration = 1000))
}
buttonStretch.onMouseClicked =
{
gameScene.playAnimation(
ScaleAnimation(componentView = cardStretch, byScale = 0.5, duration = 1000))
}
buttonFlip.onMouseClicked =
{
gameScene.playAnimation(
FlipAnimation(
gameComponentView = cardFlip,
fromVisual = cardFlip.backVisual,
toVisual = cardFlip.frontVisual,
duration = 1000))
}
buttonRandomize.onMouseClicked =
{
gameScene.playAnimation(
RandomizeAnimation(
gameComponentView = cardRandomize,
visuals = randomCardFaces,
toVisual = cardFlip.frontVisual,
duration = 1000,
speed = 50))
}
buttonDie.onMouseClicked =
{
gameScene.playAnimation(
DiceAnimation(dice = die, toSide = 3, duration = 1000, speed = 50).apply {
onFinished = { die.currentSide = 3 }
})
}
buttonDelay.onMouseClicked = {
gameScene.lock()
gameScene.playAnimation(
DelayAnimation(duration = 2000).apply {
onFinished = {
println("Delay finished!")
gameScene.unlock()
showDialog(Dialog(DialogType.NONE, "", "", ""))
}
})
}
buttonMovement.onMouseClicked = {
gameScene.playAnimation(
MovementAnimation(componentView = cardMovement, byX = 0, byY = -50, duration = 1000))
}
buttonRotation.onMouseClicked = {
gameScene.playAnimation(
RotationAnimation(componentView = cardRotation, byAngle = 180.0, duration = 1000))
}
buttonOpacity.onMouseClicked = {
gameScene.playAnimation(
FadeAnimation(
componentView = cardOpacity, fromOpacity = 1.0, toOpacity = 0.0, duration = 1000))
}
buttonStretch.onMouseClicked = {
gameScene.playAnimation(
ScaleAnimation(componentView = cardStretch, byScale = 0.5, duration = 1000))
}
buttonFlip.onMouseClicked = {
gameScene.playAnimation(
FlipAnimation(
gameComponentView = cardFlip,
fromVisual = cardFlip.backVisual,
toVisual = cardFlip.frontVisual,
duration = 1000))
}
buttonRandomize.onMouseClicked = {
gameScene.playAnimation(
RandomizeAnimation(
gameComponentView = cardRandomize,
visuals = randomCardFaces,
toVisual = cardFlip.frontVisual,
duration = 1000,
speed = 50))
}
buttonDie.onMouseClicked = {
gameScene.playAnimation(
DiceAnimation(dice = die, toSide = 3, duration = 1000, speed = 50).apply {
onFinished = { die.currentSide = 3 }
})
}

gameScene.addComponents(
buttonDelay,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,44 +41,38 @@ class DragAndDropExample : BoardGameApplication("Drag and drop example") {

init {
redToken.isDraggable = true
redToken.onDragGestureEnded =
{ _, success ->
if (success) {
redToken.isDraggable = false
}
}
redToken.onDragGestureEnded = { _, success ->
if (success) {
redToken.isDraggable = false
}
}

greenToken.isDraggable = true
greenToken.onDragGestureEnded =
{ _, success ->
if (success) {
greenToken.isDraggable = false
}
}
greenToken.onDragGestureEnded = { _, success ->
if (success) {
greenToken.isDraggable = false
}
}

redArea.dropAcceptor =
{ dragEvent ->
when (dragEvent.draggedComponent) {
is TokenView -> dragEvent.draggedComponent == redToken
else -> false
}
}
redArea.onDragDropped =
{ dragEvent ->
redArea.add((dragEvent.draggedComponent as TokenView).apply { reposition(0, 0) })
}
redArea.dropAcceptor = { dragEvent ->
when (dragEvent.draggedComponent) {
is TokenView -> dragEvent.draggedComponent == redToken
else -> false
}
}
redArea.onDragDropped = { dragEvent ->
redArea.add((dragEvent.draggedComponent as TokenView).apply { reposition(0, 0) })
}

greenArea.dropAcceptor =
{ dragEvent ->
when (dragEvent.draggedComponent) {
is TokenView -> dragEvent.draggedComponent == greenToken
else -> false
}
}
greenArea.onDragDropped =
{ dragEvent ->
greenArea.add((dragEvent.draggedComponent as TokenView).apply { reposition(0, 0) })
}
greenArea.dropAcceptor = { dragEvent ->
when (dragEvent.draggedComponent) {
is TokenView -> dragEvent.draggedComponent == greenToken
else -> false
}
}
greenArea.onDragDropped = { dragEvent ->
greenArea.add((dragEvent.draggedComponent as TokenView).apply { reposition(0, 0) })
}

gameScene.addComponents(redToken, greenToken, redArea, greenArea)
showGameScene(gameScene)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,11 @@ class UserInputExample : BoardGameApplication("User input example") {
button.onKeyReleased = { keyEvent -> button.text = "released key: ${keyEvent.keyCode}" }
button.onKeyTyped = { keyEvent -> button.text = "typed key: ${keyEvent.character}" }
button.dropAcceptor = { true }
button.onDragDropped =
{
it.draggedComponent.reposition(500, 30)
it.draggedComponent.rotation = 0.0
gameScene.addComponents(token)
}
button.onDragDropped = {
it.draggedComponent.reposition(500, 30)
it.draggedComponent.rotation = 0.0
gameScene.addComponents(token)
}
button.onDragGestureEntered = { dragEvent -> button.visual = dragEvent.draggedComponent.visual }
button.onDragGestureExited = { button.visual = ColorVisual.GREEN }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,19 @@ class VisualsExample : BoardGameApplication("Visuals example") {
init {
buttonColor.onMouseClicked = { token.visual = ColorVisual.GREEN }
buttonImage.onMouseClicked = { token.visual = ImageVisual("Die.png") }
buttonText.onMouseClicked =
{
token.visual =
buttonText.onMouseClicked = {
token.visual =
TextVisual(
"Roll", Font(size = 20, color = Color.WHITE, fontWeight = Font.FontWeight.BOLD))
}
buttonCompound.onMouseClicked = {
token.visual =
CompoundVisual(
ImageVisual("Die.png"),
ColorVisual.GREEN.apply { transparency = 0.4 },
TextVisual(
"Roll", Font(size = 20, color = Color.WHITE, fontWeight = Font.FontWeight.BOLD))
}
buttonCompound.onMouseClicked =
{
token.visual =
CompoundVisual(
ImageVisual("Die.png"),
ColorVisual.GREEN.apply { transparency = 0.4 },
TextVisual(
"Roll",
Font(size = 40, color = Color.WHITE, fontWeight = Font.FontWeight.BOLD)))
}
"Roll", Font(size = 40, color = Color.WHITE, fontWeight = Font.FontWeight.BOLD)))
}

gameScene.addComponents(token, buttonColor, buttonImage, buttonText, buttonCompound)
showGameScene(gameScene)
Expand Down
Loading

0 comments on commit 63372fe

Please sign in to comment.