java - AssetManager in LibGDX -


i trying use assetmanager class in libgdx , understand how works trying implement loading screen. have followed assetmanagertest.java file here, having hard time trying figure out how work correctly. can point me in right direction? goal load assets (textures, sounds, fonts, ... etc) , update bar percentage complete on screen. don't understand resolutionfileresolver , resolution[] in link provided. for? goal support static class can give me access of assets need in game screen. there preferred method this? thanks.

after looking @ source resolutionfileresolver other 'resolvers', think it's way of loading textures best match screen resolution, match based on filename patterns.

so in assetmanagertest, he's got textures screen sizes 320x480, 480x800, , 480x854. looks each group of textures should in directory called ".320480" or ".480800" or ".480854" (although name can want, "low", "high", , "wide" if directories), , specifies info when creating array of resolvers on line 56 of test.

the advantage of doing stuff when calls manager.load(), picks out filename "data/animation.png". resolver finds pack of textures closely matches current screen resolution, , loads one.

i think rest of example should pretty clear, @ least basics of assetmanager. create manager, set loader, call load(), call get() use it, , call unload() when done.

for updating progress bar, you'll need manually after each call load.

and using static class asset management 1 possibility. similar option use singleton. has haters, think in simple project in garbage collected environment should ok, although it's same public static.

another option--maybe best?--is use base class has static copy of game globals, , other game classes inherit it. approach used in replica island. see base class , object registry. replica island commented , worth checking out android & java games.


Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

media player - Android: mediaplayer went away with unhandled events -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -