use yog_abi::YogStr;
use crate::GfxContext;
pub struct Draw2D<'ctx>(&'ctx GfxContext);
impl<'ctx> Draw2D<'ctx> {
pub(crate) fn new(ctx: &'ctx GfxContext) -> Self { Self(ctx) }
pub fn text(&self, text: &str, x: f32, y: f32, color: u32, shadow: bool) {
let a = self.0.api();
unsafe { (a.draw2d_text)(YogStr::from_str(text), x, y, color, shadow) }
}
pub fn rect(&self, x1: f32, y1: f32, x2: f32, y2: f32, color: u32) {
let a = self.0.api();
unsafe { (a.draw2d_rect)(x1, y1, x2, y2, color) }
}
pub fn gradient(&self, x1: f32, y1: f32, x2: f32, y2: f32, top: u32, bottom: u32) {
let a = self.0.api();
unsafe { (a.draw2d_gradient)(x1, y1, x2, y2, top, bottom) }
}
pub fn mc_texture(
&self, id: &str,
x: f32, y: f32,
u0: f32, v0: f32,
w: f32, h: f32,
tw: f32, th: f32,
) {
let a = self.0.api();
unsafe { (a.draw2d_mc_tex)(YogStr::from_str(id), x, y, u0, v0, w, h, tw, th) }
}
}