Clean progress bar code and fix TextureMap patch (#5304)

This commit is contained in:
mezz authored and GitHub committed 2018-12-28 18:05:05 -08:00
1 parent b4cf6f7f36
commit dc12cda505
15 files changed
+632 -290

No files matched your search

@@ -125,8 +125,10 @@ public class SplashProgress
private static final int TIMING_FRAME_THRESHOLD = TIMING_FRAME_COUNT * 5 * 1000000; // 5 ms per frame, scaled to nanos
private static final Semaphore mutex = new Semaphore(1);
*/
public static Void processMessages() {
public static void processMessages() {
/*
// workaround for windows requiring messages being processed on the main thread
if (LWJGLUtil.getPlatform() != LWJGLUtil.PLATFORM_WINDOWS) return null;
// If we can't grab the mutex, the update call is blocked, probably in native code, just skip it and carry on
@@ -134,9 +136,9 @@ public class SplashProgress
if (!SplashProgress.mutex.tryAcquire()) return null;
Display.processMessages();
SplashProgress.mutex.release();
return null;
*/
}
/*
private static String getString(String name, String def)
{
String value = config.getProperty(name, def);
@@ -448,9 +450,10 @@ public class SplashProgress
drawBox(barWidth - 2, barHeight - 2);
// slidy part
setColor(barColor);
drawBox((barWidth - 2) * (b.getStep() + 1) / (b.getSteps() + 1), barHeight - 2); // Step can sometimes be 0.
int step = b.getStep();
drawBox((barWidth - 2) * (step + 1) / (b.getTotalSteps() + 1), barHeight - 2); // Step can sometimes be 0.
// progress text
String progress = "" + b.getStep() + "/" + b.getSteps();
String progress = "" + step + "/" + b.getTotalSteps();
glTranslatef(((float)barWidth - 2) / 2 - fontRenderer.getStringWidth(progress), 2, 0);
setColor(fontColor);
glScalef(2, 2, 1);