There's probably a totally reasonable explanation for this, but I'm unclear as to why draw_text_ex needs to consume the params argument instead of referencing it. Not a huge cost to pay to keep building TextParams every draw, all things considered, but I thought it was odd and wasn't sure how intentional this was.
Some example code from trying to generalize some text rendering:
impl Displayable for Header {
fn draw(&self, context: &MenuContext) {
let measure = measure_text(
&self.text,
context.text_params.font,
context.text_params.font_size,
context.text_params.font_scale,
);
draw_text_ex(&self.text, self.xpos, self.ypos, &context.text_params); // <-- i have to clone() text_params instead of referencing it here
}
}
There's probably a totally reasonable explanation for this, but I'm unclear as to why draw_text_ex needs to consume the params argument instead of referencing it. Not a huge cost to pay to keep building
TextParams
every draw, all things considered, but I thought it was odd and wasn't sure how intentional this was.Some example code from trying to generalize some text rendering: