[][src]Struct amethyst_ui::UiButtonBuilder

pub struct UiButtonBuilder<G, I: WidgetId> { /* fields omitted */ }

Convenience structure for building a button

Methods

impl<'a, G: PartialEq + Send + Sync + 'static, I: WidgetId> UiButtonBuilder<G, I>[src]

pub fn new<S: ToString>(text: S) -> UiButtonBuilder<G, I>[src]

Construct a new UiButtonBuilder. This allows easy use of default values for text and button appearance and allows the user to easily set other UI-related options. It also allows easy retrieval and updating through the appropriate widgets resouce, see Widgets.

pub fn with_id(self, id: I) -> Self[src]

Sets an ID for this widget. The type of this ID will determine which Widgets resource this widget will be added to, see see Widgets.

pub fn with_parent(self, parent: Entity) -> Self[src]

Add a parent to the button.

pub fn with_anchor(self, anchor: Anchor) -> Self[src]

Add an anchor to the button.

pub fn with_stretch(self, stretch: Stretch) -> Self[src]

Stretch the button.

pub fn with_text<S>(self, text: S) -> Self where
    S: ToString
[src]

This will set the rendered characters within the button. Use this to just change what characters will appear. If you need to change the font size, color, etc., then you should use with_uitext and provide a new UiText object.

pub fn with_image(self, image: Handle<Texture>) -> Self[src]

Replace the default Handle with image.

pub fn with_font(self, font: FontHandle) -> Self[src]

Use a different font for the button text.

pub fn with_position(self, x: f32, y: f32) -> Self[src]

Provide an X and Y position for the button.

This will create a default UiTransform if one is not already attached. See DEFAULT_Z, DEFAULT_WIDTH, DEFAULT_HEIGHT, and DEFAULT_TAB_ORDER for the values that will be provided to the default UiTransform.

pub fn with_layer(self, z: f32) -> Self[src]

Provide a Z position, i.e UI layer

pub fn with_size(self, width: f32, height: f32) -> Self[src]

Set button size

pub fn with_tab_order(self, tab_order: u32) -> Self[src]

Set button tab order

pub fn with_font_size(self, size: f32) -> Self[src]

Set font size

pub fn with_text_color(self, text_color: [f32; 4]) -> Self[src]

Set text color

pub fn with_hover_text_color(self, text_color: [f32; 4]) -> Self[src]

Text color to use when the mouse is hovering over this button

pub fn with_press_text_color(self, text_color: [f32; 4]) -> Self[src]

Set text color when the button is pressed

pub fn with_hover_image(self, image: UiImage) -> Self[src]

Button image to use when the mouse is hovering over this button

pub fn with_press_image(self, image: UiImage) -> Self[src]

Button image to use when this button is pressed

pub fn with_hover_sound(self, sound: SourceHandle) -> Self[src]

Sound emitted when this button is hovered over

pub fn with_press_sound(self, sound: SourceHandle) -> Self[src]

Sound emitted when this button is pressed

pub fn with_release_sound(self, sound: SourceHandle) -> Self[src]

Sound emitted when this button is released

pub fn build(self, res: UiButtonBuilderResources<'a, G, I>) -> (I, UiButton)[src]

Build this with the UiButtonBuilderResources.

pub fn build_from_world(self, world: &World) -> (I, UiButton)[src]

Create the UiButton based on provided configuration parameters.

Trait Implementations

impl<G, I> Default for UiButtonBuilder<G, I> where
    I: WidgetId
[src]

impl<G: Clone, I: Clone + WidgetId> Clone for UiButtonBuilder<G, I>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<G: Debug, I: Debug + WidgetId> Debug for UiButtonBuilder<G, I>[src]

Auto Trait Implementations

impl<G, I> Unpin for UiButtonBuilder<G, I> where
    G: Unpin,
    I: Unpin

impl<G, I> Sync for UiButtonBuilder<G, I> where
    G: Sync

impl<G, I> Send for UiButtonBuilder<G, I> where
    G: Send

impl<G, I> UnwindSafe for UiButtonBuilder<G, I> where
    G: UnwindSafe,
    I: UnwindSafe

impl<G, I> RefUnwindSafe for UiButtonBuilder<G, I> where
    G: RefUnwindSafe,
    I: RefUnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> Resource for T where
    T: Any + Send + Sync
[src]

impl<T> Any for T where
    T: Any
[src]

impl<T> TryDefault for T where
    T: Default
[src]

fn unwrap_default() -> Self[src]

Calls try_default and panics on an error case.

impl<T> Event for T where
    T: Send + Sync + 'static, 
[src]

impl<T> Erased for T[src]

impl<T> Clone for T where
    T: Clone
[src]

impl<T> SetParameter for T[src]

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where
    T: Parameter<Self>, 
[src]

Sets value as a parameter of self.

impl<T> Supports<T> for T[src]

impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
    D: AdaptFrom<S, Swp, Dwp, T>,
    Dwp: WhitePoint,
    Swp: WhitePoint,
    T: Component + Float
[src]

fn adapt_into(self) -> D[src]

Convert the source color to the destination color using the bradford method by default Read more

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]