-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with LibGdxGraphics.drawStage(Stage stage). #85
Comments
What version are you using? |
mini2DxVersion = '1.8.2' I also tried switching mini2DxVersion to 1.7 but it didn't help. |
Unfortunately this is due to how we interact with LibGDX and how LibGDX handles the orthographic view and texture U/V values. I'm hoping to fix this in the 2.0 release in the future when I restructure a lot of the internal code. The easiest workaround I can suggest is to create a org.mini2Dx.core.graphics.TextureRegion (which extends the LibGDX TextureRegion) and pass that to your stage actors. |
How should I do that if I use skin? TextButton button= new TextButton("text",skin,"default"); |
Looks like this is a lot messier than I thought. LibGDX scene 2D always assumes the bottom left of the screen is 0,0 but mini2Dx assumes it is top-left of the screen (to match Slick2D). I can change the code so that mini2Dx doesn't manipulate the scene camera but this means the 0,0 graphics coordinates in the scene will be at the bottom left. Another workaround is to flip your image in an image editor. Just an FYI that 2.0 will de-couple from LibGDX to allow for consoles support. This means that from 2.0 onwards it'll be recommended to not use LibGDX APIs directly (though it will still be allowed). I'm planning to simplify mini2Dx's UI library to work with a Scene2D-like API. I'm hoping to have a beta of 2.0 by August. More info can be found here |
OK I have just commented out these three lines in LibGdxGraphics.drawStage and it seems to work:
Thanks for help! |
I'll remove them in next update then XD |
It renders mirror reflection of stage (comparing to stage.draw()) . I believe it is because Stage has a coordinate system where (0,0) is at the bottom-left while LibGdxGraphics have usual coordinate system (where (0,0) is in the Top Left Corner).
I have tried this:
Camera camera= new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
camera.setToOrtho(true, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
stage = gc.createStage(new ScreenViewport(camera));
But it didn't work out. I guess it is because LibGdxGraphics.drawStage(Stage stage) uses its own camera:
Camera stageCamera = stage.getViewport().getCamera();
stageCamera.up.set(0, -1, 0);
stageCamera.direction.set(0, 0, 1);
stageCamera.update();
Any ideas how to solve this?
The text was updated successfully, but these errors were encountered: