2D Toolkit Forum

2D Toolkit => Support => Topic started by: wagenheimer on November 21, 2014, 08:04:29 pm

Title: Resolution
Post by: wagenheimer on November 21, 2014, 08:04:29 pm
I do use Fit Height to all my cameras and it works very well...

But... I want that if the Aspectio Ratio is lower than 1,33, instead of using Fit Height it keeps the 1,33 aspect ratio and then scale to fit the screen... How can I achieve this?
Title: Re: Resolution
Post by: unikronsoftware on November 22, 2014, 11:03:55 am
tk2d doesn't support that, but you can control the tk2d camera override from code. So... if you create a behaviour that can decide what to do based on resolution, you just need a tk2dcamera with exactly one wildcard override, and set it up from code as you need it.
Title: Re: Resolution
Post by: wagenheimer on November 24, 2014, 02:14:16 pm
How to create this behavior? I have some ideas of how to calculate the desired scale but how to change it on runtime?

Title: Re: Resolution
Post by: wagenheimer on November 24, 2014, 02:58:07 pm
It worked but I had to change tk2dCamera.cs code.

It would be possible if a future update add this option?

FitHeightorScaleToFit

And add two Addittional Properties : MinWidth and MaxWidth bounds.

It tries to Fit Height, but if it not fits using Min/Max bounds, so it will Scale It using the Min/Max bounds configuration.

I'm sure this will be usefully to tons of people here! =)



Title: Re: Resolution
Post by: unikronsoftware on November 28, 2014, 12:31:50 pm
Not that it matters now that you have a solution, but you can do this without touching tk2d code at all, you can get the tk2dCamera.CurrentResolutionOverride and do what you wish with it externally.