Skip to content

DSL inside Window constructor #342

Answered by czyzby
Divelix asked this question in Q&A
Discussion options

You must be logged in to vote

This is because KWindow is a concrete class of a widget, while KTable (from the linked example) is an interface that adds the DSL. Windows are actually just fancy tables in LibGDX - if you look into the KWindow implementation, you'll see that it also implements the KTable interface:

@Scene2dDsl
class KWindow(title: String, skin: Skin, style: String) : Window(title, skin, style), KTable

Instead of extending KWindow, all you have to do is implement KTable to get access to the DSL. When in doubt, check out which interfaces are implemented by the KTX widget. You can basically copy-and-paste the class and go from there.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Divelix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants