Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Primary constructor in Kotlin #620

Open
GMassta opened this issue Nov 24, 2020 · 2 comments
Open

[FEATURE] Primary constructor in Kotlin #620

GMassta opened this issue Nov 24, 2020 · 2 comments

Comments

@GMassta
Copy link

GMassta commented Nov 24, 2020

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
Copy link
Collaborator

Did you manage to find a workaround?

@corlaez
Copy link

corlaez commented May 25, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants