Skip to content

Commit

Permalink
Added Text::draw_pos
Browse files Browse the repository at this point in the history
  • Loading branch information
bvssvni committed Nov 17, 2022
1 parent 3503691 commit 7134324
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/text.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ use crate::{
character::CharacterCache,
color,
math::Matrix2d,
math::Vec2d,
types::{Color, FontSize},
DrawState, Graphics, Image, Transformed,
};
Expand Down Expand Up @@ -44,6 +45,23 @@ impl Text {
self
}

/// Draws text at position with a character cache
pub fn draw_pos<C, G>(
&self,
text: &str,
pos: Vec2d,
cache: &mut C,
draw_state: &DrawState,
transform: Matrix2d,
g: &mut G,
) -> Result<(), C::Error>
where
C: CharacterCache,
G: Graphics<Texture = <C as CharacterCache>::Texture>,
{
self.draw(text, cache, draw_state, transform.trans_pos(pos), g)
}

/// Draws text with a character cache
pub fn draw<C, G>(
&self,
Expand Down

0 comments on commit 7134324

Please sign in to comment.