mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
Change background image scaling in loading UI
This commit is contained in:
@@ -505,10 +505,14 @@ void ui_layer::render_background()
|
||||
tex.create();
|
||||
|
||||
// Get the scaling factor based on the image aspect ratio vs. the display aspect ratio.
|
||||
float scale_factor = (tex.get_width() / tex.get_height()) > (display_size.x / display_size.y)
|
||||
//float scale_factor = (tex.get_width() / tex.get_height()) > (display_size.x / display_size.y)
|
||||
// ? display_size.y / tex.get_height()
|
||||
// : display_size.x / tex.get_width();
|
||||
float scale_factor = (tex.get_width() / tex.get_height()) < (display_size.x / display_size.y)
|
||||
? display_size.y / tex.get_height()
|
||||
: display_size.x / tex.get_width();
|
||||
|
||||
|
||||
// Resize the image to fill the display. This will zoom in on the image on ultrawide monitors.
|
||||
image_size = ImVec2((int)(tex.get_width() * scale_factor), (int)(tex.get_height() * scale_factor));
|
||||
// Center the image on the display.
|
||||
|
||||
Reference in New Issue
Block a user