godot.core.KtClass.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of godot-library-release Show documentation
Show all versions of godot-library-release Show documentation
Contains godot api as kotlin classes and jvm cpp interaction code.
package godot.core
import godot.core.memory.TransferContext
@Suppress("unused")
data class KtClass(
val registeredName: String,
val relativeSourcePath: String,
val compilationTimeRelativeRegistrationFilePath: String,
private val _registeredSupertypes: List,
private val _constructors: List?>,
private val _properties: Map>,
private val _functions: Map>,
private val _notificationFunctions: List Unit>,
private val _signalInfos: Map,
val baseGodotClass: String
) {
val registeredSupertypes: Array
get() = _registeredSupertypes.toTypedArray()
val constructors: Array?>
get() = _constructors.toTypedArray()
val functions: Array>
get() = _functions.values.toTypedArray()
val properties: Array>
get() = _properties.values.toTypedArray()
val signalInfos: Array
get() = _signalInfos.values.toTypedArray()
val hasNotification: Boolean
get() = _notificationFunctions.isNotEmpty()
fun doNotification(instance: T) {
val parameters = arrayOfNulls(2)
TransferContext.readArguments(
arrayOf(VariantParser.LONG, VariantParser.BOOL),
parameters
)
val notification = parameters[0]
val reversed = parameters[1]
require(notification is Long)
require(reversed is Boolean)
if (reversed) {
for (notificationFunction in _notificationFunctions) {
notificationFunction(instance, notification.toInt())
}
return
}
for (i in _notificationFunctions.size - 1 downTo 0) {
_notificationFunctions[i](instance, notification.toInt())
}
}
}