0
\$\begingroup\$

I'm making a level select screen and I need use ExtendViewPort (I can't use Fit for other reasons), but this viewport moves my actors to the left, I need center them. I put X and Y position corresponding with my virtual screen size. This is my problem:

enter image description here

I do this things:

setViewport(new ExtendViewport(720, 1280));

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

actor.setPosition(10,100); (Examples..)

Sry for my bad english, I speak spanish.

\$\endgroup\$
  • \$\begingroup\$ can you provide more code?, do setViewport() is being called from a Stage object? \$\endgroup\$ – Alex Sifuentes Apr 7 '16 at 16:07
0
\$\begingroup\$

I already solved my problem using this:

viewport.getWorldWidth() 

I can't explain more because my english is so bad

| improve this answer | |
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.