Hello Guest

Author Topic: Adding new tk2dCamera scale mode  (Read 3686 times)

woodstock365

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 1
    • View Profile
Adding new tk2dCamera scale mode
« on: June 10, 2015, 01:00:36 pm »
Hi,

I'm using the tk2dCamera in my scene but would like to extend it to add a custom Auto Scale setting which is basically halfway between Fit Visible and Fill - resulting in a similar world area visible regardless of aspect ratio.

I have modified the tk2dCamera C# class and added my new scale calculation in place of the None option to check that it works.

I guess I would need to create a new class which extends the tk2dCamera C# class and override the relevant function to add my new functionality (so it will hopefully survive tk2d updates) then assign this script to my camera in place of the default one.

Is there a way for me to add my new scale mode to the dropdown list in the camera settings?

Thanks for any help in advance.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Adding new tk2dCamera scale mode
« Reply #1 on: June 12, 2015, 11:10:53 am »
Hi,

The easiest option here is to modify the tk2dCamera class directly. If you're version controlled (and you should be!) merging upgrades shouldn't be that much of a problem as long as you mark your additions clearly.

Otherwise, create a copy of the tk2dCamera & cameraEditor classes and do it that way. The list comes from the enum so you'll have to modify that too.