diff --git a/engine/client/vid_common.c b/engine/client/vid_common.c index d40aebcf..838598cf 100644 --- a/engine/client/vid_common.c +++ b/engine/client/vid_common.c @@ -74,6 +74,9 @@ void R_SaveVideoMode( int w, int h, int render_w, int render_h, qboolean maximiz if( refState.width == render_w && refState.height == render_h ) return; + refState.scale_x = (float)render_w / w; + refState.scale_y = (float)render_h / h; + refState.width = render_w; refState.height = render_h; diff --git a/engine/ref_api.h b/engine/ref_api.h index e71543e0..11f5869e 100644 --- a/engine/ref_api.h +++ b/engine/ref_api.h @@ -125,7 +125,7 @@ typedef struct ref_globals_s { qboolean developer; - // viewport width and height + // viewport width and height (physical window size) int width; int height; @@ -144,6 +144,10 @@ typedef struct ref_globals_s size_t visbytes; // cluster size int desktopBitsPixel; + + // scaling factor of physical window size compared to logical + float scale_x; + float scale_y; } ref_globals_t; typedef struct ref_client_s