• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Transform类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addCameraActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public ActuatorEntity addCameraActuator(Camera camera, short height,
		float damping, float minDistanceX, float minDistanceY,
		String followTagEntity) {
	CameraActuator component = (CameraActuator) recoverComponent(ActuatorComponentsLookup.CameraActuator);
	if (component == null) {
		component = new CameraActuator(camera, height, damping,
				minDistanceX, minDistanceY, followTagEntity);
	} else {
		component.actuator = (indexOwner) -> {
			Set<GameEntity> followEntities = Indexed
					.getTagEntities(followTagEntity);
			for (GameEntity followEntity : followEntities) {
				RigidBody rc = followEntity.getRigidBody();
				Transform transform = rc.body.getTransform();
				Vector3 position = camera.position;
				position.x += (transform.getPosition().x + minDistanceX - position.x)
						* damping;
				position.y += (transform.getPosition().y + minDistanceY - position.y)
						* height;
			}
		};
	}
	addComponent(ActuatorComponentsLookup.CameraActuator, component);
	return this;
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:26,代码来源:ActuatorEntity.java


示例2: replaceCameraActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public ActuatorEntity replaceCameraActuator(Camera camera, short height,
		float damping, float minDistanceX, float minDistanceY,
		String followTagEntity) {
	CameraActuator component = (CameraActuator) recoverComponent(ActuatorComponentsLookup.CameraActuator);
	if (component == null) {
		component = new CameraActuator(camera, height, damping,
				minDistanceX, minDistanceY, followTagEntity);
	} else {
		component.actuator = (indexOwner) -> {
			Set<GameEntity> followEntities = Indexed
					.getTagEntities(followTagEntity);
			for (GameEntity followEntity : followEntities) {
				RigidBody rc = followEntity.getRigidBody();
				Transform transform = rc.body.getTransform();
				Vector3 position = camera.position;
				position.x += (transform.getPosition().x + minDistanceX - position.x)
						* damping;
				position.y += (transform.getPosition().y + minDistanceY - position.y)
						* height;
			}
		};
	}
	replaceComponent(ActuatorComponentsLookup.CameraActuator, component);
	return this;
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:26,代码来源:ActuatorEntity.java


示例3: addParticleEffectActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public ActuatorEntity addParticleEffectActuator(ParticleEffect effect,
		boolean autoStart, float locaPosX, float locaPosY) {
	ParticleEffectActuator component = (ParticleEffectActuator) recoverComponent(ActuatorComponentsLookup.ParticleEffectActuator);
	if (component == null) {
		component = new ParticleEffectActuator(effect, autoStart, locaPosX,
				locaPosY);
	} else {
		component.particleEffect = effect;
		component.actuator = (indexOwner) -> {
			GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
			RigidBody rc = owner.getRigidBody();
			Transform transform = rc.body.getTransform();
			effect.setPosition(transform.getPosition().x + locaPosX,
					transform.getPosition().y + locaPosY);
			effect.update(Gdx.graphics.getDeltaTime());
			if (autoStart && effect.isComplete())
				effect.start();
		};
	}
	addComponent(ActuatorComponentsLookup.ParticleEffectActuator, component);
	return this;
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:23,代码来源:ActuatorEntity.java


示例4: replaceParticleEffectActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public ActuatorEntity replaceParticleEffectActuator(ParticleEffect effect,
		boolean autoStart, float locaPosX, float locaPosY) {
	ParticleEffectActuator component = (ParticleEffectActuator) recoverComponent(ActuatorComponentsLookup.ParticleEffectActuator);
	if (component == null) {
		component = new ParticleEffectActuator(effect, autoStart, locaPosX,
				locaPosY);
	} else {
		component.particleEffect = effect;
		component.actuator = (indexOwner) -> {
			GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
			RigidBody rc = owner.getRigidBody();
			Transform transform = rc.body.getTransform();
			effect.setPosition(transform.getPosition().x + locaPosX,
					transform.getPosition().y + locaPosY);
			effect.update(Gdx.graphics.getDeltaTime());
			if (autoStart && effect.isComplete())
				effect.start();
		};
	}
	replaceComponent(ActuatorComponentsLookup.ParticleEffectActuator,
			component);
	return this;
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:24,代码来源:ActuatorEntity.java


示例5: processActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
@Override
public void processActuator(CameraActuator actuator, float deltaTime) {
    Entity target = null;
    if(actuator.followEntity != null)
        target = actuator.followEntity;
    else if(actuator.followTagEntity != null)
        actuator.followEntity = target = engine.getEntities(actuator.followTagEntity).first();

    if(target != null) {
        RigidBodiesComponents rc = target.getComponent(RigidBodiesComponents.class);
        Transform transform = rc.rigidBodies.first().getTransform();
        Vector3 position = actuator.camera.position;
        position.x += (transform.getPosition().x - position.x) * actuator.damping;
        position.y += (transform.getPosition().y - position.y) * actuator.damping;
    }

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


示例6: ComputeSubmergedArea

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public static float ComputeSubmergedArea(CircleShape shape, Vector2 normal, float offset, Transform xf, Vector2 c)
{
   Vector2 p = xf.mul(shape.getPosition());
   float l = -(normal.dot(p) - offset);
   float r = shape.getRadius();

   if (l < -r)
   { // Completely dry
      return 0;
   }

   if (l > r)
   { // Completely wet
      c.set(p);
      return MathUtils.PI * r * r;
   }

   float r2 = r * r;
   float l2 = l * l;
   float area = r2 * ((float) Math.asin(l / r) + MathUtils.PI / 2) + l * (float) Math.sqrt(r2 - l2);
   float com = -2.0f / 3.0f * (float) Math.pow(r2 - l2, 1.5f) / area;
   c.x = p.x + normal.x * com;
   c.y = p.y + normal.y * com;
   return area;
}
 
开发者ID:tescott,项目名称:box2dcontrollers,代码行数:26,代码来源:B2ShapeExtensions.java


示例7: ComputeSubmergedArea

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public static float ComputeSubmergedArea(CircleShape shape, Vector2 normal, float offset, Transform xf, Vector2 c)
{
    Vector2 p = xf.mul(shape.getPosition());
    float l = -(normal.dot(p) - offset);
    float r = shape.getRadius();

    if (l < -r)
    { // Completely dry
        return 0;
    }

    if (l > r)
    { // Completely wet
        c.set(p);
        return MathUtils.PI * r * r;
    }

    float r2 = r * r;
    float l2 = l * l;
    float area = r2 * ((float) Math.asin(l / r) + MathUtils.PI / 2) + l * (float) Math.sqrt(r2 - l2);
    float com = -2.0f / 3.0f * (float) Math.pow(r2 - l2, 1.5f) / area;
    c.x = p.x + normal.x * com;
    c.y = p.y + normal.y * com;
    return area;
}
 
开发者ID:Rubentxu,项目名称:DreamsLibGdx,代码行数:26,代码来源:BuoyancyUtils.java


示例8: CameraActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public CameraActuator(Camera camera, short height, float damping, float minDistanceX, float minDistanceY, String followTagEntity) {
    this.actuator = (indexOwner) -> {
        Set<GameEntity> followEntities = Indexed.getTagEntities(followTagEntity);
        for (GameEntity followEntity : followEntities) {
            RigidBody rc = followEntity.getRigidBody();
            Transform transform = rc.body.getTransform();
            Vector3 position = camera.position;
            position.x += (transform.getPosition().x + minDistanceX - position.x) * damping;
            position.y += (transform.getPosition().y + minDistanceY - position.y) * height;
        }
    };

}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:14,代码来源:CameraActuator.java


示例9: ParticleEffectActuator

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public ParticleEffectActuator(ParticleEffect effect, boolean autoStart, float locaPosX, float locaPosY) {
    this.particleEffect = effect;
    this.actuator = (indexOwner)-> {
        GameEntity owner = Indexed.getInteractiveEntity(indexOwner);
        RigidBody rc = owner.getRigidBody();
        Transform transform = rc.body.getTransform();
        effect.setPosition(transform.getPosition().x + locaPosX, transform.getPosition().y + locaPosY);
        effect.update(Gdx.graphics.getDeltaTime());
        if(autoStart && effect.isComplete()) effect.start();

    };
}
 
开发者ID:Rubentxu,项目名称:Entitas-Java,代码行数:13,代码来源:ParticleEffectActuator.java


示例10: createContext

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
@Override
    protected void createContext() {
        // Create Player Entity
        entityBuilder.initialize();
        IdentityComponent identityPlayer = entityBuilder.getComponent(IdentityComponent.class);
        identityPlayer.tag = "Player";
        transform = new Transform(new Vector2(), 0);
       /* TextureView view = new TextureView();
        view.attachedTransform = transform;
        view.width = 4;
        view.height = 3;
        entityBuilder.getComponent(ViewsComponent.class).views.add(view);
*/
        sensor =builders.getBrickBuilder(MouseSensorBuilder.class)
                .setMouseEvent(MouseSensor.MouseEvent.MOVEMENT)
                .setName("sensorPlayer")
                .getBrick();

        ConditionalController controllerGround =builders.getBrickBuilder(ConditionalControllerBuilder.class)
                .setOp(ConditionalController.Op.OP_AND)
                .getBrick();

        ActuatorTest actuatorTest = new ActuatorTest();

        player = entityBuilder
                .addController(controllerGround, "Default")
                .connectToSensor(sensor)
                .connectToActuator(actuatorTest)
                .getEntity();
        sensorSystem = engine.getSystem(MouseSensorSystem.class);

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


示例11: drawDebug

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
/**
 * Draws body lines and AABB.
 * @param camera	Specify which game camera you want.
 */
@Override
public void drawDebug(FlxCamera camera)
{				
	if(B2FlxDebug.drawBodies || B2FlxDebug.drawAABBs)
	{
		if (body.isActive() && B2FlxDebug.drawInactiveBodies)
			return;			
		Transform transform = body.getTransform();
		if(B2FlxDebug.drawBodies)
		{
			for(int i = 0; i < _fixtures.size; i++)
			{
				_fixtureDebug = _fixtures.get(i);
				if(body.isActive() == false)
					drawShape(_fixtureDebug, transform, B2FlxDebug.SHAPE_NOT_ACTIVE);
				else if(body.getType() == BodyType.StaticBody)
					drawShape(_fixtureDebug, transform, B2FlxDebug.SHAPE_STATIC);
				else if(body.getType() == BodyType.KinematicBody)
					drawShape(_fixtureDebug, transform, B2FlxDebug.SHAPE_KINEMATIC);
				else if(body.isAwake() == false)
					drawShape(_fixtureDebug, transform, B2FlxDebug.SHAPE_NOT_AWAKE);
				else
					drawShape(_fixtureDebug, transform, B2FlxDebug.SHAPE_AWAKE);
				if(B2FlxDebug.drawAABBs)
				{
					if(_fixtureDebug.getType() != Type.Edge && _fixtureDebug.getType() != Type.Chain)
						drawAABB(_fixtureDebug, transform);
				}
			}
		}
	}
}
 
开发者ID:flixel-gdx,项目名称:flixel-gdx-box2d,代码行数:37,代码来源:B2FlxShape.java


示例12: setAttachedTransform

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public View setAttachedTransform(Transform attachedTransform) {
    this.attachedTransform = attachedTransform;
    return this;

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


示例13: getBodyPixelCoord

import com.badlogic.gdx.physics.box2d.Transform; //导入依赖的package包/类
public Vector2 getBodyPixelCoord (Body b) {
	Transform xf = b.getTransform();
	return coordWorldToPixels(xf.getPosition());
}
 
开发者ID:ericrius1,项目名称:SuperSumo,代码行数:5,代码来源:ScreenTranslationUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java MultiScheme类代码示例发布时间:2022-05-22
下一篇:
Java ODataServiceFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap