junkdog / artemis-odb

A continuation of the popular Artemis ECS framework
BSD 2-Clause "Simplified" License
769 stars 109 forks source link

[FEATURE] Primary constructor in Kotlin #620

Open GMassta opened 3 years ago

GMassta commented 3 years ago

Im use last Artemis 2.3.0 and it not may get primary constructor from component. Class: class Renderable(val atlas: String, val name: String): Component() Return error: missing public constructor

DaanVanYperen commented 3 years ago

Did you manage to find a workaround?

corlaez commented 1 month ago

@GMassta @DaanVanYperen There is no change needed from the library, all you need to do is provide a way to instanciate the class without parameters.

You can achieve that by defining default values for your fields. This is an example:

data class Position(var x: Float = 0F, var y: Float = 0F) : Component()

I would close this if I could.