-
I keep fixing things after update to class ModIcon(val mod: Mod, ...) {
val lvlDrawable: Drawable = ...
val noLvlDrawable: Drawable = ...
init {
...
scene2d.table {
...
for (i in 1..10) {
image(if (i <= mod.level) lvlDrawable else noLvlDrawable) {it.size(4f)} // this line doesn't work now
}
}
}
} But when I define these variables in table scope - it works fine. I guess there may be some conflict with contracts, but can't understand what is it and how to fix it. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
I don't think it's related strictly to contracts, it's more of a DSL issue. I don't see why it wouldn't work though, have you tried rebuilding the file? Cleaning and rebuilding the project might help. I copied the code and it compiles just fine: As for fixing that particular error, you can use explicit |
Beta Was this translation helpful? Give feedback.
-
Oh, I just checked again, actually my code was: @Scene2dDsl
class ModIcon(val mod: Mod, ...): Group(), KGroup {...}
// I implemented KGroup to use it as my custom widget
modIcon(mod) {...} and I did not pay attention to that when wrote the code in the question. It seems like I broke smth inside |
Beta Was this translation helpful? Give feedback.
-
Glad you worked it out. |
Beta Was this translation helpful? Give feedback.
Oh, I just checked again, actually my code was:
and I did not pay attention to that when wrote the code in the question. It seems like I broke smth inside
KGroup
by that code, becauseModIcon
works fine now without inheritance fromKGroup
.