Resolution, DPI and scaling
Posted: 02 Feb 2014, 16:48
Hi,
I've bought Noesis for Unity some time ago, but it's not until now I've had the time to start using it.
I haven't used WPF before, so the learning-curve for XAML feels quite steep right now...
There's one thing I'm not sure how to solve in Noesis. I guess it's not specific to Noesis, but rather XAML as a whole, but I hope you can still give some pointers:
I want to make sure that all text, cornerradii and so on will be the same size (with regards to percentage of screen height) across all devices.
So on a computer with 1920x1080 res and an android device with 480x320 res, a font size of 20 would be say 10% of the screen height, but a different physical size.
This could be solved by a Viewbox with Stretch set to Uniform.
BUT, at the same time I want to be able to fill the entire screen by a grid, for example.
My use case is to have a root grid that fill the entire screen.
The grid would have a set height (which will be scaled to fit the screen height).
The grid consists of 3 columns.
The left and right columns would have a specific width set, and the center column would take the remaining space.
So if the user has a screen or mobile device with a 4:3 aspect, the center column would be thinner, but the left and right columns would have a width that is aspect correct because of the scaling in the Viewbox.
On a device with a 16:9 aspect, the center column would be wider.
The thing that I can't get my head around is how to achieve everything I want at the same time.
If I use a Viewbox with uniform stretch, I get perfect scaling of fonts etc so that the GUI looks the same on all devices.
But at the same time, the uniform stretch prevents me from having the child-grid fill the entire screen since the viewbox has infinite size. If I make the grid wider, the viewbox will shrink it's contents to fit the width instead of the height.
If I use fill as the stretch method, I can get elements to stretch to fill the screen, but then every child element gets a different aspect ratio then expected and everything gets distorted.
Is there an easy way to set the width of the grid as it's height multiplied by the aspect ratio of the screen?
Or is there a better way than using a viewbox to make all texts and radii take up the same percentage of the screen while still allowing me to use fill the screen in both directions?
I know about binding, but if there's a way to achieve my goals in pure XAML it would be great.
I use Kaxaml, and I would prefer if I could preview the GUI in that application with the same layout and size as in Unity.
Sorry for a really lengthy and somewhat confusing post, but I hope that you had the stamina to read it through!
I've bought Noesis for Unity some time ago, but it's not until now I've had the time to start using it.
I haven't used WPF before, so the learning-curve for XAML feels quite steep right now...
There's one thing I'm not sure how to solve in Noesis. I guess it's not specific to Noesis, but rather XAML as a whole, but I hope you can still give some pointers:
I want to make sure that all text, cornerradii and so on will be the same size (with regards to percentage of screen height) across all devices.
So on a computer with 1920x1080 res and an android device with 480x320 res, a font size of 20 would be say 10% of the screen height, but a different physical size.
This could be solved by a Viewbox with Stretch set to Uniform.
BUT, at the same time I want to be able to fill the entire screen by a grid, for example.
My use case is to have a root grid that fill the entire screen.
The grid would have a set height (which will be scaled to fit the screen height).
The grid consists of 3 columns.
The left and right columns would have a specific width set, and the center column would take the remaining space.
So if the user has a screen or mobile device with a 4:3 aspect, the center column would be thinner, but the left and right columns would have a width that is aspect correct because of the scaling in the Viewbox.
On a device with a 16:9 aspect, the center column would be wider.
The thing that I can't get my head around is how to achieve everything I want at the same time.
If I use a Viewbox with uniform stretch, I get perfect scaling of fonts etc so that the GUI looks the same on all devices.
But at the same time, the uniform stretch prevents me from having the child-grid fill the entire screen since the viewbox has infinite size. If I make the grid wider, the viewbox will shrink it's contents to fit the width instead of the height.
If I use fill as the stretch method, I can get elements to stretch to fill the screen, but then every child element gets a different aspect ratio then expected and everything gets distorted.
Is there an easy way to set the width of the grid as it's height multiplied by the aspect ratio of the screen?
Or is there a better way than using a viewbox to make all texts and radii take up the same percentage of the screen while still allowing me to use fill the screen in both directions?
I know about binding, but if there's a way to achieve my goals in pure XAML it would be great.
I use Kaxaml, and I would prefer if I could preview the GUI in that application with the same layout and size as in Unity.
Sorry for a really lengthy and somewhat confusing post, but I hope that you had the stamina to read it through!