File tree 1 file changed +14
-7
lines changed 1 file changed +14
-7
lines changed Original file line number Diff line number Diff line change @@ -141,16 +141,23 @@ end
141
141
--- @return number stretch_x
142
142
--- @return number stretch_y
143
143
function M .get_screen_aspect_koef ()
144
- local window_x , window_y = window .get_size ()
144
+ local gui_width = gui .get_width ()
145
+ local gui_height = gui .get_height ()
146
+ local gui_r = gui_width / gui_height
147
+
148
+ local window_width , window_height = window .get_size ()
149
+ local window_r = window_width / window_height
145
150
146
- local stretch_x = window_x / gui .get_width ()
147
- local stretch_y = window_y / gui .get_height ()
148
- local stretch_koef = math.min (stretch_x , stretch_y )
151
+ local w_s = 1
152
+ local h_s = 1
149
153
150
- local koef_x = window_x / (stretch_koef * sys .get_config_int (" display.width" ))
151
- local koef_y = window_y / (stretch_koef * sys .get_config_int (" display.height" ))
154
+ if gui_r < window_r then
155
+ w_s = window_r / gui_r
156
+ else
157
+ h_s = gui_r / window_r
158
+ end
152
159
153
- return koef_x , koef_y
160
+ return w_s , h_s
154
161
end
155
162
156
163
You can’t perform that action at this time.
0 commit comments