setDesignResolution causes UI to render incorrectly
See original GitHub issueI have the following UI just to get things rolling:
private void SetupMenu()
{
var ui = camera.addComponent(new UICanvas());
ui.isFullScreen = true;
var skin = Skin.createDefaultSkin();
var table = ui.stage.addElement(new Table());
table.setFillParent(true).center();
var playTestButton = table.add(new TextButton("Play Test Level", skin)).setFillX().setMinHeight(30).getElement<TextButton>();
playTestButton.onClicked += b =>
{
Game.scene = new PlayerTestScene();
};
table.row().setPadTop(15f);
var exitButton = table.add(new TextButton("Exit", skin)).setFillX().setMinHeight(30).getElement<TextButton>();
exitButton.onClicked += b =>
{
Game.exit();
};
}
Any translation I make to the camera isn’t retained by the UI, so setting the position of the camera to (200, 200) would put the UI more towards the top left of the screen space. Even if I set the position of the UI’s entity, there is no change in its rendered position.
How do I make the UICanvas component’s rendered stage stay relative to my camera’s position while using a design resolution, i.e retain camera space rendering?
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
[SOLVED] Problem with ui::button and resolution policy ...
I am designing my scenes with Cocos Studio 2 at 640x1136, matching the design resolution. Then I load them on my scene's .cpp...
Read more >UI scaling problem when using render-to-texture
But I'm finding that if the RenderTexture size is not exactly equal to the current screen resolution, the UI scaling system causes problems....
Read more >How to solve problem with too many re-renders in context?
No, the problem you describing is that you have components that listen to data AND render UI, it should be separated, components to...
Read more >Slow rendering | App quality
On later versions of Android, it's one of the most common reasons for the UI thread to stop running. Generally, the fix is...
Read more >What problem does Virtual DOM solve for React? : r/Frontend
React renders to an virtual tree and then compares it with the previous one. It then applies the difference to the DOM.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Since the priority for the project I was working on was lowered, I’ll go ahead and close this without testing it out. If it ends up continuing to be an issue ill reopen or make another issue.
All good, I just wanted to get a resolution in here for future reference 😃