I want to add a screen zoom function, but it seems that "player. Zoom" only supports writing, but does not support reading. Is there a way to obtain the current zoom ratio? Because only in this way can smooth scaling be achieved
I've tried to record with variables, but if the player adjusts with the scroll wheel, this variable is not accurate,
How can I get the zoom ratio of the current screen?
- Stringweasel
- Filter Inserter
- Posts: 310
- Joined: Thu Apr 27, 2017 8:22 pm
- Contact:
Re: How can I get the zoom ratio of the current screen?
This is not possible unfortunately. It's not part of the game state, since it's specific to you and other players don't need to know about it. Similar to the location of your mouse pointer. And if it's not part of the game state it means that, in multiplayer for example, my game won't know the zoom level of your game. This can create desyncs between game instances if the mod does something depending on the zoom level. Or that's how I understand it at leastsdgmlj wrote: ↑Fri Mar 18, 2022 12:14 pmI want to add a screen zoom function, but it seems that "player. Zoom" only supports writing, but does not support reading. Is there a way to obtain the current zoom ratio? Because only in this way can smooth scaling be achieved
I've tried to record with variables, but if the player adjusts with the scroll wheel, this variable is not accurate,
Alt-F4 Author | Factorio Modder
Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Mods: Hall of Fame | Better Victory Screen | Fluidic Power | Biter Power | Space Spidertron | Spidertron Dock | Weasel's Demolition Derby
Re: How can I get the zoom ratio of the current screen?
Thank you. It seems that there is no way to solve this problemStringweasel wrote: ↑Fri Mar 18, 2022 12:33 pmThis is not possible unfortunately. It's not part of the game state, since it's specific to you and other players don't need to know about it. Similar to the location of your mouse pointer. And if it's not part of the game state it means that, in multiplayer for example, my game won't know the zoom level of your game. This can create desyncs between game instances if the mod does something depending on the zoom level. Or that's how I understand it at leastsdgmlj wrote: ↑Fri Mar 18, 2022 12:14 pmI want to add a screen zoom function, but it seems that "player. Zoom" only supports writing, but does not support reading. Is there a way to obtain the current zoom ratio? Because only in this way can smooth scaling be achieved
I've tried to record with variables, but if the player adjusts with the scroll wheel, this variable is not accurate,
Re: How can I get the zoom ratio of the current screen?
You can disable the normal zoom controls to avoid that problem. You would have to do all zoom controls with your mod then though.