-
-
Notifications
You must be signed in to change notification settings - Fork 74
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
Scene2D DSL refactoring to ease creation of actors without parents #268
Labels
scene2d
Issues of the ktx-scene2d module and Scene2D integration in general
Milestone
Comments
czyzby
added
the
scene2d
Issues of the ktx-scene2d module and Scene2D integration in general
label
Apr 16, 2020
This was referenced Apr 16, 2020
Closed
czyzby
added a commit
that referenced
this issue
Apr 16, 2020
@Quillraven I believe you're using this module in your application. Just a heads up: top-level actor definitions changed a bit and now you have to add |
czyzby
added a commit
that referenced
this issue
Apr 17, 2020
czyzby
added a commit
that referenced
this issue
Apr 18, 2020
czyzby
added a commit
that referenced
this issue
Apr 24, 2020
czyzby
added a commit
that referenced
this issue
Apr 25, 2020
czyzby
added a commit
that referenced
this issue
May 2, 2020
czyzby
added a commit
that referenced
this issue
May 15, 2020
czyzby
added a commit
that referenced
this issue
May 15, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
scene2d
object with access to Scene2D DSL.KWidget.appendActor
.addTooltip
andaddTextTooltip
totooltip
andtextTooltip
respectively.ktx-scene2d
currently defines top-level factory functions for commonly used parental actors, e.g.table
orwindow
. Creating these widgets with KTX DSL is straightforward:A common use case that is currently unsupported is creating non-parental actors with the DSL:
We could add similar factory functions for all LibGDX widgets, but it leads to 2 issues:
label
children and top-levellabel
widgets are now created with methods with the same name, it's easy to include the wrong one (e.g. via code completion), which leads to unexpected behaviour (e.g. label not added to the parent).Instead, a unified API for defining root actors - regardless of whether they can or cannot have children - will be provided, using the same set of factory methods. To achieve that,
scene2d
object will be created, implementing theKWidget
interface to have complete access to the Scene2D DSL. Additionally, it would provide factory methods for widgets that are normally never used as children, such aswindow
anddialog
. For example:Migration to the new API would be very simple, as all that needs to be done is appending the
scene2d.
prefix to the root actor definitions. In the long run, the usability of the module will improve, as now it would be simpler to define parent-less actors (such as labels) and name collisions are no longer an issue.Existing top-level factory functions would be deprecated and eventually removed in the following release.
Additionally, the following changes will be applied:
addTextTooltip
andaddTooltip
use non-standard method names and will be renamed totooltip
andtextTooltip
to match other widgets.KWidget.appendActor
is no longer necessary since Kotlin 1.2 introduced default values for lambda parameters in inlined functions. Since this is a part of the internal API, it will be removed without prior deprecation.The text was updated successfully, but these errors were encountered: