libgdx-skins icon indicating copy to clipboard operation
libgdx-skins copied to clipboard

added checks to prevent crash when style not present

Open julienvillegas opened this issue 8 years ago • 6 comments

Added checks to prevent crash when style not present (Image, TextButton..)

julienvillegas avatar Jan 13 '17 09:01 julienvillegas

I'm guessing you didn't mean to commit all this?

Tom-Ski avatar Jan 13 '17 10:01 Tom-Ski

I did. The majority of the files are from 2 skins I have added. I have copied two skins from https://github.com/czyzby/gdx-skins to see whether new skins could be added, but they initially could not. I noticed that for those skins there isn't always a 'default' style for a given Skin. For example for the TextButton there is no TextButtonStyle element defined.

This caused the previewer to crash. Therefore, before the previewer shows an element, it checks whether that element exists in the Skin with a 'default' style.

Now it works (i.e.: it does not crash and simply show a message). That said, it can be improved further because with those 2 skins the TextButtons are using a ninepatch which is not shown very nicely with the previewer. That might require further modification.

julienvillegas avatar Jan 13 '17 13:01 julienvillegas

You just need to supply the skin folder with assets and an info.json, you dont need to build then commit these the resulting war.

see https://github.com/libgdx/libgdx-skins#submitting-your-skin

Tom-Ski avatar Jan 13 '17 13:01 Tom-Ski

ok, I removed the raw files. Let me know.

julienvillegas avatar Jan 13 '17 13:01 julienvillegas

The raw files as in the link i posted are the only files you need, see the current skins if you want to see the layout. You have pushed the working files from the war directory which shouldn't be included.

Tom-Ski avatar Jan 13 '17 13:01 Tom-Ski

Looks great, Thanks!. If you can just run the LibGDX code formatter over only the lines of code you have changed, then it's good for merging.

Tom-Ski avatar Jan 13 '17 14:01 Tom-Ski