2015-09-07 16:19:15 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-10-03 22:25:21 +00:00
|
|
|
#include "Common/Math/lin/matrix4x4.h"
|
2017-03-05 00:39:26 +00:00
|
|
|
|
2015-09-07 16:19:15 +00:00
|
|
|
// This is meant to be a framework for handling DPI scaling etc.
|
|
|
|
// For now, it just consists of these ugly globals.
|
|
|
|
|
2017-03-05 00:39:26 +00:00
|
|
|
// On some platforms (currently only Windows UWP) we need to manually rotate
|
|
|
|
// our rendered output to match the display. Use these to do so.
|
|
|
|
enum class DisplayRotation {
|
|
|
|
ROTATE_0 = 0,
|
|
|
|
ROTATE_90,
|
|
|
|
ROTATE_180,
|
|
|
|
ROTATE_270,
|
|
|
|
};
|
|
|
|
|
2023-02-25 12:09:44 +00:00
|
|
|
struct DisplayProperties {
|
|
|
|
int dp_xres;
|
|
|
|
int dp_yres;
|
|
|
|
int pixel_xres;
|
|
|
|
int pixel_yres;
|
|
|
|
|
|
|
|
float dpi = 1.0f; // will be overwritten with a value that makes sense.
|
|
|
|
float dpi_scale_x = 1.0f;
|
|
|
|
float dpi_scale_y = 1.0f;
|
|
|
|
|
|
|
|
// pixel_xres/yres in dps
|
|
|
|
float pixel_in_dps_x = 1.0f;
|
|
|
|
float pixel_in_dps_y = 1.0f;
|
|
|
|
|
|
|
|
// If DPI is overridden (like in small window mode), these are still the original DPI.
|
|
|
|
float dpi_scale_real_x = 1.0f;
|
|
|
|
float dpi_scale_real_y = 1.0f;
|
|
|
|
|
|
|
|
float display_hz = 60.0f;
|
|
|
|
|
|
|
|
DisplayRotation rotation;
|
|
|
|
Lin::Matrix4x4 rot_matrix;
|
2023-02-27 14:21:58 +00:00
|
|
|
|
|
|
|
DisplayProperties();
|
|
|
|
void Print();
|
2023-02-25 12:09:44 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
extern DisplayProperties g_display;
|
2019-09-03 21:26:05 +00:00
|
|
|
|
2019-10-13 17:56:25 +00:00
|
|
|
template<class T>
|
2019-10-13 19:23:49 +00:00
|
|
|
struct DisplayRect {
|
2019-10-13 17:56:25 +00:00
|
|
|
T x, y, w, h;
|
2019-09-03 21:26:05 +00:00
|
|
|
};
|
2019-10-13 17:56:25 +00:00
|
|
|
|
2019-10-13 19:23:49 +00:00
|
|
|
void RotateRectToDisplay(DisplayRect<float> &rect, float rtWidth, float rtHeight);
|
|
|
|
void RotateRectToDisplay(DisplayRect<int> &rect, int rtWidth, int rtHeight);
|