Java-Gaming.org Hi !
Featured games (91)
games approved by the League of Dukes
Games in Showcase (805)
Games in Android Showcase (239)
games submitted by our members
Games in WIP (868)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  [LibGDX] [SOLVED] JSON, What does it know how to use?  (Read 1497 times)
0 Members and 1 Guest are viewing this topic.
Offline MrPork
« Posted 2016-07-28 05:49:10 »

Ok here it goes

*Skins can use JSON files
*You can define JSON files to stylize the skins

ie.

1  
2  
3  
4  
5  
6  
7  
8  
{
    com.badlogic.gdx.graphics.Color: {
        green: { r: 0, g: 1, b: 0, a: 1 }
    },
    com.badlogic.gdx.scenes.scene2d.ui.Skin$TintedDrawable: {
        round-green: { name: round, color: green }
    }
}


*How does the JSON file know what image to use?
*Do I name an atlas file the same as the JSON file?

"f**k it, maybe it'll work." -Me
Offline SHC
« Reply #1 - Posted 2016-07-28 07:20:22 »

Slightly off topic, but what you had there is not valid JSON. The keys in JSON should be strings.

Offline CoDi^R
« Reply #2 - Posted 2016-07-28 09:42:53 »

The libGDX skin files aren't valid JSON. This is ... known behaviour.

Quote from: MrPork
*How does the JSON file know what image to use?

In your example, "round" is the name of the sprite (TextureRegion) in your sprite atlas.

Quote from: MrPork
*Do I name an atlas file the same as the JSON file?

By default, yes: new Skin("myskin.json") looks for and loads "myskin.atlas". The skins are pretty flexible though, so it is also possible to create one from scratch, or load/add more texture atlases at runtime.

Robotality - steamworks4j - @code_disaster - codi^r @ #java-gaming
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline MrPork
« Reply #3 - Posted 2016-07-28 15:51:20 »

Thank you brother

"f**k it, maybe it'll work." -Me
Pages: [1]
  ignore  |  Print  
 
 

 
Riven (585 views)
2019-09-04 15:33:17

hadezbladez (5526 views)
2018-11-16 13:46:03

hadezbladez (2406 views)
2018-11-16 13:41:33

hadezbladez (5788 views)
2018-11-16 13:35:35

hadezbladez (1227 views)
2018-11-16 13:32:03

EgonOlsen (4666 views)
2018-06-10 19:43:48

EgonOlsen (5685 views)
2018-06-10 19:43:44

EgonOlsen (3200 views)
2018-06-10 19:43:20

DesertCoockie (4100 views)
2018-05-13 18:23:11

nelsongames (5117 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!