protected Matrix4 computeTransform() { Affine2 worldTransform = this.worldTransform; Group root = getRoot(); worldTransform.setToTrnRotScl(root.getX(), root.getY(), 0, root.getScaleX(), root.getScaleY()); computedTransform.set(worldTransform); return computedTransform; } }
public VDialog(VGame game, boolean isStretching) { this.isStretching = isStretching; this.game = game; stageTop = game.getTopStage(); //在有内置虚拟按钮的安卓上会出现屏幕分辨率被改变的状况造成遮盖层无法完全覆盖底层,故强制放大1.5倍解决这个问题 bg0 = game.getImage(stageTop.getFullWidth()*1.5f, stageTop.getFullHeight()*1.5f, Color.BLACK) .setPosition(game.getCenterX(), game.getCenterY(), Align.center).getActor(); if (isStretching) { setScale(1f / stageTop.getRoot().getScaleX(), 1f / stageTop.getRoot().getScaleY()); } addBackgroundAcition(); }
public void resize(float width, float height) { changing(width, height); getViewport().update(Gdx.graphics.getWidth(), Gdx.graphics.getHeight(), true); if (isStretching) {//拉伸适配的时候,计算一下iphoneX的安全边距 calculationCuts(); calculationAafeArea(1, 1); return; } float bl = getWidth() / getHeight() * Gdx.graphics.getHeight() / Gdx.graphics.getWidth(); if (bl < 1) { cutWidth = (1 - bl) * getWidth() / 2f; cutHeight = 0; getRoot().setScale(bl, 1); getRoot().setPosition(cutWidth, 0); cutWidth = cutWidth / getRoot().getScaleX(); calculationAafeArea(bl, 1); } else if (bl >= 1) { cutWidth = 0; cutHeight = (1 - 1 / bl) * getHeight() / 2f; getRoot().setScale(1, 1 / bl); getRoot().setPosition(0, cutHeight); cutHeight = cutHeight / getRoot().getScaleY(); calculationAafeArea(1, bl); } calculationCuts(); }
Group root=stage.getRoot(); float dx=root.getX()/root.getScaleX()-cutWidth; float dy=root.getY()/root.getScaleY()-cutHeight; fx+=dx; fy+=dy;
Group root=stage.getRoot(); float dx=root.getX()-cutWidth; float dy=root.getY()/root.getScaleY()-cutHeight;
float dy=root.getY()/root.getScaleY()-cutHeight; fx+=dx; fy+=dy;
Group root=stage.getRoot(); float dx=root.getX()-cutWidth; float dy=root.getY()/root.getScaleY()-cutHeight;
if (isStretching) { addAction(Actions.sequence(Actions.scaleTo(0, 0), Actions.scaleTo( 1f / stageTop.getRoot().getScaleX(), 1f / stageTop.getRoot().getScaleY() , 0.2f, Interpolation.bounce))); } else {