void registerComponentType(ComponentType ct, int capacity) { int index = ct.getIndex(); ComponentMapper mapper = new ComponentMapper(ct.getType(), world); mapper.components.ensureCapacity(capacity); mappers.set(index, mapper); }
void registerComponentType(ComponentType ct, int capacity) { int index = ct.getIndex(); ComponentMapper mapper = new ComponentMapper(ct.getType(), world); mapper.components.ensureCapacity(capacity); mappers.set(index, mapper); }
void registerComponentType(ComponentType ct, int capacity) { int index = ct.getIndex(); ComponentMapper mapper = new ComponentMapper(ct.getType(), world); mapper.components.ensureCapacity(capacity); mappers.set(index, mapper); }
/** * Retrieves a ComponentMapper instance for fast retrieval of * components from entities. * * @param <T> Type of component * @param type of component to get mapper for. * @return mapper for specified component type. */ @SuppressWarnings("unchecked") public <T extends Component> ComponentMapper<T> getMapper(Class<T> type) { ComponentMapper<T> mapper; if (mappers.containsKey(type)) { mapper = (ComponentMapper<T>) mappers.get(type); } else { mapper = new ComponentMapper<T>(type, world); mappers.put(type, mapper); } return mapper; }