当前位置: 首页>>代码示例>>Java>>正文


Java Bits.clear方法代码示例

本文整理汇总了Java中com.badlogic.gdx.utils.Bits.clear方法的典型用法代码示例。如果您正苦于以下问题:Java Bits.clear方法的具体用法?Java Bits.clear怎么用?Java Bits.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.badlogic.gdx.utils.Bits的用法示例。


在下文中一共展示了Bits.clear方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeEntityListener

import com.badlogic.gdx.utils.Bits; //导入方法依赖的package包/类
public void removeEntityListener (EntityListener listener) {
	for (int i = 0; i < entityListeners.size; i++) {
		EntityListenerData entityListenerData = entityListeners.get(i);
		if (entityListenerData.listener == listener) {
			// Shift down bitmasks by one step
			for (Bits mask : entityListenerMasks.values()) {
				for (int k = i, n = mask.length(); k < n; k++) {
					if (mask.get(k + 1)) {
						mask.set(k);
					} else {
						mask.clear(k);
					}
				}
			}

			entityListeners.removeIndex(i--);
		}
	}
}
 
开发者ID:DevelopersGuild,项目名称:Planetbase,代码行数:20,代码来源:FamilyManager.java

示例2: addEntityListener

import com.badlogic.gdx.utils.Bits; //导入方法依赖的package包/类
public void addEntityListener (Family family, int priority, EntityListener listener) {
	registerFamily(family);

	int insertionIndex = 0;
	while (insertionIndex < entityListeners.size) {
		if (entityListeners.get(insertionIndex).priority <= priority) {
			insertionIndex++;
		} else {
			break;
		}
	}

	// Shift up bitmasks by one step
	for (Bits mask : entityListenerMasks.values()) {
		for (int k = mask.length(); k > insertionIndex; k--) {
			if (mask.get(k - 1)) {
				mask.set(k);
			} else {
				mask.clear(k);
			}
		}
		mask.clear(insertionIndex);
	}

	entityListenerMasks.get(family).set(insertionIndex);

	EntityListenerData entityListenerData = new EntityListenerData();
	entityListenerData.listener = listener;
	entityListenerData.priority = priority;
	entityListeners.insert(insertionIndex, entityListenerData);
}
 
开发者ID:DevelopersGuild,项目名称:Planetbase,代码行数:32,代码来源:FamilyManager.java

示例3: removeComponentsOfEntity

import com.badlogic.gdx.utils.Bits; //导入方法依赖的package包/类
private void removeComponentsOfEntity(Entity e) {
	Bits componentBits = e.getComponentBits();
	for (int i = componentBits.nextSetBit(0); i >= 0; i = componentBits.nextSetBit(i+1)) {
		componentsByType.get(i).set(e.getId(), null);
	}
	componentBits.clear();
}
 
开发者ID:nhydock,项目名称:gdx-artemis,代码行数:8,代码来源:ComponentManager.java

示例4: 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;
}
 
开发者ID:DevelopersGuild,项目名称:Planetbase,代码行数:48,代码来源:FamilyManager.java

示例5: getVisibleLayers

import com.badlogic.gdx.utils.Bits; //导入方法依赖的package包/类
public Bits getVisibleLayers(Bits out) {
	out.clear();
	out.or(visibleLayers);
	return out;
}
 
开发者ID:jsjolund,项目名称:GdxDemo3D,代码行数:6,代码来源:GameStage.java

示例6: 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;	
	}
}
 
开发者ID:libgdx,项目名称:ashley,代码行数:51,代码来源:FamilyManager.java

示例7: set

import com.badlogic.gdx.utils.Bits; //导入方法依赖的package包/类
/**
 * Sets the given Bits mask to the given render groups
 * 
 * @param rgmask
 *            The bit mask
 * @param rgs
 *            The render groups
 * @return The bits instance
 */
public static Bits set(Bits rgmask, RenderGroup... rgs) {
    rgmask.clear();
    return add(rgmask, rgs);
}
 
开发者ID:langurmonkey,项目名称:gaiasky,代码行数:14,代码来源:SceneGraphNode.java


注:本文中的com.badlogic.gdx.utils.Bits.clear方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。