-
-
Notifications
You must be signed in to change notification settings - Fork 73
Add ktx-textratypist to libktx #507
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
base: develop
Are you sure you want to change the base?
Conversation
|
First cut on implementing this. Having a little trouble with gradle format, so need to take a look at that (though hopefully the editorconfig has kept things relatively correct). For now, I've just added support for TextraLabel and TypingLabel, the two main widgets. Not 100% sure about how prime-time the other widgets are, as I don't use them atm. But thinking it makes sense to start with a small(ish) commit, anyway. Replaced VisUI with FWSkin in the tests, since I need support for Textra label styles. Any obvious mistakes/issues that I need to address? |
czyzby
left a comment
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.
Looks pretty good, most comments are related to the test setup and documentation rather than the actual library sources. That being said, the support for the library is pretty basic - I originally thought that we could design and maintain a DSL for the markup syntax itself. Something along these lines:
richText {
red()
+"This text is red! "
clearColor()
+"Now it's not."
}I know that's a much larger undertaking, so if it's not something you'd want to work on, don't worry about it. I'm happy to merge this as is either way.
Anyway, I'd appreciate it if you looked into the default libGDX font or using the VisUI assets to avoid putting a skin atlas and the associated image in test resources before we merge this.
I'm not averse to adding more stuff (I've customized my own code a fair bit, but mostly with handling styles, etc), but not sure I see the utility of a function DSL for formatting. After all, everything here is just strings.
Would be:
I would argue that very little is gained by creating I'd almost say the opposite - That is at least my thoughts based on my own usage, I feel like such an addition would obfuscate more than simplify usage. Not to mention that even within textratypist there are some differences between typinglabel and textralabel that I suspect would cause confusion. |
|
Ugh. Sorry about some of those changes - I've the ktlint checker auto-enabled in my IntelliJ, and it tends to go crazy about files that don't conform, even when one don't intent to change them. Will try to see if I can reset the pointless changes. |
|
If we're looking strictly at the number of characters used, sure, there's not much to gain. However, the main goals of the DSL would be the compile-time checks and discoverability of the operations. A typo in a string template could result in runtime errors or invalid rendering that could be difficult to pick up or even validate with unit tests. DSL would mostly get rid of these errors by validating the syntax at compile time on top of providing code completion and listing of the supported tags. Like I said though, it's not critical to add a DSL to get this merged. You're welcome to try if you'd like to design one, but I think there's value in this module as is. |
|
By the way, the syntax I came up with is perhaps not the best for dealing with strings. I like your idea of overloading richText { red("This is red!") + " This is not." } |
|
Having a busy week, so not much time to fix the last few issues here. Will hopefully find some time in the weekend. |
|
No worries, take your time. Thanks for looking into this! |
|
Think this is ready now. Ktx and Textratypist are my two go-to libs for game development, so I'll try to set some time aside to add more later. |
czyzby
left a comment
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.
Thanks, this looks great. I'll try to sort out KTX dependencies next week and do a proper libGDX version bump so that we can use the latest TextraTypist release.
| const val ashleyVersion = "1.7.4" | ||
| const val gdxAiVersion = "1.8.2" | ||
| const val visUiVersion = "1.5.5" | ||
| const val textraTypistVersion = "2.1.9" // Cannot upgrade to 2.2.x until gdx 1.14.x. |
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.
There's 2.1.11 out now (or 2.2.10 if you can use libGDX 1.14.0) and I just pushed a small bugfix release today, again! I've been backporting releases to 1.13.1 mostly so KTX users can still use TextraTypist. It isn't that hard to backport, I have it understood well now and it's pretty much one find+replace.
Contributing #281 : suport for TextraTypist; adding adnimated and styled text labels such as TypingLabel and TextraLabel.