Fix loading screen color and text (#6824)

This commit is contained in:
ichttt 2020-06-30 22:16:51 +02:00 committed by GitHub
parent a79e4b3722
commit 4aa53dbb00
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 12 deletions

View File

@ -140,6 +140,7 @@ class ClientVisualization implements EarlyProgressVisualization.Visualization {
glEnableClientState(GL11.GL_VERTEX_ARRAY);
glEnable(GL_BLEND);
renderBackground();
renderMessages();
glfwSwapBuffers(window);
}
@ -210,6 +211,16 @@ class ClientVisualization implements EarlyProgressVisualization.Visualization {
return j << 16 | k << 8 | l;
}
private void renderBackground() {
glBegin(GL_QUADS);
glColor4f(239F / 255F, 50F / 255F, 61F / 255F, 255F / 255F); //Color from ResourceLoadProgressGui
glVertex2f(0, 0);
glVertex2f(0, screenHeight);
glVertex2f(screenWidth, screenHeight);
glVertex2f(screenWidth, 0);
glEnd();
}
private void renderMessages() {
List<Pair<Integer, StartupMessageManager.Message>> messages = StartupMessageManager.getMessages();
for (int i = 0; i < messages.size(); i++) {
@ -300,9 +311,4 @@ class ClientVisualization implements EarlyProgressVisualization.Visualization {
glfwSwapInterval(1);
return window;
}
@Override
public boolean replacedWindow() {
return running; // TODO is this method necessary? it's only used to prevent the vanilla icon set, which we do want as it only occurs after handoff
}
}

View File

@ -40,10 +40,6 @@ public enum EarlyProgressVisualization {
return visualization.handOffWindow(width, height, title, monitor);
}
public boolean replacedWindow() {
return visualization.replacedWindow();
}
interface Visualization {
Runnable start();
@ -55,8 +51,6 @@ public enum EarlyProgressVisualization {
}
}.getAsLong();
}
default boolean replacedWindow() { return false; }
}
private static class NoVisualization implements Visualization {

View File

@ -72,7 +72,7 @@ public class StartupMessageManager {
}
enum MessageType {
MC(0.0f, 0.0f, 0.0f),
MC(1.0f, 1.0f, 1.0f),
ML(0.0f, 0.0f, 0.5f),
LOC(0.0f, 0.5f, 0.0f),
MOD(0.5f, 0.0f, 0.0f);

View File

@ -72,11 +72,22 @@ public class EarlyLoaderGUI {
RenderSystem.clear(GL11.GL_COLOR_BUFFER_BIT, Minecraft.IS_RUNNING_ON_MAC);
RenderSystem.pushMatrix();
setupMatrix();
renderBackground();
renderMessages();
window.flipFrame();
RenderSystem.popMatrix();
}
private void renderBackground() {
GL11.glBegin(GL11.GL_QUADS);
GL11.glColor4f(239F / 255F, 50F / 255F, 61F / 255F, 255F / 255F); //Color from ResourceLoadProgressGui
GL11.glVertex3f(0, 0, -10);
GL11.glVertex3f(0, window.getScaledHeight(), -10);
GL11.glVertex3f(window.getScaledWidth(), window.getScaledHeight(), -10);
GL11.glVertex3f(window.getScaledWidth(), 0, -10);
GL11.glEnd();
}
private void renderMessages() {
List<Pair<Integer, StartupMessageManager.Message>> messages = StartupMessageManager.getMessages();
for (int i = 0; i < messages.size(); i++) {
@ -113,6 +124,9 @@ public class EarlyLoaderGUI {
RenderSystem.enableBlend();
RenderSystem.disableTexture();
// STBEasyFont's quads are in reverse order or what OGGL expects, so it gets culled for facing the wrong way.
// So Disable culling https://github.com/MinecraftForge/MinecraftForge/pull/6824
RenderSystem.disableCull();
GL14.glBlendColor(0,0,0, alpha);
RenderSystem.blendFunc(GlStateManager.SourceFactor.CONSTANT_ALPHA, GlStateManager.DestFactor.ONE_MINUS_CONSTANT_ALPHA);
RenderSystem.color3f(colour[0],colour[1],colour[2]);
@ -122,6 +136,7 @@ public class EarlyLoaderGUI {
RenderSystem.drawArrays(GL11.GL_QUADS, 0, quads * 4);
RenderSystem.popMatrix();
RenderSystem.enableCull();
GlStateManager.disableClientState(GL11.GL_VERTEX_ARRAY);
MemoryUtil.memFree(charBuffer);
}