align tiles to a 2 byte boundary

This commit is contained in:
Corwin 2022-10-22 12:41:58 +01:00
parent 78f9fd2026
commit d5a7954637

View file

@ -79,7 +79,19 @@ pub(crate) fn generate_code(
pub const #output_variable_name: #crate_prefix::display::tile_data::TileData = {
const _: &[u8] = include_bytes!(#image_filename);
const TILE_DATA: &[u8] = #data;
const TILE_DATA: &[u8] = {
pub struct AlignedAs<Align, Bytes: ?Sized> {
pub _align: [Align; 0],
pub bytes: Bytes,
}
const ALIGNED: &AlignedAs<u16, [u8]> = &AlignedAs {
_align: [],
bytes: *#data,
};
&ALIGNED.bytes
};
const PALETTE_ASSIGNMENT: &[u8] = &[
#(#assignments),*