draw function parameter rename

type-render
korin 3 years ago
parent 1728e4e878
commit e9e6ba42ba
  1. 12
      src/main.rs

@ -40,8 +40,8 @@ struct ModifierKeys {
fn draw(canvas: &mut Canvas<Window>, fn draw(canvas: &mut Canvas<Window>,
window_size: (u32, u32), window_size: (u32, u32),
glyph_atlas: &GlyphAtlas, glyph_atlas: &GlyphAtlas,
text: &str, buffer: &str,
pos: usize) -> Result<(), String> { cursor_position: usize) -> Result<(), String> {
let text_offset = Point::new(10, 10); let text_offset = Point::new(10, 10);
// Draw background // Draw background
canvas.set_draw_color(Color::RGB(32, 32, 32)); canvas.set_draw_color(Color::RGB(32, 32, 32));
@ -52,13 +52,13 @@ fn draw(canvas: &mut Canvas<Window>,
let fb_text = editor_render::draw_text( let fb_text = editor_render::draw_text(
&glyph_atlas.glyphs, &glyph_atlas.glyphs,
&glyph_atlas.metrics, &glyph_atlas.metrics,
text, buffer,
text_offset text_offset
); );
canvas.draw_points(&fb_text[..])?; canvas.draw_points(&fb_text[..])?;
// Draw info // Draw info
let status = text.len().to_formatted_string(&Locale::en); let status = buffer.len().to_formatted_string(&Locale::en);
let status_position = Point::new( let status_position = Point::new(
text_offset.x, text_offset.x,
window_size.1 as i32 - glyph_atlas.metrics.height as i32 * 2 window_size.1 as i32 - glyph_atlas.metrics.height as i32 * 2
@ -84,8 +84,8 @@ fn draw(canvas: &mut Canvas<Window>,
canvas.set_draw_color(Color::RGB(64, 240, 240)); canvas.set_draw_color(Color::RGB(64, 240, 240));
let fb_cursor = editor_render::draw_cursor( let fb_cursor = editor_render::draw_cursor(
&glyph_atlas.metrics, &glyph_atlas.metrics,
pos, cursor_position,
text, buffer,
text_offset text_offset
); );
canvas.draw_line(fb_cursor.0, fb_cursor.1)?; canvas.draw_line(fb_cursor.0, fb_cursor.1)?;

Loading…
Cancel
Save