Struct gfx_text::Renderer [−][src]
Text renderer.
Implementations
impl<R: Resources, F: Factory<R>> Renderer<R, F>
[src]
pub fn add(&mut self, text: &str, pos: [i32; 2], color: [f32; 4])
[src]
Add some text to the current draw scene relative to the top left corner of the screen using pixel coordinates.
pub fn add_anchored(
&mut self,
text: &str,
pos: [i32; 2],
horizontal: HorizontalAnchor,
vertical: VerticalAnchor,
color: [f32; 4]
)
[src]
&mut self,
text: &str,
pos: [i32; 2],
horizontal: HorizontalAnchor,
vertical: VerticalAnchor,
color: [f32; 4]
)
Add text to the draw scene by anchoring an edge or mid-point to a position defined in screen pixel coordinates.
pub fn add_at(&mut self, text: &str, pos: [f32; 3], color: [f32; 4])
[src]
Add some text to the draw scene using absolute world coordinates.
pub fn draw<C: CommandBuffer<R>, T: RenderFormat>(
&mut self,
encoder: &mut Encoder<R, C>,
target: &RenderTargetView<R, T>
) -> Result<(), Error>
[src]
&mut self,
encoder: &mut Encoder<R, C>,
target: &RenderTargetView<R, T>
) -> Result<(), Error>
Draw the current scene and clear state.
Examples
ⓘ
text.add("Test1", [10, 10], [1.0, 0.0, 0.0, 1.0]); text.add("Test2", [20, 20], [0.0, 1.0, 0.0, 1.0]); text.draw(&mut encoder, &color_output).unwrap();
pub fn draw_at<C: CommandBuffer<R>, T: RenderFormat>(
&mut self,
encoder: &mut Encoder<R, C>,
target: &RenderTargetView<R, T>,
proj: [[f32; 4]; 4]
) -> Result<(), Error>
[src]
&mut self,
encoder: &mut Encoder<R, C>,
target: &RenderTargetView<R, T>,
proj: [[f32; 4]; 4]
) -> Result<(), Error>
Draw using provided projection matrix.
Examples
ⓘ
text.add_at("Test1", [6.0, 0.0, 0.0], [1.0, 0.0, 0.0, 1.0]); text.add_at("Test2", [0.0, 5.0, 0.0], [0.0, 1.0, 0.0, 1.0]); text.draw_at(&mut encoder, &color_output, camera_projection).unwrap();
pub fn measure(&self, text: &str) -> (i32, i32)
[src]
Get the bounding box size of a string as rendered by this font.
Auto Trait Implementations
impl<R, F> !RefUnwindSafe for Renderer<R, F>
impl<R, F> Send for Renderer<R, F> where
F: Send,
F: Send,
impl<R, F> Sync for Renderer<R, F> where
F: Sync,
F: Sync,
impl<R, F> Unpin for Renderer<R, F> where
F: Unpin,
F: Unpin,
impl<R, F> !UnwindSafe for Renderer<R, F>
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,
pub 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, 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.
pub 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>,