pub struct FpsCounter {
pub label: Option<AssetId>,
}Expand description
Requests a frames-per-second counter; optionally writes it to a TextLabel.
Declaring an FpsCounter updates the named TextLabel with the
current rate once per second. Omit label to suppress on-screen display.
To display an FPS overlay, declare a Font, a
TextLabel, and an FpsCounter that references the label:
Fields§
§label: Option<AssetId>A TextLabel to update with the current FPS each second. Leave unset to suppress on-screen display.
Trait Implementations§
Source§impl Clone for FpsCounter
impl Clone for FpsCounter
Source§fn clone(&self) -> FpsCounter
fn clone(&self) -> FpsCounter
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Component for FpsCounter
impl Component for FpsCounter
Source§const NAME: &'static str = "FpsCounter"
const NAME: &'static str = "FpsCounter"
The registry name a world authors this component under.
Source§fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
fn from_baked(bytes: &[u8]) -> Result<Self, CnResult>
Reconstruct this component from a blob record, whose bytes are the
serialized runtime component (cook already ran the asset -> component
translation). The default rejects: runtime-only components are never
stored in a blob, so only loadable types provide an implementation.
Source§fn inject_locator(&mut self, _locator: PayloadLocator)
fn inject_locator(&mut self, _locator: PayloadLocator)
Called after construction to inject the payload locator from the blob def.
Only meaningful for components with a compiled payload.
The default implementation does nothing (correct for most components).
Source§fn inject_name(&mut self, _id: AssetId)
fn inject_name(&mut self, _id: AssetId)
Called after construction to inject the asset’s identity from the blob
def. Only meaningful for components that look themselves up by id at
runtime. The default implementation does nothing.
Source§impl ComponentSlot for FpsCounter
impl ComponentSlot for FpsCounter
Source§const DISCRIMINANT: u8
const DISCRIMINANT: u8
The component type’s stable id, used as its
ComponentId.Source§fn slot(s: &ComponentStorage) -> &Column<Self>
fn slot(s: &ComponentStorage) -> &Column<Self>
Borrow this type’s column out of the storage.
Source§fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>
fn slot_mut(s: &mut ComponentStorage) -> &mut Column<Self>
Mutably borrow this type’s column out of the storage.
Source§impl Debug for FpsCounter
impl Debug for FpsCounter
Source§impl Default for FpsCounter
impl Default for FpsCounter
Source§fn default() -> FpsCounter
fn default() -> FpsCounter
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for FpsCounterwhere
FpsCounter: Default,
impl<'de> Deserialize<'de> for FpsCounterwhere
FpsCounter: Default,
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<FpsCounter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<FpsCounter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<FpsCounter> for ComponentAsset
impl From<FpsCounter> for ComponentAsset
Source§fn from(c: FpsCounter) -> Self
fn from(c: FpsCounter) -> Self
Converts to this type from the input type.
impl RuntimeComponent for FpsCounter
Source§impl Serialize for FpsCounter
impl Serialize for FpsCounter
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,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for FpsCounter
impl RefUnwindSafe for FpsCounter
impl Send for FpsCounter
impl Sync for FpsCounter
impl Unpin for FpsCounter
impl UnsafeUnpin for FpsCounter
impl UnwindSafe for FpsCounter
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
Mutably borrows from an owned value. Read more