mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 08:41:34 +11:00
copy the sprite and palette data
This commit is contained in:
parent
d764ff9900
commit
836143e1f4
|
@ -193,6 +193,11 @@ impl SpriteController {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
dest.as_ptr()
|
||||||
|
.copy_from(sprite.data.as_ptr(), sprite.data.len())
|
||||||
|
}
|
||||||
|
|
||||||
let storage = Storage::from_sprite_ptr(dest);
|
let storage = Storage::from_sprite_ptr(dest);
|
||||||
inner.sprite.insert(id, storage);
|
inner.sprite.insert(id, storage);
|
||||||
|
|
||||||
|
@ -214,6 +219,13 @@ impl SpriteControllerInner {
|
||||||
Some(storage.location)
|
Some(storage.location)
|
||||||
} else {
|
} else {
|
||||||
let dest = unsafe { PALETTE_ALLOCATOR.alloc(Palette16::layout())? };
|
let dest = unsafe { PALETTE_ALLOCATOR.alloc(Palette16::layout())? };
|
||||||
|
|
||||||
|
unsafe {
|
||||||
|
dest.as_ptr()
|
||||||
|
.cast::<u16>()
|
||||||
|
.copy_from(palette.colours.as_ptr(), palette.colours.len())
|
||||||
|
}
|
||||||
|
|
||||||
let storage = Storage::from_palette_ptr(dest);
|
let storage = Storage::from_palette_ptr(dest);
|
||||||
self.palette.insert(id, storage);
|
self.palette.insert(id, storage);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue