-
Notifications
You must be signed in to change notification settings - Fork 32
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/kotlinesque #548
base: main
Are you sure you want to change the base?
Feature/kotlinesque #548
Conversation
…e first "Basic" test: - added some fake constructors call for initializing the object directly after the instantiation - added an `inline reified` counterpart for `Image.fromResource` - added an `Image::toTexture` function - added the operator overloading `plusAssign` for adding element(s) to the scene - minors
a74b7a8
to
37452bb
Compare
Rebased over current mainline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have no strong opinions about what is more kotlinesque, so I just made a couple of random comments. 🎲
val camlight = PointLight(3.0f) { | ||
intensity = 5.0f | ||
} | ||
cam += camlight |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a neat trick. But I find it odd to override plusAssign
but not plus
. The implication, which is not true for these types, is that cam + camlight
would be a new camera object with the light added, and only because the +=
was used does it get assigned back into the same cam
variable. Is this a pattern Kotlin users often use for mutators, to override only the +=
but not +
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh, I guess it's convenient, so I'll swallow my feelings of mathematical discomfort 😆
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might say this is one of the example on the border line, some people will assume this to be an operator abuse, others don't
But that's where I like to give the choice :)
|
||
lights.forEach(scene::addChild) | ||
scene += lights |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the +=
trick is deemed kosher by @skalarproduktraum, the fact that you can +=
a whole list of children at once is very cool!
@skalarproduktraum @elect86 can this PR be wrapped up easily? |
As titled, this is an attempt for making Scenery more confortable for Kotlin users
I tried to leave the style as much as possible untouched