本文整理汇总了Java中processing.core.PShape.removeChild方法的典型用法代码示例。如果您正苦于以下问题:Java PShape.removeChild方法的具体用法?Java PShape.removeChild怎么用?Java PShape.removeChild使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.core.PShape
的用法示例。
在下文中一共展示了PShape.removeChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateParticleShapeBuffer
import processing.core.PShape; //导入方法依赖的package包/类
@Deprecated
static final public int updateParticleShapeBuffer(World world, PShape group_particles){
int particle_num_old = world.getParticleCount();
int particle_num_new = 0;
if(particle_num_old == 0){
return 0;
}
if(group_particles.getChildCount() == 0){
return 0;
}
// The following is way faster, then removing shapes in place.
// ... even when iterating backwards, a lot of repeated/unnecessary copying
// will be needed.
PShape group = group_particles;
PShape[] shapes = group.getChildren();
int[] particle_flag = world.getParticleFlagsBuffer();
// re-map particles, so that zombies are left out
for(int i = 0; i < particle_num_old; i++){
if((particle_flag[i] & ParticleType.b2_zombieParticle) == 0){
shapes[particle_num_new++] = shapes[i];
}
}
// remove number of zombies by triming the buffer to the new size
// unfortunately PShape offers no better way to do this
for(int i = particle_num_old - 1; i >= particle_num_new; i--){
group.removeChild(i);
}
int removed = particle_num_old - particle_num_new;
return removed;
}
示例2: removeChilds
import processing.core.PShape; //导入方法依赖的package包/类
private void removeChilds(PShape shp){
if(shp == null){
return;
}
int num_childs = shp.getChildCount();
for(int i = num_childs-1; i >= 0; i--){
removeChilds(shp.getChild(i));
shp.removeChild(i);
}
}