Skip to content

Commit

Permalink
Made functions, classes and objects internal
Browse files Browse the repository at this point in the history
  • Loading branch information
smilefx committed Nov 28, 2024
1 parent 6af1f34 commit dffc299
Show file tree
Hide file tree
Showing 96 changed files with 249 additions and 246 deletions.
108 changes: 56 additions & 52 deletions bgw-gui/src/commonMain/kotlin/PropData.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ typealias ID = String
// PropData

@Serializable
enum class ActionProp {
internal enum class ActionProp {
DEFAULT,
SHOW_MENU_SCENE,
SHOW_GAME_SCENE,
Expand All @@ -21,20 +21,21 @@ enum class ActionProp {
}

@Serializable
class JsonData(
internal class JsonData(
var container : String = "bgw-root",
var props : PropData
)

@Serializable
class PropData(
internal class PropData(
var data: Data? = null
)

@Serializable
sealed class Data
internal sealed class Data

@Serializable
class AppData : Data() {
internal class AppData : Data() {
var menuScene: SceneData? = null
var gameScene: SceneData? = null
var fonts : List<Triple<String, String, Int>> = emptyList()
Expand All @@ -44,7 +45,7 @@ class AppData : Data() {
}

@Serializable
class SceneData : Data() {
internal class SceneData : Data() {
var id: ID = ""
var width : Int = 0
var height : Int = 0
Expand All @@ -53,15 +54,15 @@ class SceneData : Data() {
}

@Serializable
abstract class AnimationData : Data() {
internal abstract class AnimationData : Data() {
var id: ID = ""
var duration: Int = 0
var isRunning: Boolean = false
var onFinished: ((EventData) -> Unit)? = null
}

@Serializable
class DialogData : Data() {
internal class DialogData : Data() {
var dialogType : DialogType = DialogType.INFORMATION
var title : String = ""
var header : String = ""
Expand All @@ -70,7 +71,7 @@ class DialogData : Data() {
}

@Serializable
abstract class ComponentViewData : Data() {
internal abstract class ComponentViewData : Data() {
var id: ID = ""
var posX: Int = 0
var posY: Int = 0
Expand All @@ -96,120 +97,122 @@ abstract class ComponentViewData : Data() {

// UI COMPONENTS
@Serializable
abstract class UIComponentData : ComponentViewData() {
internal abstract class UIComponentData : ComponentViewData() {
var font: FontData = FontData(16, "rgba(0,0,0,1)", "Arial", 400, "normal")
}

@Serializable
abstract class LabeledUIComponentData : UIComponentData() {
internal abstract class LabeledUIComponentData : UIComponentData() {
var text: String = ""
var alignment: Pair<String, String> = Pair("", "")
var isWrapText: Boolean = false
}

@Serializable
abstract class TextInputUIComponentData : UIComponentData() {
internal abstract class TextInputUIComponentData : UIComponentData() {
var text: String = ""
var prompt: String = ""
}
@Serializable
class BinaryStateButtonData : LabeledUIComponentData() {
internal class BinaryStateButtonData : LabeledUIComponentData() {
var isSelected: Boolean = false
var group : String = ""
}

@Serializable
class ButtonData : LabeledUIComponentData() { }
internal class ButtonData : LabeledUIComponentData() { }

@Serializable
class CheckBoxData : LabeledUIComponentData() {
internal class CheckBoxData : LabeledUIComponentData() {
var isChecked: Boolean = false
var allowIndeterminate: Boolean = false
var isIndeterminate: Boolean = false
}
@Serializable
class ComboBoxData : UIComponentData() {
internal class ComboBoxData : UIComponentData() {
var prompt: String = ""
var items: List<Pair<Int, String>> = emptyList()
var selectedItem: Pair<Int, String>? = null
}

@Serializable
class LabelData : LabeledUIComponentData() { }
internal class LabelData : LabeledUIComponentData() { }

@Serializable
class RadioButtonData : LabeledUIComponentData() {
internal class RadioButtonData : LabeledUIComponentData() {
var isSelected: Boolean = false
var group : String = ""
}
@Serializable
class ToggleButtonData : LabeledUIComponentData() {
internal class ToggleButtonData : LabeledUIComponentData() {
var isSelected: Boolean = false
var group : String = ""
}
@Serializable
class ColorPickerData : UIComponentData() {
internal class ColorPickerData : UIComponentData() {
var selectedColor: String = "#000000"
}
@Serializable
class PasswordFieldData : TextInputUIComponentData() { }
internal class PasswordFieldData : TextInputUIComponentData() { }
@Serializable
class ProgressBarData : UIComponentData() {
internal class ProgressBarData : UIComponentData() {
var progress: Double = 0.0
var barColor: String = "#000000"
}
@Serializable
class TextAreaData : TextInputUIComponentData() { }
internal class TextAreaData : TextInputUIComponentData() { }
@Serializable
class TextFieldData : TextInputUIComponentData() { }
internal class TextFieldData : TextInputUIComponentData() { }

@Serializable
abstract class StructuredDataViewData : UIComponentData() {
internal abstract class StructuredDataViewData : UIComponentData() {
var items: List<String> = emptyList()
var selectionMode: String = ""
var selectionBackground: String = "#FF0000"
var selectedItems: List<Int> = emptyList()
}
@Serializable
class TableColumnData {
internal class TableColumnData {
var title : String = ""
var width : Int = 0
var font : FontData = FontData(16, "rgba(0,0,0,1)", "Arial", 400, "normal")
var items : List<String> = emptyList()
}
@Serializable
class ListViewData : StructuredDataViewData() {
internal class ListViewData : StructuredDataViewData() {
var orientation: String = ""
}
@Serializable
class TableViewData : StructuredDataViewData() {
internal class TableViewData : StructuredDataViewData() {
var columns: List<TableColumnData> = emptyList()
}

// LAYOUT VIEWS
@Serializable
abstract class LayoutViewData : ComponentViewData() { }
internal abstract class LayoutViewData : ComponentViewData() { }

@Serializable
class PaneData : LayoutViewData() {
internal class PaneData : LayoutViewData() {
var components: List<ComponentViewData> = emptyList()
}
@Serializable
class GridPaneData: LayoutViewData() {
internal class GridPaneData: LayoutViewData() {
var columns : Int = 0
var rows : Int = 0
var spacing : Int = 0
var grid : List<GridElementData> = emptyList()
}

@Serializable
class GridElementData(
internal class GridElementData(
var column : Int,
var row : Int,
var component : ComponentViewData?,
var alignment: Pair<String, String>
)

@Serializable
class CameraPaneData : ComponentViewData() {
internal class CameraPaneData : ComponentViewData() {
var target : LayoutViewData? = null
var zoom : Double = 1.0
var interactive : Boolean = false
Expand All @@ -218,79 +221,80 @@ class CameraPaneData : ComponentViewData() {
}

@Serializable
class CoordinateData(val xCoord: Double = 0.0, val yCoord: Double = 0.0)
internal class CoordinateData(val xCoord: Double = 0.0, val yCoord: Double = 0.0)

// GAME COMPONENT VIEWS
@Serializable
abstract class GameComponentViewData : ComponentViewData() { }
internal abstract class GameComponentViewData : ComponentViewData() { }
@Serializable
class CardViewData : GameComponentViewData() {
internal class CardViewData : GameComponentViewData() {
var front: VisualData? = null
var back: VisualData? = null
var currentVisual : VisualData? = null
}
@Serializable
class DiceViewData : GameComponentViewData() {
internal class DiceViewData : GameComponentViewData() {
var currentSide: Int = 0
var visuals: List<VisualData> = emptyList()
}

@Serializable
class HexagonViewData : GameComponentViewData() {
internal class HexagonViewData : GameComponentViewData() {
var size: Int = 0
var orientation: String = ""
}
@Serializable
class TokenViewData : GameComponentViewData() { }
internal class TokenViewData : GameComponentViewData() { }

// CONTAINER
@Serializable
abstract class GameComponentContainerData: ComponentViewData() {
internal abstract class GameComponentContainerData: ComponentViewData() {
var components: List<GameComponentViewData> = emptyList()
}
@Serializable
class AreaData : GameComponentContainerData() { }
internal class AreaData : GameComponentContainerData() { }

@Serializable
class CardStackData : GameComponentContainerData() {
internal class CardStackData : GameComponentContainerData() {
var alignment: Pair<String, String> = Pair("", "")
}
@Serializable
class HexagonGridData : GameComponentContainerData() {
internal class HexagonGridData : GameComponentContainerData() {
var coordinateSystem: String = ""
var map : Map<String, HexagonViewData> = emptyMap()
var spacing : Int = 0
var orientation: String = ""
}
@Serializable
class LinearLayoutData: GameComponentContainerData() {
internal class LinearLayoutData: GameComponentContainerData() {
var orientation: String = ""
var alignment: Pair<String, String> = Pair("", "")
var spacing: Int = 0
}
@Serializable
class SatchelData: GameComponentContainerData() { }
internal class SatchelData: GameComponentContainerData() { }

// VISUALS
@Serializable
sealed class VisualData(
internal sealed class VisualData(
var id: ID = ""
) : Data()

@Serializable
sealed class SingleLayerVisualData(
internal sealed class SingleLayerVisualData(
var transparency: Double = 0.0,
var style: Map<String, String> = emptyMap(),
var filters: Map<String, String?> = emptyMap(),
var flipped : String = ""
) : VisualData()

@Serializable
data class ColorVisualData(
internal data class ColorVisualData(
var color: String = ""
) : SingleLayerVisualData()

@Serializable
data class ImageVisualData(
internal data class ImageVisualData(
var path: String = "",
var width: Int = 0,
var height: Int = 0,
Expand All @@ -299,7 +303,7 @@ data class ImageVisualData(
) : SingleLayerVisualData()

@Serializable
data class TextVisualData(
internal data class TextVisualData(
var text: String = "",
var font : FontData = FontData(16, "rgba(0,0,0,1)", "Arial", 400, "normal"),
var alignment: Pair<String, String> = Pair("", ""),
Expand All @@ -308,13 +312,13 @@ data class TextVisualData(
) : SingleLayerVisualData()

@Serializable
data class CompoundVisualData(
internal data class CompoundVisualData(
var children: List<SingleLayerVisualData> = emptyList()
) : VisualData()

// FONT
@Serializable
data class FontData(
internal data class FontData(
var size : Int = 16,
var color : String = "",
var family : String = "",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ import kotlinx.serialization.Serializable


@Serializable
abstract class ComponentAnimationData() : AnimationData() {
internal abstract class ComponentAnimationData() : AnimationData() {
var componentView: ComponentViewData? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ import AnimationData
import kotlinx.serialization.Serializable

@Serializable
class DelayAnimationData() : AnimationData()
internal class DelayAnimationData() : AnimationData()
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DiceViewData
import kotlinx.serialization.Serializable

@Serializable
class DiceAnimationData() : SteppedComponentAnimationData() {
internal class DiceAnimationData() : SteppedComponentAnimationData() {
var dice: DiceViewData? = componentView as? DiceViewData
var toSide: Int = 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package data.animation
import kotlinx.serialization.Serializable

@Serializable
class FadeAnimationData() : ComponentAnimationData() {
internal class FadeAnimationData() : ComponentAnimationData() {
var fromOpacity: Double = componentView?.opacity ?: 0.0
var toOpacity: Double = componentView?.opacity ?: 1.0
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import VisualData
import kotlinx.serialization.Serializable

@Serializable
class FlipAnimationData() : ComponentAnimationData() {
internal class FlipAnimationData() : ComponentAnimationData() {
var fromVisual: VisualData? = null
var toVisual: VisualData? = null
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package data.animation
import ComponentViewData
import kotlinx.serialization.Serializable
@Serializable
class MovementAnimationData() : ComponentAnimationData() {
internal class MovementAnimationData() : ComponentAnimationData() {
var byX : Int = 0
var byY : Int = 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ import AnimationData
import kotlinx.serialization.Serializable

@Serializable
class ParallelAnimationData() : AnimationData() {
internal class ParallelAnimationData() : AnimationData() {
var animations: List<AnimationData> = listOf()
}
Loading

0 comments on commit dffc299

Please sign in to comment.