Struct gfx_text::Renderer
[−]
[src]
pub struct Renderer<R: Resources, F: Factory<R>> { // some fields omitted }
Text renderer.
Methods
impl<R: Resources, F: Factory<R>> Renderer<R, F>
[src]
fn add(&mut self, text: &str, pos: [i32; 2], color: [f32; 4])
Add some text to the current draw scene relative to the top left corner of the screen using pixel coordinates.
fn add_anchored(&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.
fn add_at(&mut self, text: &str, pos: [f32; 3], color: [f32; 4])
Add some text to the draw scene using absolute world coordinates.
fn draw<S: Stream<R>>(&mut self, stream: &mut S) -> 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 stream);
fn draw_at<S: Stream<R>>(&mut self, stream: &mut S, 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 stream, camera_projection);
fn get_batch<O: Output<R>>(&mut self, output: &O) -> Result<FullBatch<ShaderParams<R>>, Error>
Former resulting batch.
Examples
let batch = text.get_batch(stream.get_output()); stream.draw(&batch);
fn get_batch_at<O: Output<R>>(&mut self, output: &O, proj: [[f32; 4]; 4]) -> Result<FullBatch<ShaderParams<R>>, Error>
Former batch for the given projection matrix.
Examples
let batch = text.get_batch_at(stream.get_output(), camera_projection); stream.draw(&batch);
fn measure(&self, text: &str) -> (i32, i32)
Get the bounding box size of a string as rendered by this font.