Permalink
Browse files

Add the Text wasm drawcall

  • Loading branch information...
tomassedovic committed Dec 20, 2017
1 parent 7623299 commit 8d0e939dbdc70334c5e72cf5b753ae5d51dc51ca
Showing with 16 additions and 0 deletions.
  1. +16 −0 src/main.rs
@@ -420,6 +420,22 @@ pub fn update(state_ptr: *mut State) {
js_drawcalls.push(color.g);
js_drawcalls.push(color.b);
}

&engine::Draw::Text(start_pos, ref text, color) => {
for (i, glyph) in text.char_indices() {
let pos = start_pos + (i as i32, 0);
assert!(pos.x >= 0 && pos.x < 255);
assert!(pos.y >= 0 && pos.y < 255);
assert!(glyph.is_ascii());
js_drawcalls.push(pos.x as u8);
js_drawcalls.push(pos.y as u8);
js_drawcalls.push(glyph as u8);
js_drawcalls.push(color.r);
js_drawcalls.push(color.g);
js_drawcalls.push(color.b);
}
}

_ => {} // TODO
}
}

0 comments on commit 8d0e939

Please sign in to comment.