UI - Aspect ratio and relative font size

Discussion of proposed new features.

UI - Aspect ratio and relative font size

PostPosted by Enhex » 06 Apr 2016, 15:20

As far as I understand the way to have scaling UI in Urho is to use the automatic layout modes.
But it isn't possible to have elements that maintain their aspect ratio, for example icon images.

Aspect ratio is relative to the height or width of the parent, this way it can work with the layout modes.
Parent needs to be in free layout mode so the element can be resized? (or maybe implement horizontal/vertical aspect ratio as a new layout modes, if that makes sense?)

Having the font size relative to its parent's height (similar to aspect ratio) is also needed to have scaling UI.

With both aspect ratio and font size relative to parent, I think it would be possible to make fully scaling UI layouts.
User avatar
Enhex
Most active user
Most active user
 
Posts: 325
Joined: 31 Dec 2014, 12:23

Re: UI - Aspect ratio and relative font size

PostPosted by Enhex » 08 Apr 2016, 11:33

Image
Image
Square maintains its 1:1 aspect ratio.
Text maintains its relative height to the square.
Bars don't maintain aspect ratio, which is changed because the screen aspect ratio changed.

I implemented it these as "external components" to the UI elements, which resize the element on the parent's E_RESIZE event.
Code available here: https://gist.github.com/Enhex/e618ee4d3 ... 80305a7556

It would be nice to see these features added to Urho, so Urho will have a complete solution for scalable UI.
User avatar
Enhex
Most active user
Most active user
 
Posts: 325
Joined: 31 Dec 2014, 12:23

Re: UI - Aspect ratio and relative font size

PostPosted by cadaver » 08 Apr 2016, 12:08

I'd recommend reworking that as UIElement's feature and submitting a PR. It doesn't have to be perfect, can be improved by others later.
User avatar
cadaver
Urho3D author
Urho3D author
 
Posts: 1802
Joined: 16 Jan 2014, 14:52
Location: Finland

Re: UI - Aspect ratio and relative font size

PostPosted by Enhex » 12 Apr 2016, 17:17

I already had some changes, so I want to use these more before making them part of Urho.
User avatar
Enhex
Most active user
Most active user
 
Posts: 325
Joined: 31 Dec 2014, 12:23

Re: UI - Aspect ratio and relative font size

PostPosted by ucupumar » 18 Jun 2016, 07:26

Is there any updates for this?
User avatar
ucupumar
Some active
Some active
 
Posts: 81
Joined: 01 May 2014, 05:36
Location: Indonesia

Re: UI - Aspect ratio and relative font size

PostPosted by Enhex » 18 Jun 2016, 16:02

ucupumar wrote:Is there any updates for this?

I think I have more recent revision if you're interested.
It's still usable as is though very messy.
There are many things on my TODO list before integrating it to Urho, so I won't be able to do it anytime soon.
User avatar
Enhex
Most active user
Most active user
 
Posts: 325
Joined: 31 Dec 2014, 12:23

Re: UI - Aspect ratio and relative font size

PostPosted by ucupumar » 13 Jul 2016, 12:17

Enhex wrote:I think I have more recent revision if you're interested.
It's still usable as is though very messy.
There are many things on my TODO list before integrating it to Urho, so I won't be able to do it anytime soon.

Where's the code? Let me take a look. :)
Anyway, if you don't mind, can you share the TODO list?
User avatar
ucupumar
Some active
Some active
 
Posts: 81
Joined: 01 May 2014, 05:36
Location: Indonesia

Re: UI - Aspect ratio and relative font size

PostPosted by Enhex » 13 Jul 2016, 13:09

ucupumar wrote:
Enhex wrote:I think I have more recent revision if you're interested.
It's still usable as is though very messy.
There are many things on my TODO list before integrating it to Urho, so I won't be able to do it anytime soon.

Where's the code? Let me take a look. :)
Anyway, if you don't mind, can you share the TODO list?

Here's my current version:
https://gist.github.com/Enhex/357c0fe02 ... 8d677326f4

By TODO list I meant general TODO list of my projects, not a specific TODO list for these UI things, if that's what you understood.
It's ready to be integrated in the sense that it works, and integrating it will make using it much nicer.
User avatar
Enhex
Most active user
Most active user
 
Posts: 325
Joined: 31 Dec 2014, 12:23

Re: UI - Aspect ratio and relative font size

PostPosted by ucupumar » 14 Jul 2016, 08:51

I see, thanks for the code! I'll look into it. :)
User avatar
ucupumar
Some active
Some active
 
Posts: 81
Joined: 01 May 2014, 05:36
Location: Indonesia


Return to Feature Request

Who is online

Users browsing this forum: No registered users and 0 guests

cron