Package-level declarations

Types

Link copied to clipboard
interface ActFileVersion
Link copied to clipboard
open class ActFileVersion1(val game: Game) : ActFileVersion
Link copied to clipboard
interface GameFileVersion

In an attempt to ensure that old versions of .kyd files will be backwards compatible with newer versions of Kyd, there can be many instances of this interface, each one is capable of parsing/creating a certain flavour of Json file.

Link copied to clipboard

While Kyd is in early development, the file format is still evolving, and backwards compatibility is NOT supported.

Functions

Link copied to clipboard
fun JsonObject.add(name: String, color: Color)
Link copied to clipboard
fun JsonObject.addSkippingDefault(name: String, value: Boolean, defaultValue: Boolean)
fun JsonObject.addSkippingDefault(name: String, value: Float, defaultValue: Float)
fun JsonObject.addSkippingDefault(name: String, value: Int, defaultValue: Int)
fun JsonObject.addSkippingDefault(name: String, value: Color, defaultValue: Color)

fun JsonObject.addSkippingDefault(name: String, value: String, defaultValue: String)

If an attribute has a common default value, you may not want to include it in the Json output. (to save space and speed).

Link copied to clipboard
fun createActFromJson(game: Game, jAct: JsonObject): Act
Link copied to clipboard
fun createGameFromJson(jGame: JsonObject, filePath: String, resources: Resources, editor: Boolean): Game
Link copied to clipboard
fun createJson(game: Game): JsonObject
fun createJson(game: Game, act: Act): JsonObject
Link copied to clipboard
fun JsonObject.getColor(name: String, defaultValue: Color): Color
Link copied to clipboard
fun JsonObject.getName(parent: Resource?): String

Looks for a name attribute, and throws an exception when now found.

Link copied to clipboard
fun JsonObject.getObjects(name: String): List<JsonObject>

A convenience method to get all JsonObject within an attribute which is assumed to be a JsonArray.

Link copied to clipboard
fun JsonObject.getRequiredString(resource: Resource, name: String): String

JsonObject.getString takes a default value, when that attribute isn't present. However, sometimes we want to throw an exception when the attribute is missing (because there is no suitable default-value).

Link copied to clipboard
fun JsonObject.getStrings(name: String): List<JsonString>

A convenience method to get all JsonString within an attribute which is assumed to be a JsonArray.