mirror of
https://github.com/love2d/love.git
synced 2026-08-16 08:11:02 +02:00
Add 'usedpiscale' boolean (true by default) to love.window.setMode's settings table and love.conf's t.window table. Add love.window.getNativeDPIScale.
When usedpiscale=false, love will no longer automatically scale coordinates by the screen's DPI scale factor (so all coordinates will be in pixels), even when highdpi=true. love.window.getDPIScale will return 1, love.graphics.newCanvas will default to a dpi scale of 1 instead of the screen's dpi scale, etc. love.window.getNativeDPIScale() will return the screen's DPI scale as reported by the OS no matter what usedpiscale is set to.
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "common/Module.h"
|
||||
#include "common/StringMap.h"
|
||||
#include "common/math.h"
|
||||
#include "common/Optional.h"
|
||||
#include "image/ImageData.h"
|
||||
|
||||
// C++
|
||||
@@ -66,6 +67,7 @@ public:
|
||||
SETTING_CENTERED,
|
||||
SETTING_DISPLAY,
|
||||
SETTING_HIGHDPI,
|
||||
SETTING_USE_DPISCALE,
|
||||
SETTING_REFRESHRATE,
|
||||
SETTING_X,
|
||||
SETTING_Y,
|
||||
@@ -200,6 +202,7 @@ public:
|
||||
virtual void DPIToWindowCoords(double *x, double *y) const = 0;
|
||||
|
||||
virtual double getDPIScale() const = 0;
|
||||
virtual double getNativeDPIScale() const = 0;
|
||||
|
||||
virtual double toPixels(double x) const = 0;
|
||||
virtual void toPixels(double wx, double wy, double &px, double &py) const = 0;
|
||||
@@ -259,6 +262,7 @@ struct WindowSettings
|
||||
bool centered = true;
|
||||
int display = 0;
|
||||
bool highdpi = false;
|
||||
bool usedpiscale = true;
|
||||
double refreshrate = 0.0;
|
||||
bool useposition = false;
|
||||
int x = 0;
|
||||
|
||||
Reference in New Issue
Block a user