Struct sfml::graphics::CustomShape
source · pub struct CustomShape<'s> { /* private fields */ }
Expand description
A custom textured shape with outline.
Implementations§
source§impl<'s> CustomShape<'s>
impl<'s> CustomShape<'s>
sourcepub fn new(points: Box<dyn CustomShapePoints + Send>) -> CustomShape<'s>
pub fn new(points: Box<dyn CustomShapePoints + Send>) -> CustomShape<'s>
sourcepub fn with_texture(
points: Box<dyn CustomShapePoints + Send>,
texture: &'s Texture
) -> CustomShape<'s>
pub fn with_texture(
points: Box<dyn CustomShapePoints + Send>,
texture: &'s Texture
) -> CustomShape<'s>
Create a new CustomShape
with a texture
Arguments
- points - Implementation of
CustomShapePoints
trait - texture - The texture to bind to the
CustomShape
sourcepub fn update(&mut self)
pub fn update(&mut self)
Recompute the internal geometry of a shape
This function must be called by specialized shape objects
everytime their points change (ie. the result of either
the point_count
or point
callbacks is different).
Trait Implementations§
source§impl<'s> Debug for CustomShape<'s>
impl<'s> Debug for CustomShape<'s>
source§impl<'s> Drawable for CustomShape<'s>
impl<'s> Drawable for CustomShape<'s>
source§fn draw<'a: 'shader, 'texture, 'shader, 'shader_texture>(
&'a self,
target: &mut dyn RenderTarget,
states: &RenderStates<'texture, 'shader, 'shader_texture>
)
fn draw<'a: 'shader, 'texture, 'shader, 'shader_texture>(
&'a self,
target: &mut dyn RenderTarget,
states: &RenderStates<'texture, 'shader, 'shader_texture>
)
source§impl<'s> Drop for CustomShape<'s>
impl<'s> Drop for CustomShape<'s>
source§impl<'s> Shape<'s> for CustomShape<'s>
impl<'s> Shape<'s> for CustomShape<'s>
source§fn set_texture(&mut self, texture: &'s Texture, reset_rect: bool)
fn set_texture(&mut self, texture: &'s Texture, reset_rect: bool)
Changes the source texture of the shape. Read more
source§fn disable_texture(&mut self)
fn disable_texture(&mut self)
Disables texturing for this shape.
source§fn set_texture_rect(&mut self, rect: IntRect)
fn set_texture_rect(&mut self, rect: IntRect)
Sets the sub-rectangle of the texture that the shape will display. Read more
source§fn set_fill_color(&mut self, color: Color)
fn set_fill_color(&mut self, color: Color)
Sets the fill color of the shape. Read more
source§fn set_outline_color(&mut self, color: Color)
fn set_outline_color(&mut self, color: Color)
Sets the outline color of the shape. Read more
source§fn set_outline_thickness(&mut self, thickness: f32)
fn set_outline_thickness(&mut self, thickness: f32)
Sets the thickness of the shape’s outline. Read more
source§fn texture_rect(&self) -> IntRect
fn texture_rect(&self) -> IntRect
Gets the sub-rectangle of the texture displayed by the shape.
source§fn fill_color(&self) -> Color
fn fill_color(&self) -> Color
Gets the fill color of this shape.
source§fn outline_color(&self) -> Color
fn outline_color(&self) -> Color
Gets the outline color of this shape.
source§fn outline_thickness(&self) -> f32
fn outline_thickness(&self) -> f32
Gets the outline thickness of this shape.
source§fn point_count(&self) -> usize
fn point_count(&self) -> usize
Gets the total number of points of the shape.
source§fn local_bounds(&self) -> FloatRect
fn local_bounds(&self) -> FloatRect
Gets the local bounding rectangle of the entity. Read more
source§fn global_bounds(&self) -> FloatRect
fn global_bounds(&self) -> FloatRect
Gets the global (non-minimal) bounding rectangle of the entity. Read more
source§impl<'s> Transformable for CustomShape<'s>
impl<'s> Transformable for CustomShape<'s>
source§fn set_position<P: Into<Vector2f>>(&mut self, position: P)
fn set_position<P: Into<Vector2f>>(&mut self, position: P)
Sets the position of the object. Read more
source§fn set_rotation(&mut self, angle: f32)
fn set_rotation(&mut self, angle: f32)
Set the orientation of the object. Read more
source§fn set_scale<S: Into<Vector2f>>(&mut self, scale: S)
fn set_scale<S: Into<Vector2f>>(&mut self, scale: S)
Sets the scale factors of the object. Read more
source§fn set_origin<O: Into<Vector2f>>(&mut self, origin: O)
fn set_origin<O: Into<Vector2f>>(&mut self, origin: O)
Sets the local origin of the object. Read more
source§fn move_<O: Into<Vector2f>>(&mut self, offset: O)
fn move_<O: Into<Vector2f>>(&mut self, offset: O)
Moves the object by a given offset. Read more
source§fn inverse_transform(&self) -> &Transform
fn inverse_transform(&self) -> &Transform
Gets the inverse combined transform of the object.