gdx-setup icon indicating copy to clipboard operation
gdx-setup copied to clipboard

KTX templates

Open czyzby opened this issue 8 years ago • 18 comments

  • [x] Simple Kotlin application with some basic KTX features.
  • [ ] Advanced KTX usage. Scene2D?

See KTX.

czyzby avatar Oct 01 '16 18:10 czyzby

@kotcrab Would you like to add a ktx-vis template to gdx-setup?

czyzby avatar Oct 01 '16 19:10 czyzby

Yeah I can add it or if you are going to make scene2d template you can also make vis template so they would be more or less consistent. Whatever you prefer.

kotcrab avatar Oct 02 '16 20:10 kotcrab

If you want to showcase some VisUI widgets, you can go ahead and prepare a custom project template, but if we're going with simple templates (kind of like the existing one-window-only basic Scene2D templates), switching from ktx-scene2d to ktx-vis should be a matter of switching the import.

czyzby avatar Oct 03 '16 07:10 czyzby

Somewhat blocked by https://github.com/czyzby/ktx/issues/21.

czyzby avatar Oct 03 '16 07:10 czyzby

@czyzby I've created a Ktx boilerplate code, using kotlin-dsl, that could be used as a start of a template for gdx-setup. There's still some work to do on the gradle side, but for the code, it creates a Lwjgl3Application, and uses KtxGame and KtxScreen. If you want to have a look at it, and give any input/suggestions: https://github.com/DavidPartouche/ktx-boilerplate

DavidPartouche avatar Aug 15 '18 10:08 DavidPartouche

gdx-setup templates usually render an image, at the very least. KtxGame without any overloaded methods and without setting the first screen would be somewhat hard to use for a beginner. Check the basic ("classic") templates that render LibGDX logo - converting that to Kotlin with some basic KTX features would be enough as far as the first KTX template goes.

czyzby avatar Aug 15 '18 10:08 czyzby

Ok, the classic boilerplate is done. I'm gonna start to add the template to gdx-setup.

DavidPartouche avatar Aug 16 '18 02:08 DavidPartouche

I've created a new classic template, the feature branch is here: https://github.com/DavidPartouche/gdx-setup/tree/feature/ktx-classic I'm not pushing it yet, because some things are missing:

  • KTX_VERSION hard-coded, we should ask the user which version to use, but at the moment all the ktx packages are selectable in Third-party with individual versions, I guess that would be better that the user uses from the extension, and we can select which version to use inside the Advanced tab (like for LibGDX)
  • The gradle files are not in Kotlin DSL yet.

Also maybe we could create a new project (ktx-setup) where only Ktx projects could be created. What do you think?

DavidPartouche avatar Aug 17 '18 06:08 DavidPartouche

KTX_VERSION hard-coded

KTX_VERSION only determines the default version for the dependencies. If the user changes that in the third-party extension menu, it will affect dependencies required by your template.

The gradle files are not in Kotlin DSL yet.

Groovy DSL is fine for now, until Kotlin matures and becomes the standard.

Also maybe we could create a new project (ktx-setup) where only Ktx projects could be created. What do you think?

I actually thought about this for a while, but I just don't have as much time for open source as I did when I was still the the university. This is also a chance to correct the mistakes of gdx-setup:

  • The tool should be 100% web based, preferably with no server application. Kind of like Spring Initializr. This ensures decent accessibility, and does not require the users to download and run arbitrary jars from GitHub.
  • All dependencies versions should be fetched automatically - KTX from the repo (similarly to how official website fetches the latest version), third-party libs from Maven Central.
  • Additionally to listing some LibGDX third-party libraries, we might have a crude Maven Central search, so that any library can be added to build.gradle.

As for your commit, you should not modify CoreGradleFile or addJvmLanguagesSupport. isKtxTemplate marker should be unnecessary. See how other templates include their dependencies.

czyzby avatar Aug 17 '18 07:08 czyzby

Ok, I've made the change. I still have to use fun addKotlin() in languages.kt so that the project can launch. I don't know if there's a better way to do it, just let me know.

Writing a new tool from scratch would take a lot of time indeed. What framework would you recommend using? I'm pretty new to Kotlin, so I don't know the ecosystem yet (and I'm an android and game developer, so I don't know much about web apps....)

DavidPartouche avatar Aug 17 '18 09:08 DavidPartouche

I wouldn't ask you to write the application from scratch, knowing I might not have enough time to contribute. I think the work you started on ktx-tools and the KTX template is already great. I feel like there are more important thing we can do for KTX, like actual game examples and some simple tutorials. KTX is pretty easy to add to an existing LibGDX project as it is.

czyzby avatar Aug 17 '18 10:08 czyzby

Ok, I'll jump back to ktx-tools. If there are other Ktx templates you'd like to have, just let me know, now that I've done one, creating other templates will be quick.

DavidPartouche avatar Aug 18 '18 01:08 DavidPartouche

Thanks @DavidPartouche. I'll release the next beta version this week.

czyzby avatar Aug 21 '18 06:08 czyzby

I've created a new sample, taken from gamesfromwithin, and changed to use Ktx https://github.com/DavidPartouche/KtxGraphicDemo As it uses KtxApplicationAdapter and AssetManager to load the texture, would you like to have it also implemented as a template? It's quite basic though, so I don't know about the value of it.

DavidPartouche avatar Aug 24 '18 08:08 DavidPartouche

I don't think we need much more templates, except some advanced KTX usage.

@DavidPartouche If you add a screenshot and improve the README a bit (how to run, how to compile, etc.), I can link your repo in the official KTX documentation. Maybe a separate repository for KTX examples would also be nice.

czyzby avatar Aug 24 '18 15:08 czyzby

Yeah I was thinking about doing this, going through the LibGDX tutorial on Games from Scratch, and adding a repo for all the examples converted to KTX.

DavidPartouche avatar Aug 25 '18 00:08 DavidPartouche

@DavidPartouche What happened to the KtxGraphicDemo? The link is dead.

the-sauce avatar Feb 03 '19 19:02 the-sauce

@DavidPartouche taking some time learning libGdx from scratch and wanted to get off on the right foot with a KTX example since I prefer Kotlin. Do you have a good place to start? I was thinking about following these guides from with a bare working KTX example : https://libgdx.info/basic_image/

bajabob avatar Feb 08 '19 02:02 bajabob