ID:154983
![]() Oct 20 2011, 12:22 pm
|
|
Hey, i'm not exactly great with interfaces, but i've looked through the help file and couldn't find a way to do this. Is there a way to force an aspect ratio on your interface so when you re-size it, it doesn't get contorted?
|
![]() Oct 20 2011, 12:25 pm
|
|
Anchors?
|
Beatmewithastick wrote:
Hey, i'm not exactly great with interfaces, but i've looked through the help file and couldn't find a way to do this. Is there a way to force an aspect ratio on your interface so when you re-size it, it doesn't get contorted? Not without writing some custom code. Here's a "smart" way to do it, which tries to guess if the user wanted to shrink or stretch their window: //Title: forceAspectRatio Then, in the window you want constrained, set its "Resize command" to "forceAspect [window] [aspectRatio]". For example, if your window was named "default" and you wanted a 4:3 aspect ratio, you would set the Resize command to forceAspect "default" 1.3333 I would also recommend manually calling forceAspect() when the player logs in, so the lastWindowWidth/Height is already set up when they go to resize it. |
Wow, thanks very much! I wasn't expecting it to be nearly as complicated as that - I figured it would be a few quick lines.
One quick last quesiton though - how do I actually call the verb for the windows resize command? (I know, it's probably super basic, but interfaces and skins have always eluded me, for some reason.) |
Beatmewithastick wrote:
Wow, thanks very much! I wasn't expecting it to be nearly as complicated as that - I figured it would be a few quick lines. Well, it was originally. Then when I started playing with it, I realized it was more annoying than useful, so I set out to make it smarter. It's still pretty short, I just put a lot of comments in there for you. One quick last quesiton though - how do I actually call the verb for the windows resize command? (I know, it's probably super basic, but interfaces and skins have always eluded me, for some reason.) Open up your interface, open the window you want to constrain, right-click in its canvas, select "Edit [window_name]...", and then under the General tab, set the "Resize command:" to: forceAspect "[window_name]" [ratio]. For example, if your window was named "default" and you wanted a 4:3 ratio, you would use: forceAspect "default" 1.3333 |