bloodypenguin / Skylines-ModTools

Mod debugging/ reverse engineering tool for Cities: Skylines
MIT License
21 stars 15 forks source link

fix: clickCatcher has a wrong size and position when using windowed mode #5

Closed Craxy closed 9 years ago

Craxy commented 9 years ago

When C:S runs in windowed mode it still uses the fullscreen resolution as size of the game window. For example I'm playing in windowed mode with 1600x900, but C:S uses still 1920x1080 for GUI positions. That's best observable via Sapphire & Pause Menu: the background "ModalEffect" is still 1920x1080. but it's also easy to see with other controls or via ModTools (UIView.fixedHeight, UiView.fixedWidth and some other places). Unity doesn't use the C:S coordinate system, but instead uses the real pixels. Therefore the coordinate systems of Unity and C:S do not match. As a result a click catcher UIPanel does not match its corresponding Mod Tools window (neither size nor position). That's easy to see in this image: https://i.imgur.com/iFzRHzN.jpg : The click catcher is highlighted in green (via Sapphire). To match the two coordinate systems, there's a ratio property in UIView. Using this property it's just simple multiplications to convert a Unity position/size to C:S position/size.