What I did was create a simple asset library that stores things in a hashmap. At start up, whatever is being drawn reads in the asset library and sets up direct references to the
1 2 3 4 5 6 7 8 9 10
| public HUD(AssetLibrary aLib) { this.mainFont = aLib.getFont("HUDFont"); }
...
public void draw(SpriteBatch batch) { ... this.mainFont.draw("HEALTH: "+player.health); } |
It's fast, and your Asset Library is only needed when the main objects are created, not at every tick. There is a bit more memory being used because you are holding additional references to the various items in your asset library, but it shouldn't matter (hasn't been a problem for me).