-
Notifications
You must be signed in to change notification settings - Fork 22
feat(ui): add resolution-aware scaling to main menu layout #23
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: master
Are you sure you want to change the base?
Conversation
Implemented dynamic scaling logic in MainMenu::render() to make the main menu UI adapt to various screen resolutions. Scaling factors are now calculated based on a 1024x768 baseline, with optional caps for layout and font scaling. This improves usability at 1080p, 1440p, and 4K without breaking existing layout behavior.
- Manually center and scale copyright text based on resolution - Prevent duplicate rendering by disabling default GUI window draw - Ensures proper alignment at all resolutions, including 4K
@@ -770,8 +776,13 @@ void MainMenu::render() | |||
} | |||
} | |||
|
|||
GUI_RECT rect = { 0, 0, Environment.screenWidth, Environment.screenHeight }; | |||
drawRect( rect, color ); | |||
GUI_RECT rect = { |
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.
there is no need to modify it:
1024 * scaleX = 1024 * (Environment.screenWidth / 1024.0f) = Environment.screenWidth
(same for height)
@@ -26,6 +26,7 @@ struct DDSURFACEDESC2 { | |||
#include"gamesound.h" | |||
#include"aanimobject.h" | |||
#include"multplyr.h" | |||
#include <algorithm> |
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.
let's not add dependency for something which can just be a one ternary operator
@@ -716,6 +717,11 @@ void MainMenu::update() | |||
void MainMenu::render() | |||
{ | |||
|
|||
// Calculate scale factors relative to 1024x768 base resolution | |||
float scaleX = Environment.screenWidth / 1024.0f; |
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.
this can be moved closer to drawShadowText
Thank you for your feedback! I'm not an experienced coder and I'm trying to help out however I can. I'll apply your suggestions and reupload! |
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.
I agree with your proposed changes. Do you want to conclude the review and merge this PR?
Cheers!
Implemented dynamic scaling logic in MainMenu::render() to make the main menu UI adapt to various screen resolutions. Scaling factors are now calculated based on a 1024x768 baseline, with optional caps for layout and font scaling. This improves usability at 1080p, 1440p, and 4K without breaking existing layout behavior.