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. |
ctrueden
left a comment
There was a problem hiding this comment.
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.
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.
Huh, I guess it's convenient, so I'll swallow my feelings of mathematical discomfort 😆
There was a problem hiding this comment.
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 :)
| scene += floor | ||
|
|
||
| lights.forEach(scene::addChild) | ||
| scene += lights |
There was a problem hiding this comment.
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