gridWidth = boundRect.getWidth() / density; gridHeight = regionAspectRatio * gridWidth; rows = (int) Math.ceil(boundRect.getHeight() / gridHeight);
gridWidth = boundRect.getWidth() / density; gridHeight = regionAspectRatio * gridWidth; rows = (int) Math.ceil(boundRect.getHeight() / gridHeight);
@Override public void draw(Batch batch, float parentAlpha) { super.draw(batch, parentAlpha); batch.draw(textureRegion, textureRegionBounds1.x, screenRectangle.y, screenRectangle.getWidth(), screenRectangle.getHeight()); batch.draw(textureRegion, textureRegionBounds2.x, screenRectangle.y, screenRectangle.getWidth(), screenRectangle.getHeight()); }
@Override public void update(boolean resize) { if (viewport == null || !resize) return; viewport.x -= viewport.width / 2f; viewport.y -= viewport.height / 2f; panel.setPosition((viewport.getWidth() - panel.getWidth()) / 2, viewport.getHeight() - panel.getHeight()); miniMap.update(true); }
public InteractiveTileObject(PlayScreen screen, MapObject object){ this.object = object; this.screen = screen; this.world = screen.getWorld(); this.map = screen.getMap(); this.bounds = ((RectangleMapObject) object).getRectangle(); BodyDef bdef = new BodyDef(); FixtureDef fdef = new FixtureDef(); PolygonShape shape = new PolygonShape(); bdef.type = BodyDef.BodyType.StaticBody; bdef.position.set((bounds.getX() + bounds.getWidth() / 2) / MarioBros.PPM, (bounds.getY() + bounds.getHeight() / 2) / MarioBros.PPM); body = world.createBody(bdef); shape.setAsBox(bounds.getWidth() / 2 / MarioBros.PPM, bounds.getHeight() / 2 / MarioBros.PPM); fdef.shape = shape; fixture = body.createFixture(fdef); }
y = boundingRectangle.getY() + boundingRectangle.getHeight();
gridWidth = boundRect.getWidth() / density; gridHeight = regionAspectRatio * gridWidth; rows = (int) Math.ceil(boundRect.getHeight() / gridHeight);
unprojectTmp.set(r.getX() + r.getWidth() / 2, r.getY() + r.getHeight() / 2, 0); world.getSceneCamera().scene2screen(worldViewport, unprojectTmp);
unprojectTmp.set(r.getX() + r.getWidth() / 2, r.getY() + r.getHeight() / 2, 0); world.getSceneCamera().scene2screen(viewport, unprojectTmp);
bdef.position.set((rect.getX() + rect.getWidth() / 2) / MarioBros.PPM, (rect.getY() + rect.getHeight() / 2) / MarioBros.PPM); shape.setAsBox(rect.getWidth() / 2 / MarioBros.PPM, rect.getHeight() / 2 / MarioBros.PPM); fdef.shape = shape; body.createFixture(fdef); bdef.position.set((rect.getX() + rect.getWidth() / 2) / MarioBros.PPM, (rect.getY() + rect.getHeight() / 2) / MarioBros.PPM); shape.setAsBox(rect.getWidth() / 2 / MarioBros.PPM, rect.getHeight() / 2 / MarioBros.PPM); fdef.shape = shape; fdef.filter.categoryBits = MarioBros.OBJECT_BIT;
Rectangle boundingRectangle = bbox.getBoundingRectangle(); width = boundingRectangle.getWidth(); height = boundingRectangle.getHeight(); return;