[−][src]Struct rustbatch::render::particle::shapes::SymmetricShape
SymmetricShape is used for drawing shapes like triangles rectangles all the way to circles, it depends on how many edges you specify. Note that this is not at all more effective then drawing sprite with that shape and also you have to use no_texture batch. It gives you option to draw with whatever color you want. You can even draw shape with lets say white edges and transparent center.
example
use rustbatch::{Mat, Vect, Batch, FPS, Window}; use rustbatch::math::rgba::BLACK; use rustbatch::render::particle::shapes::SymmetricShape; fn main() { use rustbatch::rgba::WHITE; let (mut window, mut event_pump, _gl, _s, _e) = Window::new(|sys| { sys.window("heureka", 1000, 600) .opengl() .resizable() .build() .unwrap() }); window.set_background_color(&[0.5f32, 0.5f32, 0.5f32, 1f32]); //creating shape with 10 edges let mut shape = SymmetricShape::new(10, 0f32); //this is important, you have to use no texture batch to use shapes in it let mut batch = Batch::no_texture(); let mut fps = FPS::new(1f32); 'main: loop { //polling events for event in event_pump.poll_iter() { match event { sdl2::event::Event::Quit { .. } => break 'main, _ => {} } } let delta = fps.increase(0f32); window.clear(); shape.draw(&mut batch, &Mat::IM.scaled(Vect::ZERO, 100f32), &WHITE, &BLACK); batch.draw(&mut window.canvas); batch.clear(); window.update(); } }
Implementations
impl SymmetricShape
[src]
pub fn new(edges: usize, rotation: f32) -> SymmetricShape
[src]
new is shape constructor
pub fn draw<T: Target>(
&mut self,
target: &mut T,
transform: &Mat,
inner_color: &RGBA,
outer_color: &RGBA
)
[src]
&mut self,
target: &mut T,
transform: &Mat,
inner_color: &RGBA,
outer_color: &RGBA
)
draw draws shape to batch, batch has to be no_texture
batch otherwise this triggers panic.
See batch functions to how to make no_texture batch.
Trait Implementations
impl Clone for SymmetricShape
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Particle for SymmetricShape
[src]
Auto Trait Implementations
impl RefUnwindSafe for SymmetricShape
impl Send for SymmetricShape
impl Sync for SymmetricShape
impl Unpin for SymmetricShape
impl UnwindSafe for SymmetricShape
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,