-
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 |
|---|---|
| GeneralsMD/Code/GameEngine/Include/GameClient/Display.h | Added two scaling methods to scale pixel constants based on current display resolution relative to default 800x600 |
| GeneralsMD/Code/GameEngine/Source/GameClient/GUI/ProcessAnimateWindow.cpp | Moved velocity and threshold initialization from constructors to initAnimateWindow methods, applying resolution scaling for proper animation speeds across different resolutions |
Sequence Diagram
sequenceDiagram
participant AM as AnimateWindowManager
participant PA as ProcessAnimateWindow
participant D as Display
participant W as GameWindow
Note over AM,W: Animation Initialization
AM->>PA: initAnimateWindow(animWin)
PA->>W: winGetPosition(&x, &y)
W-->>PA: rest position
Note over PA,D: Resolution Scaling (NEW)
PA->>D: scaleHorizontalConstant(40)
D-->>PA: scaled velocity value
PA->>D: scaleHorizontalConstant(80)
D-->>PA: scaled threshold value
Note over PA: Set m_maxVel with scaled values
Note over PA: Set m_slowDownThreshold with scaled values
PA->>W: winSetPosition(startX, startY)
Note over AM,W: Animation Update Loop
loop Each Frame
AM->>PA: updateAnimateWindow(animWin)
PA->>PA: Calculate new position with velocity
PA->>PA: Check distance to end position
alt Within slowdown threshold
PA->>PA: Apply slowdown (vel *= m_slowDownRatio)
end
PA->>W: winSetPosition(curX, curY)
PA-->>AM: Animation continue/finished
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
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 class and changes 4 children of the
ProcessAnimateWindowclass -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.