Skip to content

Support for zooming from scripting - #1560

Merged
tobbi merged 3 commits into
SuperTux:masterfrom
Semphriss:zoom
Oct 26, 2020
Merged

tobbi merged 3 commits into
SuperTux:masterfrom
Semphriss:zoom

Conversation

@Semphriss

Copy link
Copy Markdown
Member

Zooming now available to level designers!

zooming

If you have a portion of you level that is bigger or smaller, you can now use zooming to increase the effect on the player :)

Accessible from Camera.set_scale(scale), Camera.scale(scale, time) and Camera.ease_scale(scale, time, easing) where:

  • scale is a decimal number which is the zoom multiplier. 1 is default zoom, The gif uses 0.75. A smaller number = a larger portion of the level visible to the screen.
  • time is a decimal number that represent the time it will take to reach the scale.
  • easing is a string with the name of the easing you want to use, following the format "Ease[Mode][Direction]" where "Mode" is the easing mode (Sine, Exponential, Back, Bounce, etc.) and Direction is In, Out, or InOut. For a ful llist of possibilites, see: https://easings.net/ (note that the name are not exactly the name, the order is different). Examples: "EaseSineInOut", "EaseBounceOut", "EaseBackIn"

@Rusty-Box

Copy link
Copy Markdown
Member

Is this linked to the magnification setting? And if so, can you also return the zoom back to the original setting?

@Semphriss

Copy link
Copy Markdown
Member Author

This works in a similar way but is completely independant from the magnification setting. The scale is tied to the camera object, and is applied only to the sector the camera is linked to, similarly to the camera translation.

@Rusty-Box

Rusty-Box commented Oct 21, 2020 •

Copy link
Copy Markdown
Member

So, a 200% zoom when magnification is 100 is different from a 200% zoom when magnification is 160 (as an example)?

@Semphriss

Copy link
Copy Markdown
Member Author

Yes, indeed. A magnification of 200 with a zoom of 200% would result in an overall zoom of 400%.

@Rusty-Box

Copy link
Copy Markdown
Member

Okay, but doesn't this provide a problem for players with different different settings. For example, if a cutscene zoomes in (based on a magnification of 100) important things may get lost if the same cutscene is viewed by players having a magnification of 200?

@Semphriss

Copy link
Copy Markdown
Member Author

This problem isn't introduced by this feature, though. Players on smaller/bigger resolutions have the same problem. The difference between what players on 640x480 see and those on 1920x1080 see will be the same at 100% zoom or 500% zoom.

This is a level design thing, and since the feature is for level designers, it will be their job to make sure what they want to show is clear and visible on small resolutions. This is true without this feature, and it will be the same with it :)

Comment thread src/object/camera.hpp Resolved
Comment thread src/object/camera.hpp Resolved
Comment thread src/video/canvas.cpp Resolved
@tobbi
tobbi merged commit 44be8d1 into SuperTux:master Oct 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants