Skip to main content

Kind

Enum Kind 

Source
pub enum Kind {
Show 14 variants Group, Ribbon { vertical: bool, uniform: bool, spacing: i32, cells: Vec<i32>, }, Border { sprites: [Option<SpriteRef>; 9], }, Image { sprite: Option<SpriteRef>, size: [i32; 2], }, AnimatedImage { sprites: Vec<Option<SpriteRef>>, size: [i32; 2], frames_per_second: i32, frame: usize, clock: f64, }, Button { states: [Option<NodeId>; 4], content: Option<NodeId>, colors: [u32; 4], state: usize, }, Text(TextData), Label { text: TextData, icon: Option<SpriteRef>, icon_size: [i32; 2], text_alignment: u32, orientation: u32, min_text_width: i32, gap: i32, icon_color: u32, }, Viewport, List(ListData), Lines { sprite: Option<SpriteRef>, size: [i32; 2], lines: Vec<[i32; 4]>, }, Picture { texture: u32, size: [i32; 2], }, Control(Control), Unsupported(&'static str),
}
Expand description

What an element is, with the state of its class.

Variants§

§

Group

A group: its children are laid out on top of each other, each by its alignment.

§

Ribbon

A ribbon: its children in a row or a column.

Fields

§vertical: bool

A column when true, a row when false.

§uniform: bool

Whether every cell has the size of the largest child.

§spacing: i32

The space between the cells, in pixels.

§cells: Vec<i32>

The size of each cell after the last layout.

§

Border

A frame drawn from nine sprites: four corners, four edges and the centre.

Fields

§sprites: [Option<SpriteRef>; 9]

The nine sprites, row by row.

§

Image

One sprite.

Fields

§sprite: Option<SpriteRef>

The sprite.

§size: [i32; 2]

Its size in pixels.

§

AnimatedImage

A sequence of sprites played as an animation (for example the loading screen).

Fields

§sprites: Vec<Option<SpriteRef>>

The frames.

§size: [i32; 2]

The size in pixels.

§frames_per_second: i32

The frame rate.

§frame: usize

The frame shown now.

§clock: f64

Its own clock, from its creation, kept within one loop of the frames.

§

Button

A button: one child element for each state, and its content.

Fields

§states: [Option<NodeId>; 4]

The element shown in each state: normal, hot (under the pointer), pressed, disabled.

§content: Option<NodeId>

The content (a label or an image).

§colors: [u32; 4]

The content’s colour in each state.

§state: usize

The current state, 0 to 3.

§

Text(TextData)

Text.

§

Label

Text with an optional icon.

Fields

§text: TextData

The text.

§icon: Option<SpriteRef>

The icon.

§icon_size: [i32; 2]

The icon’s size in pixels.

§text_alignment: u32

The alignment of the text.

§orientation: u32

Whether the icon is beside the text or above it.

§min_text_width: i32

The smallest width of the text, in pixels.

§gap: i32

The space between the icon and the text, in pixels.

§icon_color: u32

The icon’s colour (LabelElement::SetSpriteColor), drawn as it is.

§

Viewport

Reserves space the application draws into (3D view, previews).

§

List(ListData)

Scrolling list of text rows (tool widget, styled with game assets).

§

Lines

Line segments in element pixels, drawn with the sprite in the element colour and clipped to the element (the game’s FrustumOutlineElement, SpriteContext::AddLine).

Fields

§sprite: Option<SpriteRef>

The sprite the lines are drawn with.

§size: [i32; 2]

The element’s size in pixels.

§lines: Vec<[i32; 4]>

The lines: x0, y0, x1, y1 in element pixels.

§

Picture

Application texture drawn letterboxed inside the element.

Fields

§texture: u32

The application’s texture number (Texture::External).

§size: [i32; 2]

The texture’s size in pixels.

§

Control(Control)

A control with state: a check box, a slider, an edit box, a combo box and others.

§

Unsupported(&'static str)

An element class that is not implemented, by name. It is laid out but not drawn.

Trait Implementations§

Source§

impl Clone for Kind

Source§

fn clone(&self) -> Kind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Kind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Kind

§

impl RefUnwindSafe for Kind

§

impl Send for Kind

§

impl Sync for Kind

§

impl Unpin for Kind

§

impl UnsafeUnpin for Kind

§

impl UnwindSafe for Kind

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.