pub fn render_text(&mut self, c: &mut Canvas<Window>) -> (Texture, u32, u32) {
        let ttf_context = &self.ttf_context;
        let texture_creator = c.texture_creator();
        let font_name = "assets/OpenSans-Regular.ttf";
        let text_color = Color::BLACK;
        let font_size = 14;
        let font_style: FontStyle = FontStyle::NORMAL;
        let text_message = "Hello World";
        let mut font = ttf_context
            .load_font(Path::new(&font_name), font_size as u16)
            .unwrap();
        let surface = font
            .render(&text_message)
            .blended_wrapped(text_color, self.size.w)
            .map_err(|e| e.to_string())
            .unwrap();
        let font_texture = texture_creator
            .create_texture_from_surface(&surface)
            .map_err(|e| e.to_string())
            .unwrap();
        let TextureQuery { width, height, .. } = font_texture.query();

        font.set_style(font_style);

        (font_texture, width, height)
    }
/// Renders text, given the font name, size, style, color, string, and max width.  Transfers
/// ownership of the `Texture` to the calling function, returns the width and height of the
/// texture after rendering.  By using the identical font name, size, and style, if SDL2 caches
/// the font data, this will allow the font to be cached internally.
Renders text, given the font name, size, style, color, string, and max width.  Transfers
ownership of the `Texture` to the calling function, returns the width and height of the
texture after rendering.  By using the identical font name, size, and style, if SDL2 caches
the font data, this will allow the font to be cached internally.
Renders text given the font name size style color string and max width . Transfers ownership of the ` Texture ` to the calling function returns the width and height of the texture after rendering . By using the identical font name size and style if SDL2 caches the font data this will allow the font to be cached internally .
pub fn render_text(&mut self, c: &mut Canvas<Window>) -> (Texture, u32, u32) {
        let ttf_context = &self.ttf_context;
        let texture_creator = c.texture_creator();
        let font_name = "assets/OpenSans-Regular.ttf";
        let text_color = Color::BLACK;
        let font_size = 14;
        let font_style: FontStyle = FontStyle::NORMAL;
        let text_message = "Hello World";
        let mut font = ttf_context
            .load_font(Path::new(&font_name), font_size as u16)
            .unwrap();
        let surface = font
            .render(&text_message)
            .blended_wrapped(text_color, self.size.w)
            .map_err(|e| e.to_string())
            .unwrap();
        let font_texture = texture_creator
            .create_texture_from_surface(&surface)
            .map_err(|e| e.to_string())
            .unwrap();
        let TextureQuery { width, height, .. } = font_texture.query();
        font.set_style(font_style);
        (font_texture, width, height)
    }
pub fn render_text ( & mut self , c : & mut Canvas < Window > ) -> ( Texture , u32 , u32 ) { let ttf_context = & self . ttf_context ; let texture_creator = c . texture_creator ( ) ; let font_name = " " ; let text_color = Color :: BLACK ; let font_size = 14 ; let font_style : FontStyle = FontStyle :: NORMAL ; let text_message = " " ; let mut font = ttf_context . load_font ( Path :: new ( & font_name ) , font_size as u16 ) . unwrap ( ) ; let surface = font . render ( & text_message ) . blended_wrapped ( text_color , self . size . w ) . map_err ( | e | e . to_string ( ) ) . unwrap ( ) ; let font_texture = texture_creator . create_texture_from_surface ( & surface ) . map_err ( | e | e . to_string ( ) ) . unwrap ( ) ; let TextureQuery { width , height , .. } = font_texture . query ( ) ; font . set_style ( font_style ) ; ( font_texture , width , height ) }
Renders text, given the font name, size, style, color, string, and max width.
Renders text given the font name size style color string and max width .
&mut self
c
&mut Canvas<Window>
&mut self
c
&mut Canvas<Window>