2D Toolkit Forum

2D Toolkit => Support => Topic started by: theremin on May 31, 2012, 01:46:24 am

Title: Change tk2dCamera scale dynamically with code?
Post by: theremin on May 31, 2012, 01:46:24 am
How can I change the Scale for the tk2dCamera dynamically with code? I don't want to have to create dozens of different Resolution Overrides for all sorts of different devices and monitors; I'd prefer to just set the scale dynamically with code according to a handful of resolution ranges. Is this possible?

Basically, I'm looking for something like this:

Code: [Select]
td2kCamera.inst.currentScale = 2f;
Title: Re: Change tk2dCamera scale dynamically with code?
Post by: unikronsoftware on May 31, 2012, 08:19:33 am
Not directly like that, but if you set up the override through code in game, then that'll work.

tk2dCamera.inst.resolutionOverride = new ...;
tk2dCamera.inst.resolutionOverride[0].width = resolution;
tk2dCamera.inst.resolutionOverride[0].scale = customScale;

and don't forget to call UpdateCameraMatrix after that...
Title: Re: Change tk2dCamera scale dynamically with code?
Post by: theremin on May 31, 2012, 03:47:45 pm
Perfect! Thanks!