Struct Clay

Source
pub struct Clay<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> Clay<'a>

Source

pub fn new(dimensions: Dimensions) -> Self

Source

pub fn data<T>(&self, data: &T) -> DataRef<'a>

Get a reference to the data to pass to clay or the builders. This is to ensure that the data is not dropped before clay is done with it.

Source

pub fn required_memory_size() -> usize

Wrapper for Clay_MinMemorySize, returns the minimum required memory by clay

Source

pub fn measure_text_function(&self, func: MeasureTextFunction)

Sets the function used by clay to measure dimensions of strings of Text elements

Source

pub fn max_element_count(&self, max_element_count: u32)

Sets the maximum number of element that clay supports Use only if you know what you are doing or your getting errors from clay

Source

pub fn max_measure_text_cache_word_count(&self, count: u32)

Sets the capacity of the cache used for text in the measure text function Use only if you know what you are doing or your getting errors from clay

Source

pub fn enable_debug_mode(&self, enable: bool)

Enables or disables the debug mode of clay

Source

pub fn layout_dimensions(&self, dimensions: Dimensions)

Sets the dimensions of the global layout, use if, for example the window size you render to changed

Source

pub fn pointer_state(&self, position: Vector2, is_down: bool)

Updates the state of the pointer for clay. Used to update scroll containers and for interactions functions

Source

pub fn update_scroll_containers( &self, drag_scrolling_enabled: bool, scroll_delta: Vector2, delta_time: f32, )

Source

pub fn hovered(&self) -> bool

Returns if the current element you are creating is hovered

Source

pub fn pointer_over(&self, cfg: TypedConfig) -> bool

Source

pub fn get_bounding_box(&self, id: TypedConfig) -> Option<BoundingBox>

Source

pub fn begin(&self)

Source

pub fn end(&self) -> impl Iterator<Item = RenderCommand<'_>>

Source

pub fn with<F: FnOnce(&Clay<'_>), const N: usize>( &self, configs: [TypedConfig; N], f: F, )

Create an element, passing it’s config and a function to add childrens

// TODO: Add Example
Source

pub fn text(&self, text: &str, config: TextElementConfig)

Adds a text element to the current open element or to the root layout

Auto Trait Implementations§

§

impl<'a> Freeze for Clay<'a>

§

impl<'a> RefUnwindSafe for Clay<'a>

§

impl<'a> !Send for Clay<'a>

§

impl<'a> !Sync for Clay<'a>

§

impl<'a> Unpin for Clay<'a>

§

impl<'a> UnwindSafe for Clay<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.