Skip to content

Commit

Permalink
Fixed compilation errors
Browse files Browse the repository at this point in the history
  • Loading branch information
smilefx committed Feb 5, 2025
1 parent a4ff681 commit 01f7ab2
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,11 @@ class UIComponentExample : BoardGameApplication("UIComponent Example") {
menuScene.addComponents(listView, listViewLabel)

// TableView
val table = TableView<Int>(posX = 450, posY = 800, width = 300, height = 200,
selectionMode = SelectionMode.SINGLE)
val table =
TableView<Int>(
posX = 450, posY = 800, width = 300, height = 200, selectionMode = SelectionMode.SINGLE)

table.onSelectionChanged = { newValue -> println(newValue) }
table.onSelectionChanged = { newValue -> println(newValue) }

table.columns.add(TableColumn(title = "Value", width = 100) { "$it" })

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -410,71 +410,66 @@ internal class ExampleDocsScene : BoardGameScene(width = 445, height = 300) {
visual = ColorVisual(Color(0x0f141f)))
.apply { add(hiddenToken) }


val offsetHexagonGrid = HexagonGrid<HexagonView>(
posX = 0,
posY = 0,
coordinateSystem = HexagonGrid.CoordinateSystem.OFFSET
).apply {
for (x in 0..3) {
for (y in 0..4) {
val hexagon = HexagonView(visual = CompoundVisual(
ColorVisual(Color(0xfa6c56)),
TextVisual("$x, $y", font = Font(10.0, Color(0x0f141f)))
), size = 30)
val offsetHexagonGrid =
HexagonGrid<HexagonView>(
posX = 0, posY = 0, coordinateSystem = HexagonGrid.CoordinateSystem.OFFSET)
.apply {
for (x in 0..3) {
for (y in 0..4) {
val hexagon =
HexagonView(
visual =
CompoundVisual(
ColorVisual(Color(0xfa6c56)),
TextVisual("$x, $y", font = Font(10.0, Color(0x0f141f)))),
size = 30)
this[x, y] = hexagon
}
}
}
}
}

val axialHexagonGrid = HexagonGrid<HexagonView>(
posX = 0,
posY = 0,
coordinateSystem = HexagonGrid.CoordinateSystem.AXIAL
).apply {
for (row in -2..2) {
for (col in -2..2) {
if(row + col in -2..2) {
val hexagon = HexagonView(visual = CompoundVisual(
ColorVisual(Color(0xc6ff6e)),
TextVisual("$col, $row", font = Font(10.0, Color(0x0f141f)))
), size = 30)
this[col, row] = hexagon
val axialHexagonGrid =
HexagonGrid<HexagonView>(
posX = 0, posY = 0, coordinateSystem = HexagonGrid.CoordinateSystem.AXIAL)
.apply {
for (row in -2..2) {
for (col in -2..2) {
if (row + col in -2..2) {
val hexagon =
HexagonView(
visual =
CompoundVisual(
ColorVisual(Color(0xc6ff6e)),
TextVisual("$col, $row", font = Font(10.0, Color(0x0f141f)))),
size = 30)
this[col, row] = hexagon
}
}
}
}
}
}

val offsetTargetLayout =
Pane<ComponentView>(width = 1000, height = 1000).apply {
add(offsetHexagonGrid)

width = offsetHexagonGrid.actualWidth
height = offsetHexagonGrid.actualHeight
}
val offsetCameraPane =
CameraPane(width = width, height = height, target = offsetTargetLayout, limitBounds = false)
.apply { interactive = true }

val axialTargetLayout =
Pane<ComponentView>(width = 1000, height = 1000).apply {
add(axialHexagonGrid)

width = axialHexagonGrid.actualWidth
height = axialHexagonGrid.actualHeight
}

val offsetTargetLayout =
Pane<ComponentView>(
width = 1000, height = 1000
)
.apply {
add(offsetHexagonGrid)

width = offsetHexagonGrid.actualWidth
height = offsetHexagonGrid.actualHeight
}
val offsetCameraPane =
CameraPane(width = width, height = height, target = offsetTargetLayout, limitBounds = false).apply {
interactive = true
}

val axialTargetLayout =
Pane<ComponentView>(
width = 1000, height = 1000
)
.apply {
add(axialHexagonGrid)

width = axialHexagonGrid.actualWidth
height = axialHexagonGrid.actualHeight
}

val axialCameraPane =
CameraPane(width = width, height = height, target = axialTargetLayout, limitBounds = false).apply {
interactive = true
}
val axialCameraPane =
CameraPane(width = width, height = height, target = axialTargetLayout, limitBounds = false)
.apply { interactive = true }

init {
setComponentsAndSerialize("tokenExample", ::tokenRect, ::tokenCircle)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ internal object Application : BoardGameApplication(aspectRatio = AspectRatio.of(
init {
loadFont("Rubik.ttf")
// showGameScene(cardLayoutScene)
// showGameScene(hexGrid)
showGameScene(hexGrid)
// showGameScene(animation)
// showGameScene(grid)
showGameScene(dragDropScene)
// showGameScene(dragDropScene)
// showMenuScene(uiScene)
// showGameScene(visualScene)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import tools.aqua.bgw.components.ComponentView
import tools.aqua.bgw.components.container.HexagonGrid
import tools.aqua.bgw.components.container.Satchel
import tools.aqua.bgw.components.gamecomponentviews.HexagonView
import tools.aqua.bgw.components.gamecomponentviews.TokenView
import tools.aqua.bgw.components.layoutviews.CameraPane
import tools.aqua.bgw.components.layoutviews.Pane
import tools.aqua.bgw.components.uicomponents.Button
Expand Down Expand Up @@ -256,23 +255,6 @@ internal class HexGridGameScene : BoardGameScene() {
return Pair(minX, minY)
}

/* Function to build tokens on the hex grid at (0,0) of each HexagonView. */
fun buildTokens() {

hexGrid.components.forEach {
val token =
TokenView(
visual = ColorVisual.RED,
width = 20,
height = 20,
posX = it.actualPosX,
posY = it.actualPosY)
targetPane.add(token)
}

hexGrid
}

fun refreshHexGrid() {
buildHexGrid()
}
Expand All @@ -282,8 +264,6 @@ internal class HexGridGameScene : BoardGameScene() {

hexGrid.components.forEach { println("${it.actualPosX} - ${it.actualPosY}") }

buildTokens()

targetPane.add(singleHex)
addComponents(cameraPane, panButton, panZeroButton, zoomButton, centerDot)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class ProtocolScene : BoardGameScene(height = 800, width = 500, background = Col
private val messagePane =
GridPane<MessageView>(
posX = 25, posY = 0, columns = 1, rows = 1, layoutFromCenter = false, spacing = 10)
.apply { onMouseWheel = { posY = min(max(posY + it.direction * 50, currentZMin), -40.0) } }
.apply {
onMouseWheel = { posY = min(max(posY + it.direction * 50, currentZMin), -40.0) }
}

init {
addComponents(messagePane)
Expand Down

0 comments on commit 01f7ab2

Please sign in to comment.