當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。