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


Java ContactListener类代码示例

本文整理汇总了Java中com.badlogic.gdx.physics.box2d.ContactListener的典型用法代码示例。如果您正苦于以下问题:Java ContactListener类的具体用法?Java ContactListener怎么用?Java ContactListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ContactListener类属于com.badlogic.gdx.physics.box2d包,在下文中一共展示了ContactListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addSystem

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void addSystem(EntitySystem system) {
    super.addSystem(system);
    if (EntityListener.class.isInstance(system)) {
        this.addEntityListener((EntityListener) system);

    }
    if (InputProcessor.class.isInstance(system)) {
        inputs.addProcessor((InputProcessor) system);

    }
    if (ContactListener.class.isInstance(system)) {
        contactSystems.add((ContactListener) system);

    }

}
 
开发者ID:Rubentxu,项目名称:GDX-Logic-Bricks,代码行数:18,代码来源:LogicBricksEngine.java

示例2: inserted

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
protected void inserted(Entity e) {
	World b2World;
	
	// Adding to box2D world
	if( universe.containsKey(transformMapper.get(e).mapId) ) {
		b2World = universe.get(transformMapper.get(e).mapId);
	} else {
		b2World = newWorld(e);
		b2World.setContactListener(this);
		universe.put( transformMapper.get(e).mapId, b2World );
	}
	
	// Adding contact listeners
	if( !contactListeners.containsKey(transformMapper.get(e).mapId) ) {
		contactListeners.put( transformMapper.get(e).mapId, new ArrayList<ContactListener>() );
	}
	
	// Body initialization
	bodyMapper.get(e).physicsBody.initialize( b2World );
	bodyMapper.get(e).getBody().setUserData(e);
	previousMap.put(e, transformMapper.get(e).mapId);
	updateBody(e);
}
 
开发者ID:akohen,项目名称:Merkurius-LD27,代码行数:25,代码来源:ScaledBox2DSystem.java

示例3: remove

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
public void remove(ContactListener listener) {
	for (ObjectMap<Short, ContactListener> listenerMap : listeners.values()) {
		ObjectMap.Entries<Short, ContactListener> entries = listenerMap.entries();
		
		while (entries.hasNext()) {
			ObjectMap.Entry<Short, ContactListener> entry = entries.next();
			
			if (entry.value == listener) {
				entries.remove();
			}
		}
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:14,代码来源:CollisionHandler.java

示例4: beginContact

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void beginContact(Contact contact) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = get(
		fixtureA.getFilterData().categoryBits,
		fixtureB.getFilterData().categoryBits
	);
	
	if (listener != null) {
		listener.beginContact(contact);
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:15,代码来源:CollisionHandler.java

示例5: endContact

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void endContact(Contact contact) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = get(
		fixtureA.getFilterData().categoryBits,
		fixtureB.getFilterData().categoryBits
	);
	
	if (listener != null) {
		listener.endContact(contact);
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:15,代码来源:CollisionHandler.java

示例6: preSolve

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = get(
		fixtureA.getFilterData().categoryBits,
		fixtureB.getFilterData().categoryBits
	);
	
	if (listener != null) {
		listener.preSolve(contact, oldManifold);
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:15,代码来源:CollisionHandler.java

示例7: postSolve

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = get(
		fixtureA.getFilterData().categoryBits,
		fixtureB.getFilterData().categoryBits
	);
	
	if (listener != null) {
		listener.postSolve(contact, impulse);
	}
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:15,代码来源:CollisionHandler.java

示例8: addInternal

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
private void addInternal(short categoryA, short categoryB, ContactListener listener) {
	ObjectMap<Short, ContactListener> listenerMap = listeners.get(categoryA);
	
	if (listenerMap == null) {
		listenerMap = new ObjectMap<Short, ContactListener>();
		listeners.put(categoryA, listenerMap);
	}
	
	listenerMap.put(categoryB, listener);
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:11,代码来源:CollisionHandler.java

示例9: get

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
private ContactListener get(short categoryA, short categoryB) {
	ObjectMap<Short, ContactListener> listenersMap = listeners.get(categoryA);
	
	if (listenersMap == null) {
		return null;
	}
	
	return listenersMap.get(categoryB);
}
 
开发者ID:saltares,项目名称:libgdxjam,代码行数:10,代码来源:CollisionHandler.java

示例10: beginContact

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void beginContact(Contact contact) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = getListener(fixtureA.getFilterData().categoryBits,
										   fixtureB.getFilterData().categoryBits);
	
	if (listener != null) {
		listener.beginContact(contact);
	}
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:13,代码来源:CollisionHandler.java

示例11: endContact

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void endContact(Contact contact) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = getListener(fixtureA.getFilterData().categoryBits,
										   fixtureB.getFilterData().categoryBits);
	
	if (listener != null) {
		listener.endContact(contact);
	}
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:13,代码来源:CollisionHandler.java

示例12: preSolve

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void preSolve(Contact contact, Manifold oldManifold) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = getListener(fixtureA.getFilterData().categoryBits,
										   fixtureB.getFilterData().categoryBits);
	
	if (listener != null) {
		listener.preSolve(contact, oldManifold);
	}
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:13,代码来源:CollisionHandler.java

示例13: postSolve

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
@Override
public void postSolve(Contact contact, ContactImpulse impulse) {
	Fixture fixtureA = contact.getFixtureA();
	Fixture fixtureB = contact.getFixtureB();
	
	ContactListener listener = getListener(fixtureA.getFilterData().categoryBits,
										   fixtureB.getFilterData().categoryBits);
	
	if (listener != null) {
		listener.postSolve(contact, impulse);
	}
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:13,代码来源:CollisionHandler.java

示例14: addListenerInternal

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
private void addListenerInternal(short categoryA, short categoryB, ContactListener listener) {
	ObjectMap<Short, ContactListener> listenerCollection = listeners.get(categoryA);
	
	if (listenerCollection == null) {
		listenerCollection = new ObjectMap<Short, ContactListener>();
		listeners.put(categoryA, listenerCollection);
	}
	
	listenerCollection.put(categoryB, listener);
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:11,代码来源:CollisionHandler.java

示例15: getListener

import com.badlogic.gdx.physics.box2d.ContactListener; //导入依赖的package包/类
private ContactListener getListener(short categoryA, short categoryB) {
	ObjectMap<Short, ContactListener> listenerCollection = listeners.get(categoryA);
	
	if (listenerCollection == null) {
		return null;
	}
	
	return listenerCollection.get(categoryB);
}
 
开发者ID:saltares,项目名称:sioncore,代码行数:10,代码来源:CollisionHandler.java


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