-
Notifications
You must be signed in to change notification settings - Fork 151
bugfix(ui): Fix window animations to scale with display resolution #2210
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
bugfix(ui): Fix window animations to scale with display resolution #2210
Conversation
Greptile Overview
|
| Filename | Overview |
|---|---|
| Generals/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp | Added resolution scaling for window animation velocities and slowdown thresholds using helper functions |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp | Added resolution scaling for window animation velocities and slowdown thresholds using helper functions |
Sequence Diagram
sequenceDiagram
participant User
participant AnimWin as AnimateWindow
participant Processor as ProcessAnimateWindowSlide*
participant Display as TheDisplay
participant Window as GameWindow
User->>AnimWin: Create animation
AnimWin->>Processor: initAnimateWindow(animWin)
Processor->>Display: getWidth()/getHeight()
Display-->>Processor: Current resolution
Processor->>Processor: scaleHorizontalConstant(40)
Note over Processor: Scales: (40/800)*currentWidth
Processor->>Processor: scaleVerticalConstant(80)
Note over Processor: Scales: (80/600)*currentHeight
Processor->>Processor: Set m_maxVel with scaled value
Processor->>Processor: Set m_slowDownThreshold with scaled value
Processor->>Window: winSetPosition(startPos)
Processor->>AnimWin: setAnimData(...)
loop Each frame
AnimWin->>Processor: updateAnimateWindow(animWin)
Processor->>Processor: Calculate new position
Processor->>Window: winSetPosition(curPos)
Note over Processor: Uses scaled velocity and threshold
Processor-->>AnimWin: Animation status
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1 file reviewed, 2 comments
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp
Outdated
Show resolved
Hide resolved
…comments for current date
|
Done all requested changes and replicated the fix for vanilla Generals. Works there as well. |
This fixes window animation speeds and smoothing on different display resolutions. Closes #2130
I've made a quick video showcasing new behavior and retail behavior side-by-side. Unfortunately it was too big for GitHub, so i uploaded it to YouTube.
https://youtu.be/wDQdis7Z1L4
Pay attention to how fast the control bar slides from the bottom when i'm loading into a match, and also how fast the diplomacy screen slides from the top.
This PR adds 2 new
methods to the Display classlocal helper functions and changes 4 children of theProcessAnimateWindowclass -SlideFromLeft,SlideFromRight,SlideFromTopandSlideFromBottom, making them benefit from these new methods.It also moves velocity and slowdown threshold initialization from the constructor into
initAnimateWindow, which means that these values will scale properly even if user changes their resolution in runtime.I've made little changes to minimize the possibility of new issues appearing while still fixing the issue.