package me.sashegdev.justasplash.splash; import me.sashegdev.justasplash.config.SplashConfig; public class SplashManager { private static State state = State.IDLE; private static float alpha = 0f; private static long startTime = 0; private static float duration = 3.0f; enum State { IDLE, SHOWING } public static void show() { if (state == State.SHOWING) return; SplashAssetCache.load(SplashConfig.get()); state = State.SHOWING; alpha = 1.0f; startTime = System.currentTimeMillis(); duration = SplashConfig.get().duration; SplashSound.play(); } public static void tick() { if (state != State.SHOWING) return; float elapsed = (System.currentTimeMillis() - startTime) / 1000f; alpha = 1.0f - (elapsed / duration); if (alpha <= 0f) { alpha = 0f; state = State.IDLE; SplashSound.stop(); } } public static void renderOverlay() { if (state != State.SHOWING) return; if (alpha <= 0f) return; SplashRenderer.render(alpha); } public static boolean isShowing() { return state == State.SHOWING; } }