Skip to content
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

KTX tools module #14

Open
czyzby opened this issue Jul 31, 2016 · 13 comments
Open

KTX tools module #14

czyzby opened this issue Jul 31, 2016 · 13 comments
Labels
help wanted More advanced tasks that might require advanced knowledge of Kotlin, KTX or LibGDX idea Discussions of possible new features tools Issues of the unreleased ktx-tools module
Milestone

Comments

@czyzby
Copy link
Member

czyzby commented Jul 31, 2016

An equivalent to gdx-tools that could automate some KTX-related operations. Potential candidates:

  • Conversion of .properties files to type-safe i18n enums from ktx-i18n.
  • Conversion of skin .json definition to type-safe builders from ktx-style.
  • Generating type-safe ktx-style builders from an existing Skin instance.
  • Extraction of texture region names from .atlas files, which could be saved as a type-safe enum. Useful for both ktx-style builders and general TextureAtlas usage.

Could be implemented as standalone library or Gradle plugin. Or both. The first approach seems the most flexible.

@kotcrab

@czyzby czyzby added the idea Discussions of possible new features label Jul 31, 2016
@kotcrab
Copy link
Contributor

kotcrab commented Jul 31, 2016

Sure, why not. 👍

@czyzby czyzby added this to the backlog milestone Oct 29, 2016
@sreich
Copy link
Contributor

sreich commented Mar 28, 2017

fyi so there's no duplication, consider me working on the "Extraction of texture region names from .atlas files, which could be saved as a type-safe enum. ".

i'm currently waiting on someone else's very recent work, for me to generate the code..i'll see what i can whip up for my own project soon here, and go from there. it should be able to generate type-safe enums from all asset types (fonts/images/atlas etc). i'm sick of plain strings :)

@czyzby
Copy link
Member Author

czyzby commented Mar 28, 2017

That's great! I'll create a separate branch and setup Gradle submodule for you.

@czyzby czyzby added the tools Issues of the unreleased ktx-tools module label Mar 28, 2017
czyzby added a commit that referenced this issue Mar 28, 2017
czyzby added a commit that referenced this issue Mar 28, 2017
@czyzby
Copy link
Member Author

czyzby commented Mar 28, 2017

There. Try checking out feature/ktx-tools branch.

@sreich
Copy link
Contributor

sreich commented Apr 2, 2017

think i'm running into an issue with the gradle scripts for ktx (in general, unrelated to ktx-tools).

resources aren't getting stored in the jar..i'm thinking this is because the top-level one ends up overriding the default behavior (gradle defaults to copy the resources as expected).

you can try adding a src/main/resources/blah.txt to any of the submodules and see it not get copied. looks like the resourceDirs get wiped somehow?

@czyzby
Copy link
Member Author

czyzby commented Apr 2, 2017

@sreich How are you building the jar? I added src/main/resources folder in one of the modules, put a text file there and it was present in the generated jar when using gradle build command. Maybe this is specific to Gradle plugin jars - have you checked if they are allowed to have classpath resources? I don't see a reason why they wouldn't, but still.

@sreich
Copy link
Contributor

sreich commented Apr 2, 2017

guess it's been a long day, silly mistake...i was putting them into src/resources, and since the resource is how gradle finds the plugin in the first place..that is why it couldn't find it. now the plugin works great. so i'll continue working on it and the generator. thanks for your patience 😉

@czyzby
Copy link
Member Author

czyzby commented Apr 2, 2017

It's OK. Might I ask why do you need classpath resources in the plugin in the first place?

@sreich
Copy link
Contributor

sreich commented Apr 2, 2017

from my understanding of gradle, it is required for the plugin to get picked up by gradle (the implementation-class). that's the only resource i will have

https://docs.gradle.org/current/userguide/custom_plugins.html#sec:custom_plugins_standalone_project

@czyzby
Copy link
Member Author

czyzby commented Apr 2, 2017

Oh, I see. I completely forgot about the meta-data thing. Carry on.

@czyzby czyzby added the help wanted More advanced tasks that might require advanced knowledge of Kotlin, KTX or LibGDX label Jan 26, 2018
@DavidPartouche
Copy link

@czyzby I would be happy to help with that task. The feature/ktx-tools branch is quite behind develop now, is it still the branch that should be used?

@czyzby
Copy link
Member Author

czyzby commented Aug 12, 2018

@DavidPartouche Feel free to fork the current develop branch. You can check the last 2 commits on the feature/ktx-tools branch if you need any help with adding a new Gradle module. Also, you might want to look into @sreich fork here. I have to admit I didn't go through his code (he never made a PR), but it might still prove useful. Thanks.

DavidPartouche pushed a commit to DavidPartouche/ktx that referenced this issue Aug 23, 2018
DavidPartouche pushed a commit to DavidPartouche/ktx that referenced this issue Aug 23, 2018
czyzby added a commit that referenced this issue Aug 24, 2018
@dwursteisen
Copy link
Contributor

Could be implemented as standalone library or Gradle plugin. Or both. The first approach seems the most flexible.

You can do a standalone library that can be invoked from a gradle plugin. Best of two worlds!

Conversion of .properties files to type-safe i18n enums from ktx-i18n

For your info, I'm doing this kind of things (it's more a PoC actually): generating an object with all filenames as fields. So I don't have any filename in my code. So If I'm renaming an accept, the error will occur at the compile time and not the runtime.

https://github.com/dwursteisen/libgdx-addons/blob/master/assets-gradle-plugin/src/main/kotlin/com/github/dwursteisen/libgdx/assets/AssetsTask.kt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted More advanced tasks that might require advanced knowledge of Kotlin, KTX or LibGDX idea Discussions of possible new features tools Issues of the unreleased ktx-tools module
Projects
None yet
Development

No branches or pull requests

5 participants