Fix Splash Animation
This commit is contained in:
parent
c88db307d7
commit
37e1abbdd3
@ -92,6 +92,7 @@ static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x
|
|||||||
float splash_x = (float(screen->width) / 2.0f) + (94.0f * multiplier);
|
float splash_x = (float(screen->width) / 2.0f) + (94.0f * multiplier);
|
||||||
float splash_y = 4.0f + (36.0f * multiplier);
|
float splash_y = 4.0f + (36.0f * multiplier);
|
||||||
float max_width = 86;
|
float max_width = 86;
|
||||||
|
float max_scale = 2.0f;
|
||||||
// Draw (From https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/client/gui/screens/StartMenuScreen.cpp#L699-L718)
|
// Draw (From https://github.com/ReMinecraftPE/mcpe/blob/d7a8b6baecf8b3b050538abdbc976f690312aa2d/source/client/gui/screens/StartMenuScreen.cpp#L699-L718)
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
// Position
|
// Position
|
||||||
@ -100,8 +101,8 @@ static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x
|
|||||||
// Scale
|
// Scale
|
||||||
int textWidth = Font_width(screen->font, ¤t_splash);
|
int textWidth = Font_width(screen->font, ¤t_splash);
|
||||||
float timeMS = float(Common_getTimeMs() % 1000) / 1000.0f;
|
float timeMS = float(Common_getTimeMs() % 1000) / 1000.0f;
|
||||||
float scale = 2.0f - Mth_abs(0.1f * Mth_sin(2.0f * float(M_PI) * timeMS));
|
float scale = max_scale - Mth_abs(0.1f * Mth_sin(2.0f * float(M_PI) * timeMS));
|
||||||
float real_text_width = textWidth * scale;
|
float real_text_width = textWidth * max_scale;
|
||||||
if (real_text_width > max_width) {
|
if (real_text_width > max_width) {
|
||||||
scale *= max_width / real_text_width;
|
scale *= max_width / real_text_width;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user