Added opt-in support for high-dpi mode in OS X when on a retina display (resolves issue #761).

Added a ‘highdpi’ boolean flag to t.window/love.window.setMode (defaults to false.)
When the window is actually in high-dpi mode on a supported display, the graphics width and height and the mouse position are in pixels, rather than ‘window coordinates’.

Added love.window.getPixelScale. Returns the scale factor of the window from user-space points to pixels (e.g. it will be 1 normally, and 2 on a retina display in OS X with high-dpi mode enabled.)
This commit is contained in:
Alex Szpakowski
2014-01-17 21:11:20 -04:00
parent 29f47d9a10
commit 309193895a
10 changed files with 308 additions and 148 deletions
+7 -5
View File
@@ -41,8 +41,8 @@ public:
Window();
~Window();
bool setWindow(int width = 800, int height = 600, WindowAttributes *attribs = 0);
void getWindow(int &width, int &height, WindowAttributes &attribs);
bool setWindow(int width = 800, int height = 600, WindowSettings *settings = nullptr);
void getWindow(int &width, int &height, WindowSettings &settings);
bool setFullscreen(bool fullscreen, FullscreenType fstype);
bool setFullscreen(bool fullscreen);
@@ -79,6 +79,8 @@ public:
void setMouseGrab(bool grab);
bool isMouseGrabbed() const;
double getPixelScale() const;
const void *getHandle() const;
static love::window::Window *createSingleton();
@@ -91,8 +93,8 @@ private:
bool setContext(int fsaa, bool vsync);
void setWindowGLAttributes(int fsaa) const;
// Update the saved window attribs based on the window's actual state.
void updateAttributes(const WindowAttributes &newattribs);
// Update the saved window settings based on the window's actual state.
void updateSettings(const WindowSettings &newsettings);
std::string windowTitle;
@@ -102,7 +104,7 @@ private:
int width;
int height;
WindowAttributes attribs;
WindowSettings settings;
love::image::ImageData *icon;
} curMode;