MCPcopy Create free account
hub / github.com/ZDoom/Raze / V_UpdateModeSize

Function V_UpdateModeSize

source/common/rendering/v_video.cpp:277–314  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

275
276
277void V_UpdateModeSize (int width, int height)
278{
279 // This calculates the menu scale.
280 // The optimal scale will always be to fit a virtual 640 pixel wide display onto the screen.
281 // Exceptions are made for a few ranges where the available virtual width is > 480.
282
283 // This reference size is being used so that on 800x450 (small 16:9) a scale of 2 gets used.
284
285 CleanXfac = max(min(screen->GetWidth() / 400, screen->GetHeight() / 240), 1);
286 if (CleanXfac >= 4) CleanXfac--; // Otherwise we do not have enough space for the episode/skill menus in some languages.
287 CleanYfac = CleanXfac;
288 CleanWidth = screen->GetWidth() / CleanXfac;
289 CleanHeight = screen->GetHeight() / CleanYfac;
290
291 int w = screen->GetWidth();
292 int h = screen->GetHeight();
293
294 // clamp screen aspect ratio to 17:10, for anything wider the width will be reduced
295 double aspect = (double)w / h;
296 if (aspect > 1.7) w = int(w * 1.7 / aspect);
297
298 int factor;
299 if (w < 640) factor = 1;
300 else if (w >= 1024 && w < 1280) factor = 2;
301 else if (w >= 1600 && w < 1920) factor = 3;
302 else factor = w / 640;
303
304 if (w < 1360) factor = 1;
305 else if (w < 1920) factor = 2;
306 else factor = int(factor * 0.7);
307
308 CleanYfac_1 = CleanXfac_1 = factor;// max(1, int(factor * 0.7));
309 CleanWidth_1 = width / CleanXfac_1;
310 CleanHeight_1 = height / CleanYfac_1;
311
312 DisplayWidth = width;
313 DisplayHeight = height;
314}
315
316void V_OutputResized (int width, int height)
317{

Callers 3

setVideoModeFunction · 0.85
V_OutputResizedFunction · 0.85
SetResolutionMethod · 0.85

Calls 2

GetWidthMethod · 0.45
GetHeightMethod · 0.45

Tested by

no test coverage detected