本文整理汇总了Java中com.artemis.utils.IntBag.add方法的典型用法代码示例。如果您正苦于以下问题:Java IntBag.add方法的具体用法?Java IntBag.add怎么用?Java IntBag.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.artemis.utils.IntBag
的用法示例。
在下文中一共展示了IntBag.add方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getEntities
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
/**
* Returns all entities in the specified cells.
*
* @param cells set of packed coordinates of entities
* @return
*/
public IntBag getEntities(final LongBag cells)
{
final IntBag entities = new IntBag(8);
final int[] coords = new int[2];
for (int i = 0, size = cells.size(); i < size; i++)
{
final long pos = cells.get(i);
Coords.unpackCoords(pos, coords);
final int id = grid[coords[0]][coords[1]];
if (id >= 0)
entities.add(id);
}
return entities;
}
示例2: getExact
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
/**
* Returns entity ids of entities that bounds contain given point
*/
public IntBag getExact (IntBag fill, float x, float y) {
if (bounds.contains(x, y)) {
if (nodes[0] != null) {
int index = indexOf(x, y, 0, 0);
if (index != OUTSIDE) {
nodes[index].getExact(fill, x, y, 0, 0);
}
}
for (int i = 0; i < containers.size(); i++) {
Container c = containers.get(i);
if (c.contains(x, y)) {
fill.add(c.eid);
}
}
}
return fill;
}
示例3: get
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
/**
* Returns entity ids of entities that are inside {@link QuadTree}s that overlap given bounds
*
* Returned entities must be filtered further as these results are not exact
*/
public IntBag get (IntBag fill, float x, float y, float width, float height) {
if (bounds.overlaps(x, y, width, height)) {
if (nodes[0] != null) {
int index = indexOf(x, y, width, height);
if (index != OUTSIDE) {
nodes[index].get(fill, x, y, width, height);
} else {
// if test bounds don't fully fit inside a node, we need to check them all
for (int i = 0; i < nodes.length; i++) {
nodes[i].get(fill, x, y, width, height);
}
}
}
for (int i = 0; i < containers.size(); i++) {
Container c = containers.get(i);
fill.add(c.eid);
}
}
return fill;
}
示例4: addToGroup
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
/**
* Adds the entity to the specified group. Also takes care of adding the
* Group component.
*
* @param entityId
* @param groupId
* @return same as groupId
*/
public int addToGroup(final int entityId, final int groupId)
{
final IntBag group = groups.get(groupId);
group.add(entityId);
mGroup.create(entityId).groupId = groupId;
return groupId;
}
示例5: findPoint
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
static IntBag findPoint (TestData data, IntBag fill, Bag<TestData> testData) {
for (int i = 0; i < testData.size(); i++) {
TestData test = testData.get(i);
if (test.contains(data.x, data.y)) {
fill.add(test.id);
}
}
fill.clear();
return fill;
}
示例6: find
import com.artemis.utils.IntBag; //导入方法依赖的package包/类
static IntBag find (TestData data, IntBag fill, Bag<TestData> testData) {
for (int i = 0; i < testData.size(); i++) {
TestData test = testData.get(i);
if (test.overlaps(data.x, data.y, data.width, data.height)) {
fill.add(test.id);
}
}
fill.clear();
return fill;
}