use crate::ecs::world::{Entity, World};
use nalgebra_glm::Vec2;

pub fn spawn_sprite(world: &mut World, position: Vec2, size: Vec2) -> Entity {
    let entities = world.spawn_entities(crate::ecs::SPRITE | crate::ecs::VISIBILITY, 1);
    let entity = entities[0];

    if let Some(sprite) = world.get_sprite_mut(entity) {
        sprite.position = position;
        sprite.size = size;
    }

    if let Some(visibility) = world.get_visibility_mut(entity) {
        visibility.visible = true;
    }

    entity
}
