本文整理汇总了Java中com.badlogic.gdx.utils.Bits.or方法的典型用法代码示例。如果您正苦于以下问题:Java Bits.or方法的具体用法?Java Bits.or怎么用?Java Bits.or使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.badlogic.gdx.utils.Bits
的用法示例。
在下文中一共展示了Bits.or方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateFamilyMembership
import com.badlogic.gdx.utils.Bits; //导入方法依赖的package包/类
public void updateFamilyMembership (Entity entity) {
// Find families that the entity was added to/removed from, and fill
// the bitmasks with corresponding listener bits.
Bits addListenerBits = bitsPool.obtain();
Bits removeListenerBits = bitsPool.obtain();
for (Family family : entityListenerMasks.keys()) {
final int familyIndex = family.getIndex();
final Bits entityFamilyBits = entity.getFamilyBits();
boolean belongsToFamily = entityFamilyBits.get(familyIndex);
boolean matches = family.matches(entity) && !entity.removing;
if (belongsToFamily != matches) {
final Bits listenersMask = entityListenerMasks.get(family);
final Array<Entity> familyEntities = families.get(family);
if (matches) {
addListenerBits.or(listenersMask);
familyEntities.add(entity);
entityFamilyBits.set(familyIndex);
} else {
removeListenerBits.or(listenersMask);
familyEntities.removeValue(entity, true);
entityFamilyBits.clear(familyIndex);
}
}
}
// Notify listeners; set bits match indices of listeners
notifying = true;
Object[] items = entityListeners.begin();
for (int i = removeListenerBits.nextSetBit(0); i >= 0; i = removeListenerBits.nextSetBit(i + 1)) {
((EntityListenerData)items[i]).listener.entityRemoved(entity);
}
for (int i = addListenerBits.nextSetBit(0); i >= 0; i = addListenerBits.nextSetBit(i + 1)) {
((EntityListenerData)items[i]).listener.entityAdded(entity);
}
addListenerBits.clear();
removeListenerBits.clear();
bitsPool.free(addListenerBits);
bitsPool.free(removeListenerBits);
entityListeners.end();
notifying = false;
}
示例2: getVisibleLayers
import com.badlogic.gdx.utils.Bits; //导入方法依赖的package包/类
public Bits getVisibleLayers(Bits out) {
out.clear();
out.or(visibleLayers);
return out;
}
示例3: updateFamilyMembership
import com.badlogic.gdx.utils.Bits; //导入方法依赖的package包/类
public void updateFamilyMembership (Entity entity) {
// Find families that the entity was added to/removed from, and fill
// the bitmasks with corresponding listener bits.
Bits addListenerBits = bitsPool.obtain();
Bits removeListenerBits = bitsPool.obtain();
for (Family family : entityListenerMasks.keys()) {
final int familyIndex = family.getIndex();
final Bits entityFamilyBits = entity.getFamilyBits();
boolean belongsToFamily = entityFamilyBits.get(familyIndex);
boolean matches = family.matches(entity) && !entity.removing;
if (belongsToFamily != matches) {
final Bits listenersMask = entityListenerMasks.get(family);
final Array<Entity> familyEntities = families.get(family);
if (matches) {
addListenerBits.or(listenersMask);
familyEntities.add(entity);
entityFamilyBits.set(familyIndex);
} else {
removeListenerBits.or(listenersMask);
familyEntities.removeValue(entity, true);
entityFamilyBits.clear(familyIndex);
}
}
}
// Notify listeners; set bits match indices of listeners
notifying = true;
Object[] items = entityListeners.begin();
try {
for (int i = removeListenerBits.nextSetBit(0); i >= 0; i = removeListenerBits.nextSetBit(i + 1)) {
((EntityListenerData)items[i]).listener.entityRemoved(entity);
}
for (int i = addListenerBits.nextSetBit(0); i >= 0; i = addListenerBits.nextSetBit(i + 1)) {
((EntityListenerData)items[i]).listener.entityAdded(entity);
}
}
finally {
addListenerBits.clear();
removeListenerBits.clear();
bitsPool.free(addListenerBits);
bitsPool.free(removeListenerBits);
entityListeners.end();
notifying = false;
}
}