[][src]Function specs_blit::load

pub fn load(sprite: BlitBuffer) -> Result<SpriteRef>

Load a sprite buffer and place it onto the heap.

Returns an index that can be used in sprite components.

use blit::{BlitBuffer, Color};
use specs_blit::load;

const MASK_COLOR: u32 = 0xFF00FF;

// Create a sprite of 2 pixels
let sprite = BlitBuffer::from_buffer(&[0, MASK_COLOR], 1, Color::from_u32(MASK_COLOR));

// Load the sprite and get a reference
let sprite_ref = load(sprite)?;