Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add the Text wasm drawcall
  • Loading branch information
tomassedovic committed Dec 20, 2017
1 parent 7623299 commit 8d0e939
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/main.rs
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 8d0e939

Please sign in to comment.