2D Toolkit Forum
2D Toolkit => Support => Topic started 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:
td2kCamera.inst.currentScale = 2f;
-
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...
-
Perfect! Thanks!