Reduced unnecessary reloading of default images. (follow-up 16afcaf)

- GameImage now stores both a default image and skin image, returning the skin image whenever available.
- Default images are loaded once on startup, instead of before every game.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2014-07-04 19:59:57 -04:00
parent 16afcaf3e6
commit 06f8dae037
5 changed files with 146 additions and 52 deletions

View File

@@ -127,14 +127,14 @@ public class Utils {
container.getInput().enableKeyRepeat();
container.setAlwaysRender(true);
// hide the cursor
// set the cursor
try {
// hide the native cursor
Cursor emptyCursor = new Cursor(1, 1, 0, 0, 1, BufferUtils.createIntBuffer(1), null);
container.setMouseCursor(emptyCursor, 0, 0);
} catch (LWJGLException e) {
Log.error("Failed to set the cursor.", e);
}
loadCursor();
// create fonts
@@ -157,6 +157,10 @@ public class Utils {
FONT_MEDIUM = new TrueTypeFont(font.deriveFont(fontBase * 3 / 2), false);
FONT_SMALL = new TrueTypeFont(font.deriveFont(fontBase), false);
// set default game images
for (GameImage o : GameImage.values())
o.setDefaultImage();
// tab image
tab = new Image("selection-tab.png");
float tabScale = (height * 0.033f) / tab.getHeight();