I have a String that I want to convert to a QRCode and display in Bevy. I was previously making an SVG and using bevy_egui but I'm working off bevy main in anticipation for the big changes coming with v0.11.
bevy_egui doesn't support main branch of bevy, so I was wondering what is the best current way to do this.
What could I add to this to have an example like this work with bevy main?
pub fn spawn_qr_code(mut commands: Commands, invoice_data: Res<InvoiceDataFromServer>) {
info!("spawning QR code");
let invoice_str = &invoice_data.invoice;
let qr_code = QrCode::with_version(invoice_str, Version::Normal(9), EcLevel::L).unwrap();
let image = qr_code
.render::<svg::Color>()
.min_dimensions(200, 200)
.max_dimensions(300, 300)
.dark_color(svg::Color("#800000"))
.light_color(svg::Color("#ffff80"))
.build();
let a = egui_extras::RetainedImage::from_svg_bytes_with_size(
"invoicesvg",
image.as_bytes(),
egui_extras::image::FitTo::Original,
)
.unwrap();
// Cache QR code to be used later
commands.insert_resource(MyQr(a))
}
Or if not SVG, i guess loading a picture from bytes dynamically.. however.. im not necessarily tied to svg format if another method is easier