Libgdx 具有不同视口的两个阶段,如何删除它们之间的黑体

Libgdx 具有不同视口的两个阶段,如何删除它们之间的黑体,libgdx,Libgdx,我有两个阶段,一个是背景图像(使用FillViewport拉伸图像) 另一个使用Fitviewport显示游戏对象。 如何移除黑线以显示第一阶段的背景? 我在第二阶段尝试了Extendviewport,但它将在右边显示1280x720设备的间隙(如何将间隙拆分到左边?) 我认为应该避免使用具有不同视口的两个阶段。你会遇到更多的麻烦。如果您想要一个带有登录覆盖的背景图像,您应该只使用scene2d。或者在同一视口中使用两个阶段并手动缩放覆盖 但是,可以使用具有混合的帧缓冲区来过度绘制黑条 publ

我有两个阶段,一个是背景图像(使用FillViewport拉伸图像) 另一个使用Fitviewport显示游戏对象。 如何移除黑线以显示第一阶段的背景? 我在第二阶段尝试了Extendviewport,但它将在右边显示1280x720设备的间隙(如何将间隙拆分到左边?)


我认为应该避免使用具有不同视口的两个阶段。你会遇到更多的麻烦。如果您想要一个带有登录覆盖的背景图像,您应该只使用scene2d。或者在同一视口中使用两个阶段并手动缩放覆盖

但是,可以使用具有混合的帧缓冲区来过度绘制黑条

public LoginScreen(final MyGame gam) {
        game = gam;

        stageBG = new Stage(new FillViewport(800, 480));
        textureBackground = new Texture(Gdx.files.internal("background.png"));
        stageBG.addActor(new Image(textureBackground));

        stage = new Stage(new ExtendViewport(640, 480, 1280, 720));
        table = new Table();

        textureLoginArea = new Texture(Gdx.files.internal("login-area.png"));
        textureGirlGreen = new Texture(Gdx.files.internal("girl-green.png"));

        Gdx.input.setInputProcessor(stage);

        table.setBounds(415, 15, 374, 459);
        table.setBackground(new TextureRegionDrawable(new TextureRegion(textureLoginArea)));

        stage.addActor(table);
    }
@Override
    public void render(float v) {
        stageBG.act(Gdx.graphics.getDeltaTime());
        stageBG.draw();

        stage.act(Gdx.graphics.getDeltaTime());

        stage.getBatch().begin();
        stage.getBatch().draw(textureGirlGreen, 120, 0);
        stage.getBatch().end();

        stage.draw();
    }

    @Override
    public void resize(int width, int height) {
        stageBG.getViewport().update(width, height, true);
        stage.getViewport().update(width, height, true);
    }