mirror of
https://github.com/4jcraft/4jcraft.git
synced 2026-04-26 13:53:37 +00:00
feat: enhance Linux rendering support and clean up unused UI code
This commit is contained in:
parent
470308f177
commit
e7dfce35d4
|
|
@ -1849,6 +1849,16 @@ void Minecraft::run_middle()
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef __linux__
|
||||
// On Linux, Iggy Flash UI is not available. If no players were rendered
|
||||
// (menu / title-screen state), call GameRenderer directly so mc->screen draws.
|
||||
if (bFirst)
|
||||
{
|
||||
localPlayerIdx = 0;
|
||||
RenderManager.StateSetViewport(C4JRender::VIEWPORT_TYPE_FULLSCREEN);
|
||||
gameRenderer->render(timer->a, true);
|
||||
}
|
||||
#endif
|
||||
// If there's an unoccupied quadrant, then clear that to black
|
||||
if( unoccupiedQuadrant > -1 )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -689,6 +689,12 @@ do
|
|||
} while (minecraftThread->isRunning());
|
||||
delete minecraftThread;
|
||||
|
||||
// Re-acquire the GL context in the main thread.
|
||||
// StartMinecraftThreadProc calls InitialiseContext() which moves the context
|
||||
// to the init thread for texture loading; we must reclaim it here before
|
||||
// any further OpenGL calls in the main render loop.
|
||||
RenderManager.InitialiseContext();
|
||||
|
||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||
|
||||
app.InitGameSettings();
|
||||
|
|
@ -727,9 +733,11 @@ g_NetworkManager.DoWork();
|
|||
PIXEndNamedEvent();
|
||||
|
||||
// Render game graphics.
|
||||
// On Linux, always call run_middle() so mc->screen (TitleScreen etc.) renders
|
||||
// even when the game session has not yet started (Iggy Flash UI is unavailable).
|
||||
pMinecraft->run_middle();
|
||||
if(app.GetGameStarted())
|
||||
{
|
||||
pMinecraft->run_middle();
|
||||
app.SetAppPaused( g_NetworkManager.IsLocalGame() && g_NetworkManager.GetPlayerCount() == 1 && ui.IsPauseMenuDisplayed(ProfileManager.GetPrimaryPad()) );
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -170,22 +170,7 @@ void Screen::renderBackground(int vo)
|
|||
|
||||
void Screen::renderDirtBackground(int vo)
|
||||
{
|
||||
// 4J Unused
|
||||
#if 0
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_FOG);
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
glBindTexture(GL_TEXTURE_2D, minecraft->textures->loadTexture(L"/gui/background.png"));
|
||||
glColor4f(1, 1, 1, 1);
|
||||
float s = 32;
|
||||
t->begin();
|
||||
t->color(0x404040);
|
||||
t->vertexUV((float)(0), (float)( height), (float)( 0), (float)( 0), (float)( height / s + vo));
|
||||
t->vertexUV((float)(width), (float)( height), (float)( 0), (float)( width / s), (float)( height / s + vo));
|
||||
t->vertexUV((float)(width), (float)( 0), (float)( 0), (float)( width / s), (float)( 0 + vo));
|
||||
t->vertexUV((float)(0), (float)( 0), (float)( 0), (float)( 0), (float)( 0 + vo));
|
||||
t->end();
|
||||
#endif
|
||||
// 4J Unused - Iggy Flash UI renders the background on consoles
|
||||
}
|
||||
|
||||
bool Screen::isPauseScreen()
|
||||
|
|
|
|||
|
|
@ -126,35 +126,5 @@ void TitleScreen::buttonClicked(Button *button)
|
|||
|
||||
void TitleScreen::render(int xm, int ym, float a)
|
||||
{
|
||||
// 4J Unused
|
||||
#if 0
|
||||
renderBackground();
|
||||
Tesselator *t = Tesselator::getInstance();
|
||||
|
||||
int logoWidth = 155 + 119;
|
||||
int logoX = width / 2 - logoWidth / 2;
|
||||
int logoY = 30;
|
||||
|
||||
glBindTexture(GL_TEXTURE_2D, minecraft->textures->loadTexture(L"/title/mclogo.png"));
|
||||
glColor4f(1, 1, 1, 1);
|
||||
blit(logoX + 0, logoY + 0, 0, 0, 155, 44);
|
||||
blit(logoX + 155, logoY + 0, 0, 45, 155, 44);
|
||||
t->color(0xffffff);
|
||||
glPushMatrix();
|
||||
glTranslatef((float)width / 2 + 90, 70, 0);
|
||||
|
||||
glRotatef(-20, 0, 0, 1);
|
||||
float sss = 1.8f - Mth::abs(Mth::sin(System::currentTimeMillis() % 1000 / 1000.0f * PI * 2) * 0.1f);
|
||||
|
||||
sss = sss * 100 / (font->width(splash) + 8 * 4);
|
||||
glScalef(sss, sss, sss);
|
||||
drawCenteredString(font, splash, 0, -8, 0xffff00);
|
||||
glPopMatrix();
|
||||
|
||||
drawString(font, ClientConstants::VERSION_STRING, 2, 2, 0x505050);
|
||||
wstring msg = L"Copyright Mojang AB. Do not distribute.";
|
||||
drawString(font, msg, width - font->width(msg) - 2, height - 10, 0xffffff);
|
||||
|
||||
Screen::render(xm, ym, a);
|
||||
#endif
|
||||
// 4J Unused - Iggy Flash UI renders the title screen on consoles
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue