-
Notifications
You must be signed in to change notification settings - Fork 7
Screen
Refaltor77 edited this page Mar 29, 2026
·
1 revision
Root screen element that controls how the entire screen behaves in-game.
use refaltor\ui\elements\Screen;
$screen = Screen::create("my_screen");$screen->setRenderOnlyWhenTopMost(true); // Only render when on top
$screen->setRenderGameBehind(true); // Show game world behind
$screen->setForceRenderBelow(false); // Force render below other screens
$screen->setLowFreqRendering(true); // Reduce render frequency
$screen->setCacheScreen(false); // Keep in memory for fast re-open$screen->setAbsorbInput(true); // Block input to game
$screen->setIsModal(true); // Modal behavior
$screen->setIsShowingMenu(true); // Pause game (showing menu)
$screen->setShouldStealMouse(false); // Capture mouse cursor
$screen->setAlwaysAcceptsInput(false); // Accept input even when not topmost$screen->setCloseOnPlayerHurt(false); // Close when taking damage
$screen->setSendTelemetry(false); // Send analytics
$screen->setScreenNotFlushable(false); // Prevent screen flush$menu = Screen::create("game_menu")
->setRenderOnlyWhenTopMost(true)
->setRenderGameBehind(false)
->setAbsorbInput(true)
->setIsShowingMenu(true)
->setIsModal(true)
->setSizePercentage(100, 100);$hud = Screen::create("hud_overlay")
->setRenderOnlyWhenTopMost(false)
->setRenderGameBehind(true)
->setAbsorbInput(false)
->setIsShowingMenu(false)
->setIsModal(false)
->setForceRenderBelow(true)
->setSizePercentage(100, 100);$fragile = Screen::create("crafting_screen")
->setCloseOnPlayerHurt(true)
->setRenderGameBehind(true)
->setIsModal(false)
->setSizePercentage(100, 100);$cached = Screen::create("shop_screen")
->setCacheScreen(true)
->setRenderOnlyWhenTopMost(true)
->setIsModal(true)
->setSizePercentage(100, 100);- Element — Base class
- InputPanel — Input handling within screens