Trait ggez::graphics::Drawable
[−]
[src]
pub trait Drawable { fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>; fn set_blend_mode(&mut self, mode: Option<BlendMode>); fn get_blend_mode(&self) -> Option<BlendMode>; fn draw(
&self,
ctx: &mut Context,
dest: Point2,
rotation: f32
) -> GameResult<()> { ... } }
All types that can be drawn on the screen implement the Drawable
trait.
Required Methods
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()>
Actually draws the object to the screen.
This is the most general version of the operation, which is all that is required for implementing this trait.
fn set_blend_mode(&mut self, mode: Option<BlendMode>)
Sets the blend mode to be used when drawing this drawable.
This overrides the general graphics::set_blend_mode()
.
If None
is set, defers to the blend mode set by
graphics::set_blend_mode()
.
fn get_blend_mode(&self) -> Option<BlendMode>
Gets the blend mode to be used when drawing this drawable.
Provided Methods
fn draw(&self, ctx: &mut Context, dest: Point2, rotation: f32) -> GameResult<()>
Draws the drawable onto the rendering target.
It just is a shortcut that calls draw_ex()
with a default DrawParam
except for the destination and rotation.
ctx
- TheContext
this graphic will be rendered to.dest
- the position to draw the graphic expressed as aPoint2
.rotation
- orientation of the graphic in radians.
Implementors
impl Drawable for Canvas
impl Drawable for Image
impl Drawable for Mesh
impl Drawable for Text
impl<'a> Drawable for BoundSpriteBatch<'a>
impl Drawable for SpriteBatch