com.badlogic.gdx.physics.box2d.World Java Examples
The following examples show how to use
com.badlogic.gdx.physics.box2d.World.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Box2DFactory.java From homescreenarcade with GNU General Public License v3.0 | 6 votes |
/** Creates a circle object with the given position and radius. Resitution defaults to 0.6. */ public static Body createCircle(World world, float x, float y, float radius, boolean isStatic) { CircleShape sd = new CircleShape(); sd.setRadius(radius); FixtureDef fdef = new FixtureDef(); fdef.shape = sd; fdef.density = 1.0f; fdef.friction = 0.3f; fdef.restitution = 0.6f; BodyDef bd = new BodyDef(); bd.allowSleep = true; bd.position.set(x, y); Body body = world.createBody(bd); body.createFixture(fdef); if (isStatic) { body.setType(BodyDef.BodyType.StaticBody); } else { body.setType(BodyDef.BodyType.DynamicBody); } return body; }
Example #2
Source File: FixedStepPhysicsWorld.java From tilt-game-android with MIT License | 6 votes |
@Override public void onUpdate(final float pSecondsElapsed) { this.mRunnableHandler.onUpdate(pSecondsElapsed); this.mSecondsElapsedAccumulator += pSecondsElapsed; final int velocityIterations = this.mVelocityIterations; final int positionIterations = this.mPositionIterations; final World world = this.mWorld; final float stepLength = this.mTimeStep; int stepsAllowed = this.mMaximumStepsPerUpdate; while (this.mSecondsElapsedAccumulator >= stepLength && stepsAllowed > 0) { world.step(stepLength, velocityIterations, positionIterations); this.mSecondsElapsedAccumulator -= stepLength; stepsAllowed--; } this.mPhysicsConnectorManager.onUpdate(pSecondsElapsed); }
Example #3
Source File: FlipperElement.java From homescreenarcade with GNU General Public License v3.0 | 6 votes |
@Override public void createBodies(World world) { this.anchorBody = Box2DFactory.createCircle(world, this.cx, this.cy, 0.05f, true); // Joint angle is 0 when flipper is horizontal. // The flipper needs to be slightly extended past anchorBody to rotate correctly. float ext = (this.flipperLength > 0) ? -0.05f : +0.05f; // Width larger than 0.12 slows rotation? this.flipperBody = Box2DFactory.createWall(world, cx+ext, cy-0.12f, cx+flipperLength, cy+0.12f, 0f); flipperBody.setType(BodyDef.BodyType.DynamicBody); flipperBody.setBullet(true); flipperBody.getFixtureList().get(0).setDensity(5.0f); jointDef = new RevoluteJointDef(); jointDef.initialize(anchorBody, flipperBody, new Vector2(this.cx, this.cy)); jointDef.enableLimit = true; jointDef.enableMotor = true; // counterclockwise rotations are positive, so flip angles for flippers extending left jointDef.lowerAngle = (this.flipperLength>0) ? this.minangle : -this.maxangle; jointDef.upperAngle = (this.flipperLength>0) ? this.maxangle : -this.minangle; jointDef.maxMotorTorque = 1000f; this.joint = (RevoluteJoint)world.createJoint(jointDef); flipperBodySet = Collections.singletonList(flipperBody); this.setEffectiveMotorSpeed(-this.downspeed); // Force flipper to bottom when field is first created. }
Example #4
Source File: EntityFactory.java From ninja-rabbit with GNU General Public License v2.0 | 6 votes |
/** * Creates a new instance of {@link NinjaRabbit}, defining its graphical, audio and physical * properties. * * @param world * The Box2D {@link World} onto which to create the {@link Body} and {@link Fixture} * of the {@link Entity}. * @param loader * A {@link BodyEditorLoader} to handle creation of the Entity body and fixtures. * @param assets * The {@link AssetManager} from where to extract the graphical and audio resources. * Those resources should be loaded in the manager before calling this method and * won't be disposed. * @param status * A reference to the global status of the player to be updated from the changes in * the returned entity inner state. * @param observers * An array of event receivers. Events will fire when the active player status * changes (such as losing lives, collecting items, etc.). * @return A ready to use instance of a new {@link NinjaRabbit}. */ public static Entity createNinjaRabbit(final World world, final BodyEditorLoader loader, final AssetManager assets, final CurrentPlayerStatus status, final PlayerStatusObserver... observers) { PhysicsProcessor physics = new NinjaRabbitPhysicsProcessor(); CONTACT_LISTENER.add(physics); world.setContactListener(CONTACT_LISTENER); GraphicsProcessor graphics = new NinjaRabbitGraphicsProcessor(assets); BodyProcessor bodyProcessor = new NinjaRabbitBodyProcessor(world, loader); AudioProcessor audio = new NinjaRabbitAudioProcessor(assets); PlayerStatusProcessor player = new NinjaRabbitPlayerStatusProcessor(status); if (observers != null) { for (PlayerStatusObserver o : observers) { player.addObserver(o); } } NinjaRabbit ninjaRabbit = new NinjaRabbit(player, bodyProcessor, graphics, physics, audio); if (Ouya.isRunningOnOuya()) { Controllers.clearListeners(); Controllers.addListener(new NinjaRabbitControllerProcessor(ninjaRabbit)); } else { Gdx.input.setInputProcessor(new NinjaRabbitInputProcessor(ninjaRabbit)); } return ninjaRabbit; }
Example #5
Source File: Box2DFactory.java From Codelabs with MIT License | 6 votes |
public static Body createWalls(World world, float viewportWidth, float viewportHeight, float offset) { float halfWidth = viewportWidth / 2 - offset; float halfHeight = viewportHeight / 2 - offset; Vector2[] vertices = new Vector2[] { new Vector2(-halfWidth, -halfHeight), new Vector2(halfWidth, -halfHeight), new Vector2(halfWidth, halfHeight), new Vector2(-halfWidth, halfHeight), new Vector2(-halfWidth, -halfHeight) }; Shape shape = createChainShape(vertices); FixtureDef fixtureDef = createFixture(shape, 1, 0.5f, 0, false); return createBody(world, BodyType.StaticBody, fixtureDef, new Vector2( 0, 0)); }
Example #6
Source File: FieldLayout.java From homescreenarcade with GNU General Public License v3.0 | 6 votes |
void initFromLevel(Map<String, ?> layoutMap, World world) { this.width = asFloat(layoutMap.get(WIDTH_PROPERTY), 20.0f); this.height = asFloat(layoutMap.get(HEIGHT_PROPERTY), 30.0f); this.gravity = asFloat(layoutMap.get(GRAVITY_PROPERTY), 4.0f); this.targetTimeRatio = asFloat(layoutMap.get(TARGET_TIME_RATIO_PROPERTY)); this.numberOfBalls = asInt(layoutMap.get(NUM_BALLS_PROPERTY), 3); this.ballRadius = asFloat(layoutMap.get(BALL_RADIUS_PROPERTY), 0.5f); this.ballColor = colorFromMap(layoutMap, BALL_COLOR_PROPERTY, DEFAULT_BALL_COLOR); this.secondaryBallColor = colorFromMap( layoutMap, SECONDARY_BALL_COLOR_PROPERTY, DEFAULT_SECONDARY_BALL_COLOR); this.launchPosition = asFloatList(listForKey(layoutMap, LAUNCH_POSITION_PROPERTY)); this.launchVelocity = asFloatList(listForKey(layoutMap, LAUNCH_VELOCITY_PROPERTY)); this.launchVelocityRandomDelta = asFloatList( listForKey(layoutMap, LAUNCH_RANDOM_VELOCITY_PROPERTY)); this.launchDeadZoneRect = asFloatList(listForKey(layoutMap, LAUNCH_DEAD_ZONE_PROPERTY)); this.allParameters = layoutMap; this.fieldElements = createFieldElements(layoutMap, world); }
Example #7
Source File: WorldUtils.java From martianrun with Apache License 2.0 | 6 votes |
public static Body createEnemy(World world) { EnemyType enemyType = RandomUtils.getRandomEnemyType(); BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyDef.BodyType.KinematicBody; bodyDef.position.set(new Vector2(enemyType.getX(), enemyType.getY())); PolygonShape shape = new PolygonShape(); shape.setAsBox(enemyType.getWidth() / 2, enemyType.getHeight() / 2); Body body = world.createBody(bodyDef); body.createFixture(shape, enemyType.getDensity()); body.resetMassData(); EnemyUserData userData = new EnemyUserData(enemyType.getWidth(), enemyType.getHeight(), enemyType.getAnimationAssetId()); body.setUserData(userData); shape.dispose(); return body; }
Example #8
Source File: RendererSystem.java From Entitas-Java with MIT License | 6 votes |
public RendererSystem(Entitas entitas, Camera cam, Batch batch, World world) { this.physics = world; this.cam = cam; this.batch = batch; this.entitas = entitas; _groupTextureView = entitas.game.getGroup(GameMatcher.TextureView()); this.debugShapeRenderer = new ShapeRenderer(); this.debugRenderer = new Box2DDebugRenderer(DRAW_BOX2D_BODIES, DRAW_BOX2D_JOINTS, DRAW_BOX2D_ABBs, DRAW_BOX2D_INACTIVE_BODIES, DRAW_BOX2D_VELOCITIES, DRAW_BOX2D_CONTACTS); debugRenderer.setDrawAABBs(DRAW_BOX2D_ABBs); debugRenderer.setDrawBodies(DRAW_BOX2D_BODIES); debugRenderer.setDrawContacts(DRAW_BOX2D_CONTACTS); debugRenderer.setDrawInactiveBodies(DRAW_BOX2D_INACTIVE_BODIES); debugRenderer.setDrawJoints(DRAW_BOX2D_JOINTS); debugRenderer.setDrawVelocities(DRAW_BOX2D_VELOCITIES); this.inputs = entitas.input.getGroup(InputMatcher.Input()); }
Example #9
Source File: BombSystem.java From Bomberman_libGdx with MIT License | 6 votes |
private boolean checkMovable(Body body, Vector2 from, Vector2 to) { World b2dWorld = body.getWorld(); moveable = true; RayCastCallback rayCastCallback = new RayCastCallback() { @Override public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) { if (fixture.getFilterData().categoryBits == GameManager.INDESTRUCTIIBLE_BIT | fixture.getFilterData().categoryBits == GameManager.BREAKABLE_BIT | fixture.getFilterData().categoryBits == GameManager.BOMB_BIT | fixture.getFilterData().categoryBits == GameManager.ENEMY_BIT | fixture.getFilterData().categoryBits == GameManager.PLAYER_BIT) { moveable = false; return 0; } return 0; } }; b2dWorld.rayCast(rayCastCallback, from, to); return moveable; }
Example #10
Source File: Box2dLightTest.java From box2dlights with Apache License 2.0 | 6 votes |
private void createPhysicsWorld() { world = new World(new Vector2(0, 0), true); float halfWidth = viewportWidth / 2f; ChainShape chainShape = new ChainShape(); chainShape.createLoop(new Vector2[] { new Vector2(-halfWidth, 0f), new Vector2(halfWidth, 0f), new Vector2(halfWidth, viewportHeight), new Vector2(-halfWidth, viewportHeight) }); BodyDef chainBodyDef = new BodyDef(); chainBodyDef.type = BodyType.StaticBody; groundBody = world.createBody(chainBodyDef); groundBody.createFixture(chainShape, 0); chainShape.dispose(); createBoxes(); }
Example #11
Source File: MapLoader.java From Bomberman_libGdx with MIT License | 6 votes |
public MapLoader(World b2dWorld, com.artemis.World world, int level) { this.b2dWorld = b2dWorld; this.world = world; this.level = level; assetManager = GameManager.getInstance().getAssetManager(); pixmap = assetManager.get("maps/level_" + level + ".png", Pixmap.class); switch (level) { case 5: tileTextureAtlas = assetManager.get("maps/area_3_tiles.pack", TextureAtlas.class); break; case 4: case 3: tileTextureAtlas = assetManager.get("maps/area_2_tiles.pack", TextureAtlas.class); break; case 2: case 1: default: tileTextureAtlas = assetManager.get("maps/area_1_tiles.pack", TextureAtlas.class); break; } mapWidth = pixmap.getWidth(); mapHeight = pixmap.getHeight(); }
Example #12
Source File: EntityFactory.java From ninja-rabbit with GNU General Public License v2.0 | 6 votes |
/** * Creates and returns a new instance of {@link Environment}, settings its physical, graphical * and audio attributes. * * @param world * @param batch * @param renderer * @param assets * @param observers * @return A newly created {@link Environment}. */ public static Entity createEnvironment(final World world, final Batch batch, final LevelRenderer renderer, final AssetManager assets, final CurrentPlayerStatus status, final PlayerStatusObserver... observers) { PhysicsProcessor physics = new LevelPhysicsProcessor(world, renderer.getTiledMap(), renderer.getUnitScale()); CONTACT_LISTENER.add(physics); world.setContactListener(CONTACT_LISTENER); GraphicsProcessor graphics = new LevelGraphicsProcessor(assets, batch, renderer); AudioProcessor audio = new LevelAudioProcessor(assets, renderer.getTiledMap().getProperties()); PlayerStatusProcessor player = new LevelPlayerStatusProcessor(status); if (observers != null) { for (PlayerStatusObserver o : observers) { player.addObserver(o); } } return new Environment(graphics, physics, audio, player); }
Example #13
Source File: CarrotBodyFactory.java From ninja-rabbit with GNU General Public License v2.0 | 5 votes |
@Override public Body create(final World world, final BodyDef definition, final Direction direction) { Body rabbitBody = world.createBody(definition); loader.attachFixture(rabbitBody, CarrotPhysicsProcessor.CARROT_IDENTIFIER, fdef, CARROT_SCALE); rabbitBody.getFixtureList().first().setUserData(CarrotPhysicsProcessor.CARROT_IDENTIFIER); return rabbitBody; }
Example #14
Source File: RaySensorSystemTest.java From Entitas-Java with MIT License | 5 votes |
public RaySensorSystemTest() { collections = new EntitasCollections(new CollectionsFactories() {}); entitas = new Entitas(); world = new World(); Body body = Mockito.mock(Body.class); when(body.getPosition()).thenReturn(new Vector2()); this.raySensorSystem = new RaySensorSystem(entitas, world); Indexed.initialize(entitas); boss = entitas.game.createEntity() .addTags("Enemy", "Boss") .addRigidBody(body) .setInteractive(true); groundEntity = entitas.game.createEntity() .addTags("Ground", "Ground") .addRigidBody(body) .setInteractive(true); playerEntity = entitas.game.createEntity() .addTags("Player", "Player1") .addRigidBody(body) .setInteractive(true); sensorEntity = entitas.sensor.createEntity() .addRaySensor("Boss", Axis2D.Xnegative, 1, false) .addLink(playerEntity.getCreationIndex(),""); sensorEntity2 = entitas.sensor.createEntity() .addRaySensor("Ground", Axis2D.Xnegative, 1, false) .addLink(playerEntity.getCreationIndex(),""); sensorEntity4 = entitas.sensor.createEntity() .addRaySensor("Ground", Axis2D.Xnegative, 1, false) .addLink(boss.getCreationIndex(),""); }
Example #15
Source File: NinjaRabbitBodyProcessor.java From ninja-rabbit with GNU General Public License v2.0 | 5 votes |
public NinjaRabbitBodyProcessor(final World world, final BodyEditorLoader loader) { if (world == null) { throw new IllegalArgumentException("'world' cannot be null"); } this.bodyFactory = new NinjaRabbitBodyFactory(loader); this.world = world; }
Example #16
Source File: PlayerSystem.java From Pacman_libGdx with MIT License | 5 votes |
private boolean checkMovable(Body body, MoveDir dir) { canMove = true; World world = body.getWorld(); RayCastCallback rayCastCallback = new RayCastCallback() { @Override public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) { if (fixture.getFilterData().categoryBits == GameManager.WALL_BIT || fixture.getFilterData().categoryBits == GameManager.GATE_BIT) { canMove = false; return 0; } return 0; } }; for (int i = 0; i < 2; i++) { tmpV1.set(body.getPosition()); switch (dir) { case UP: tmpV2.set(body.getPosition().x - (i - 0.5f) * 0.2f, body.getPosition().y + 0.6f); break; case DOWN: tmpV2.set(body.getPosition().x - (i - 0.5f) * 0.2f, body.getPosition().y - 0.6f); break; case LEFT: tmpV2.set(body.getPosition().x - 0.6f, body.getPosition().y - (i - 0.5f) * 0.2f); break; case RIGHT: tmpV2.set(body.getPosition().x + 0.6f, body.getPosition().y - (i - 0.5f) * 0.2f); break; default: break; } world.rayCast(rayCastCallback, tmpV1, tmpV2); } return canMove; }
Example #17
Source File: WallPathElement.java From homescreenarcade with GNU General Public License v3.0 | 5 votes |
@Override public void createBodies(World world) { if (getBooleanParameterValueForKey(IGNORE_BALL_PROPERTY)) return; for (float[] segment : this.lineSegments) { Body wall = Box2DFactory.createThinWall(world, segment[0], segment[1], segment[2], segment[3], 0f); this.wallBodies.add(wall); } }
Example #18
Source File: FieldLayout.java From homescreenarcade with GNU General Public License v3.0 | 5 votes |
public static FieldLayout layoutForLevel(int level, World world) { Map<String, ?> levelLayout = _layoutMap.get(level); if (levelLayout==null) { levelLayout = readFieldLayout(level); _layoutMap.put(level, levelLayout); } FieldLayout layout = new FieldLayout(); layout.initFromLevel(levelLayout, world); return layout; }
Example #19
Source File: WallElement.java From homescreenarcade with GNU General Public License v3.0 | 5 votes |
@Override public void createBodies(World world) { if (ignoreBall) { bodySet = Collections.emptyList(); return; } wallBody = Box2DFactory.createThinWall(world, x1, y1, x2, y2, restitution); bodySet = Collections.singletonList(wallBody); if (disabled) { setRetracted(true); } }
Example #20
Source File: CollectibleRenderer.java From ninja-rabbit with GNU General Public License v2.0 | 5 votes |
public void load(final World world, final BodyEditorLoader loader, final AssetManager assets, final MapLayer layer, final Object userData) { if (layer == null) { return; } for (MapObject mo : layer.getObjects()) { BodyDef bodyDefinition = new BodyDef(); bodyDefinition.type = BodyType.KinematicBody; float x = ((Float) mo.getProperties().get("x")).floatValue() * unitScale; float y = ((Float) mo.getProperties().get("y")).floatValue() * unitScale; bodyDefinition.position.set(x, y); BodyFactory bodyFactory = null; Entity entity = null; if (CARROT_TYPE.equals(mo.getProperties().get(TYPE_PROPERTY, CARROT_TYPE, String.class))) { bodyFactory = new CarrotBodyFactory(loader); entity = EntityFactory.createCollectible(world, assets); } else { throw new IllegalArgumentException("Unknown collectible type {" + mo.getProperties().get(TYPE_PROPERTY, String.class) + "}"); } Body body = bodyFactory.create(world, bodyDefinition); entity.setBody(body); body.setUserData(entity); collectibles.add(entity); } }
Example #21
Source File: MatchOneState.java From Entitas-Java with MIT License | 5 votes |
@Override public void initialize() { entitas = new Entitas(); EntityIndexExtension.addEntityIndices(entitas); // Input World physics = engine.getManager(BasePhysicsManager.class).getPhysics(); BodyBuilder bodyBuilder = engine.getManager(BasePhysicsManager.class).getBodyBuilder(); Camera camera = engine.getManager(BaseSceneManager.class).getDefaultCamera(); Batch batch = engine.getManager(BaseSceneManager.class).getBatch(); EmitInputSystem emitInputSystem = new EmitInputSystem(entitas.input, physics, camera ); systems .add(new ProcessInputSystem(entitas)) // Update .add(new GameBoardSystem(entitas.game)) .add(new FallSystem(entitas.game)) .add(new FillSystem(entitas.game)) .add(new ScoreSystem(entitas)) // Render .add(new RemoveViewSystem(entitas.game, physics)) .add(new AddViewSystem(entitas.game, assetsManager, bodyBuilder )) .add(new AnimatePositionSystem(entitas.game)) // Destroy .add(new DestroySystem(entitas.game)) .add(new RendererSystem(entitas, camera, batch, physics)) ; }
Example #22
Source File: EnemySystem.java From Bomberman_libGdx with MIT License | 5 votes |
protected boolean hitSomethingVertical(final Body body, Vector2 fromV, Vector2 toV) { World b2dWorld = body.getWorld(); hit = false; RayCastCallback rayCastCallback = new RayCastCallback() { @Override public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) { // if hit the player, ignore it if (fixture.getFilterData().categoryBits == GameManager.PLAYER_BIT || fixture.getFilterData().categoryBits == GameManager.POWERUP_BIT) { return 0; } if (fraction < 1.0f) { hit = true; } return 0; } }; for (int i = 0; i < 3; i++) { Vector2 tmpV = new Vector2(toV); b2dWorld.rayCast(rayCastCallback, fromV, tmpV.add((1 - i) * 0.4f, 0)); } return hit; }
Example #23
Source File: EnemySystem.java From Bomberman_libGdx with MIT License | 5 votes |
protected boolean hitSomethingHorizontal(final Body body, Vector2 fromV, Vector2 toV) { World b2dWorld = body.getWorld(); hit = false; RayCastCallback rayCastCallback = new RayCastCallback() { @Override public float reportRayFixture(Fixture fixture, Vector2 point, Vector2 normal, float fraction) { // if hit the player or power-up item, ignore it if (fixture.getFilterData().categoryBits == GameManager.PLAYER_BIT || fixture.getFilterData().categoryBits == GameManager.POWERUP_BIT) { return 0; } if (fraction < 1.0f) { hit = true; } return 0; } }; for (int i = 0; i < 3; i++) { Vector2 tmpV = new Vector2(toV); b2dWorld.rayCast(rayCastCallback, fromV, tmpV.add(0, (1 - i) * 0.4f)); } return hit; }
Example #24
Source File: Box2dSquareAABBProximity.java From gdx-ai with Apache License 2.0 | 5 votes |
public Box2dSquareAABBProximity (Steerable<Vector2> owner, World world, float detectionRadius) { this.owner = owner; this.world = world; this.detectionRadius = detectionRadius; this.behaviorCallback = null; this.neighborCount = 0; }
Example #25
Source File: ActorBuilder.java From Bomberman_libGdx with MIT License | 5 votes |
public static ActorBuilder init(World b2dWorld, com.artemis.World world) { instance.b2dWorld = b2dWorld; instance.world = world; instance.assetManager = GameManager.getInstance().getAssetManager(); return instance; }
Example #26
Source File: WorldUtils.java From martianrun with Apache License 2.0 | 5 votes |
public static Body createRunner(World world) { BodyDef bodyDef = new BodyDef(); bodyDef.type = BodyDef.BodyType.DynamicBody; bodyDef.position.set(new Vector2(Constants.RUNNER_X, Constants.RUNNER_Y)); PolygonShape shape = new PolygonShape(); shape.setAsBox(Constants.RUNNER_WIDTH / 2, Constants.RUNNER_HEIGHT / 2); Body body = world.createBody(bodyDef); body.setGravityScale(Constants.RUNNER_GRAVITY_SCALE); body.createFixture(shape, Constants.RUNNER_DENSITY); body.resetMassData(); body.setUserData(new RunnerUserData(Constants.RUNNER_WIDTH, Constants.RUNNER_HEIGHT)); shape.dispose(); return body; }
Example #27
Source File: Box2DFactory.java From Codelabs with MIT License | 5 votes |
public static Body createBody(World world, BodyType bodyType, FixtureDef fixtureDef, Vector2 position) { BodyDef bodyDef = new BodyDef(); bodyDef.type = bodyType; bodyDef.position.set(position); Body body = world.createBody(bodyDef); body.createFixture(fixtureDef); fixtureDef.shape.dispose(); return body; }
Example #28
Source File: BuoyancyController.java From Codelabs with MIT License | 5 votes |
public BuoyancyController(World world, Fixture fluidSensor) { this.world = world; this.fluidSensor = fluidSensor; fluidVertices = getFixtureVertices(fluidSensor); fixtures = new HashSet<Fixture>(); }
Example #29
Source File: RayHandler.java From box2dlights with Apache License 2.0 | 5 votes |
/** * Class constructor specifying the physics world from where collision * geometry is taken, and size of FBO used for intermediate rendering. * * @see #RayHandler(World) */ public RayHandler(World world, int fboWidth, int fboHeight) { this.world = world; resizeFBO(fboWidth, fboHeight); lightShader = LightShader.createLightShader(); }
Example #30
Source File: SimpleTest.java From box2dlights with Apache License 2.0 | 5 votes |
@Override public void create() { camera = new OrthographicCamera(48, 32); camera.update(); world = new World(new Vector2(0, -10), true); rayHandler = new RayHandler(world); new PointLight(rayHandler, 32); }