use raylib::prelude::*;
pub trait TextAlignment {
#[allow(dead_code)] fn draw_centered_text(&mut self, text: &str, x: i32, y: i32, font_size: i32, color: impl Into<ffi::Color>) -> ();
#[allow(dead_code)] fn draw_right_aligned_text(&mut self, text: &str, x: i32, y: i32, font_size: i32, color: impl Into<ffi::Color>) -> ();
#[allow(dead_code)] fn measure_text_ext(&mut self, text: &str, font_size: i32) -> (i32, i32);
}
impl TextAlignment for RaylibDrawHandle<'_> {
#[allow(dead_code)]
fn draw_centered_text(&mut self, text: &str, x: i32, y: i32, font_size: i32, color: impl Into<ffi::Color>) -> () {
let text_width = self.measure_text(text, font_size);
let final_x = x - (text_width / 2); let final_y = y - (font_size / 2); self.draw_text(text, final_x, final_y, font_size, color);
}
#[allow(dead_code)]
fn draw_right_aligned_text(&mut self, text: &str, x: i32, y: i32, font_size: i32, color: impl Into<ffi::Color>) -> () {
let text_width = self.measure_text(text, font_size);
let final_x = x - text_width; self.draw_text(text, final_x, y, font_size, color);
}
fn measure_text_ext(&mut self, text: &str, font_size: i32) -> (i32, i32) {
(self.measure_text(text, font_size), font_size)
}
}