[][src]Struct sfml::graphics::ConvexShape

pub struct ConvexShape<'s> { /* fields omitted */ }

Specialized shape representing a convex polygon

It is important to keep in mind that a convex shape must always be... convex, otherwise it may not be drawn correctly. Moreover, the points must be defined in order; using a random order would result in an incorrect shape.

Methods

impl<'s> ConvexShape<'s>[src]

pub fn new(points_count: u32) -> ConvexShape<'s>[src]

Create a new convex shape

Arguments

  • points_count - The number of point for the convex shape

pub fn with_texture(points_count: u32, texture: &'s Texture) -> ConvexShape<'s>[src]

Create a new convex shape with a texture

Arguments

  • texture - The texture to apply to the convex shape
  • points_count - The number of point for the convex shape

pub fn set_point<P: Into<Vector2f>>(&mut self, index: u32, point: P)[src]

Set the position of a point.

Don't forget that the polygon must remain convex, and the points need to stay ordered! set_point_count must be called first in order to set the total number of points. The result is undefined if index is out of the valid range.

Arguments

  • index - Index of the point to change, in range [0 .. get_point_count() - 1]
  • point - New position of the point

pub fn set_point_count(&mut self, count: u32)[src]

Set the number of points of a convex

Arguments

  • count - New number of points of the convex

Important traits for ConvexShapePoints
pub fn points(&self) -> ConvexShapePoints[src]

Return an immutable iterator over all the points of the ConvexShape

Trait Implementations

impl<'s> Drawable for ConvexShape<'s>[src]

impl<'s> Shape<'s> for ConvexShape<'s>[src]

impl<'s> Transformable for ConvexShape<'s>[src]

impl<'s> Drop for ConvexShape<'s>[src]

impl<'s> Clone for ConvexShape<'s>[src]

fn clone(&self) -> ConvexShape<'s>[src]

Return a new ConvexShape or panic! if there is not enough memory

impl<'s> Debug for ConvexShape<'s>[src]

Auto Trait Implementations

impl<'s> !Send for ConvexShape<'s>

impl<'s> !Sync for ConvexShape<'s>

impl<'s> Unpin for ConvexShape<'s>

impl<'s> UnwindSafe for ConvexShape<'s>

impl<'s> RefUnwindSafe for ConvexShape<'s>

Blanket Implementations

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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]