diff options
author | metamuffin <yvchraiqi@protonmail.com> | 2022-06-09 14:39:44 +0200 |
---|---|---|
committer | metamuffin <yvchraiqi@protonmail.com> | 2022-06-09 14:39:44 +0200 |
commit | 024a73e9575980b40c93d5f60c0e4e3f8e54187c (patch) | |
tree | b0a92107261df41c7d63260d6b660be704f090de /renderer/src/tee.rs | |
parent | f86dc6281977e11bdcdfa28557a90bacb9bb42aa (diff) | |
download | twclient-024a73e9575980b40c93d5f60c0e4e3f8e54187c.tar twclient-024a73e9575980b40c93d5f60c0e4e3f8e54187c.tar.bz2 twclient-024a73e9575980b40c93d5f60c0e4e3f8e54187c.tar.zst |
player names
Diffstat (limited to 'renderer/src/tee.rs')
-rw-r--r-- | renderer/src/tee.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/renderer/src/tee.rs b/renderer/src/tee.rs new file mode 100644 index 0000000..98ac218 --- /dev/null +++ b/renderer/src/tee.rs @@ -0,0 +1,46 @@ +use skia_safe::{Canvas, Color4f, ColorSpace, Font, Paint, Point}; +use twclient::world::World; + +const TEE_RADIUS: f32 = 16.0; + +pub struct TeeRenderer {} + +impl TeeRenderer { + pub fn new() -> Self { + Self {} + } + + pub fn draw(&mut self, world: &World, canvas: &mut Canvas) { + let tee_paint = Paint::new( + Color4f { + a: 1.0, + r: 0.2, + g: 0.0, + b: 0.2, + }, + &ColorSpace::new_srgb(), + ); + let name_paint = Paint::new( + Color4f { + a: 1.0, + r: 1.0, + g: 1.0, + b: 0.0, + }, + &ColorSpace::new_srgb(), + ); + for t in world.tees.values() { + let origin = Point { + x: t.x as f32, + y: t.y as f32, + }; + canvas.draw_circle(origin, TEE_RADIUS, &tee_paint); + canvas.draw_str( + t.name.as_str(), + (origin.x, origin.y - 20.0), + &Font::default(), + &name_paint, + ); + } + } +} |