pub struct Screen {
pub asset_id: AssetId,
pub initial: bool,
pub fade_in_secs: f32,
pub toggle_key: String,
pub input: ScreenInput,
pub pauses_world: bool,
pub focus: Option<AssetId>,
pub layer: i32,
}Expand description
A named full-screen layer of UI drawn over the world: a pause menu, a settings page, a console, a score overlay.
UI elements (Sprite, TextLabel,
TextInput, HitRegion) belong to a screen by
name prefix <screen_name>_*, mirroring the Scene →
Prop convention. Active screens form a stack; each is shown /
hidden via HitRegion or KeyBinding actions:
screen:show:<name>replaces the top of the stack (menu navigation)screen:push:<name>opens on top of what is already showingscreen:hidecloses the top screen, revealing what was beneathscreen:toggle:<name>closes the screen if it is on top, opens it otherwise
Screens draw in stack order (later on top); layer orders a screen
against the always-on HUD and other screens independent of stack position.
While any active screen has pauses_world set, the world freezes exactly
as today’s pause menu does. A toggle_key opens and closes the screen from
anywhere. focus names a TextInput that receives keyboard
focus whenever the screen reaches the top of the stack. Worlds that need no
menus simply declare no screens.
Screen {
toggle_key: "Escape".into(),
..Default::default()
};Fields§
§asset_id: AssetIdAssigned by the loader; not authored.
initial: boolWhen true, this screen is shown as soon as the world loads.
fade_in_secs: f32Seconds to fade the screen in when it’s shown. 0 shows it instantly.
toggle_key: StringInputKey that toggles this screen open / closed from anywhere, by the same canonical key names a KeyBinding uses (e.g. “Escape”, “Backtick”). Empty leaves the screen action-driven only.
input: ScreenInputInput policy while the screen is active.
pauses_world: boolWhen true (the default), the world pauses beneath this screen while it is active: gameplay input, physics, and animation freeze.
focus: Option<AssetId>TextInput that receives keyboard focus whenever this screen reaches the top of the stack.
layer: i32Draw-order bias against the always-on HUD and other screens. Screens default above the HUD in stack order; a negative layer draws beneath the HUD, a higher layer stays above later-pushed screens.
Trait Implementations§
Source§impl Component for Screen
impl Component for Screen
Source§fn inject_name(&mut self, id: AssetId)
fn inject_name(&mut self, id: AssetId)
Source§fn from_baked(bytes: &[u8]) -> Result<Screen, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Screen, CnResult>
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Source§impl ComponentSlot for Screen
impl ComponentSlot for Screen
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
ComponentId.Source§impl<'de> Deserialize<'de> for Screen
impl<'de> Deserialize<'de> for Screen
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Screen, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Screen, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl From<Screen> for ComponentAsset
impl From<Screen> for ComponentAsset
Source§fn from(c: Screen) -> ComponentAsset
fn from(c: Screen) -> ComponentAsset
impl RuntimeComponent for Screen
Source§impl Serialize for Screen
impl Serialize for Screen
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for Screen
impl RefUnwindSafe for Screen
impl Send for Screen
impl Sync for Screen
impl Unpin for Screen
impl UnsafeUnpin for Screen
impl UnwindSafe for Screen
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().