mirror of
https://github.com/love2d/love.git
synced 2026-08-20 04:30:09 +02:00
Merge default into minor
--HG-- branch : minor
This commit is contained in:
@@ -88,7 +88,7 @@ function love_math.noise(x, y, z, w)
|
|||||||
return tonumber(ffifuncs.noise3(x, y, z))
|
return tonumber(ffifuncs.noise3(x, y, z))
|
||||||
elseif y ~= nil then
|
elseif y ~= nil then
|
||||||
return tonumber(ffifuncs.noise2(x, y))
|
return tonumber(ffifuncs.noise2(x, y))
|
||||||
elseif x ~= nil then
|
else
|
||||||
return tonumber(ffifuncs.noise1(x))
|
return tonumber(ffifuncs.noise1(x))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -151,9 +151,6 @@ public:
|
|||||||
|
|
||||||
virtual bool isVisible() const = 0;
|
virtual bool isVisible() const = 0;
|
||||||
|
|
||||||
virtual void setMouseVisible(bool visible) = 0;
|
|
||||||
virtual bool getMouseVisible() const = 0;
|
|
||||||
|
|
||||||
virtual void setMouseGrab(bool grab) = 0;
|
virtual void setMouseGrab(bool grab) = 0;
|
||||||
virtual bool isMouseGrabbed() const = 0;
|
virtual bool isMouseGrabbed() const = 0;
|
||||||
|
|
||||||
|
|||||||
@@ -505,14 +505,14 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
|||||||
if (f.vsync == -1 && SDL_GL_GetSwapInterval() != -1)
|
if (f.vsync == -1 && SDL_GL_GetSwapInterval() != -1)
|
||||||
SDL_GL_SetSwapInterval(1);
|
SDL_GL_SetSwapInterval(1);
|
||||||
|
|
||||||
updateSettings(f);
|
updateSettings(f, false);
|
||||||
|
|
||||||
auto gfx = Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS);
|
auto gfx = Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS);
|
||||||
if (gfx != nullptr)
|
if (gfx != nullptr)
|
||||||
gfx->setMode(pixelWidth, pixelHeight);
|
gfx->setMode(pixelWidth, pixelHeight);
|
||||||
|
|
||||||
#ifdef LOVE_ANDROID
|
#ifdef LOVE_ANDROID
|
||||||
love::android::setImmersive(f.fullscreen);
|
love::android::setImmersive(f.fullscreen);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -535,7 +535,7 @@ bool Window::onSizeChanged(int width, int height)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::updateSettings(const WindowSettings &newsettings)
|
void Window::updateSettings(const WindowSettings &newsettings, bool updateGraphicsViewport)
|
||||||
{
|
{
|
||||||
Uint32 wflags = SDL_GetWindowFlags(window);
|
Uint32 wflags = SDL_GetWindowFlags(window);
|
||||||
|
|
||||||
@@ -595,13 +595,21 @@ void Window::updateSettings(const WindowSettings &newsettings)
|
|||||||
|
|
||||||
// May be 0 if the refresh rate can't be determined.
|
// May be 0 if the refresh rate can't be determined.
|
||||||
settings.refreshrate = (double) dmode.refresh_rate;
|
settings.refreshrate = (double) dmode.refresh_rate;
|
||||||
|
|
||||||
|
if (updateGraphicsViewport)
|
||||||
|
{
|
||||||
|
// Update the viewport size now instead of waiting for event polling.
|
||||||
|
auto gfx = Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS);
|
||||||
|
if (gfx != nullptr)
|
||||||
|
gfx->setViewportSize(pixelWidth, pixelHeight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::getWindow(int &width, int &height, WindowSettings &newsettings)
|
void Window::getWindow(int &width, int &height, WindowSettings &newsettings)
|
||||||
{
|
{
|
||||||
// The window might have been modified (moved, resized, etc.) by the user.
|
// The window might have been modified (moved, resized, etc.) by the user.
|
||||||
if (window)
|
if (window)
|
||||||
updateSettings(settings);
|
updateSettings(settings, true);
|
||||||
|
|
||||||
width = windowWidth;
|
width = windowWidth;
|
||||||
height = windowHeight;
|
height = windowHeight;
|
||||||
@@ -668,17 +676,12 @@ bool Window::setFullscreen(bool fullscreen, Window::FullscreenType fstype)
|
|||||||
if (SDL_SetWindowFullscreen(window, sdlflags) == 0)
|
if (SDL_SetWindowFullscreen(window, sdlflags) == 0)
|
||||||
{
|
{
|
||||||
SDL_GL_MakeCurrent(window, context);
|
SDL_GL_MakeCurrent(window, context);
|
||||||
updateSettings(newsettings);
|
updateSettings(newsettings, true);
|
||||||
|
|
||||||
// Apparently this gets un-set when we exit fullscreen (at least in OS X).
|
// Apparently this gets un-set when we exit fullscreen (at least in OS X).
|
||||||
if (!fullscreen)
|
if (!fullscreen)
|
||||||
SDL_SetWindowMinimumSize(window, settings.minwidth, settings.minheight);
|
SDL_SetWindowMinimumSize(window, settings.minwidth, settings.minheight);
|
||||||
|
|
||||||
// Update the viewport size now instead of waiting for event polling.
|
|
||||||
auto gfx = Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS);
|
|
||||||
if (gfx != nullptr)
|
|
||||||
gfx->setViewportSize(pixelWidth, pixelHeight);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -877,7 +880,10 @@ void Window::minimize()
|
|||||||
void Window::maximize()
|
void Window::maximize()
|
||||||
{
|
{
|
||||||
if (window != nullptr)
|
if (window != nullptr)
|
||||||
|
{
|
||||||
SDL_MaximizeWindow(window);
|
SDL_MaximizeWindow(window);
|
||||||
|
updateSettings(settings, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::swapBuffers()
|
void Window::swapBuffers()
|
||||||
@@ -900,16 +906,6 @@ bool Window::isVisible() const
|
|||||||
return window && (SDL_GetWindowFlags(window) & SDL_WINDOW_SHOWN) != 0;
|
return window && (SDL_GetWindowFlags(window) & SDL_WINDOW_SHOWN) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setMouseVisible(bool visible)
|
|
||||||
{
|
|
||||||
SDL_ShowCursor(visible ? SDL_ENABLE : SDL_DISABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Window::getMouseVisible() const
|
|
||||||
{
|
|
||||||
return (SDL_ShowCursor(SDL_QUERY) == SDL_ENABLE);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Window::setMouseGrab(bool grab)
|
void Window::setMouseGrab(bool grab)
|
||||||
{
|
{
|
||||||
mouseGrabbed = grab;
|
mouseGrabbed = grab;
|
||||||
|
|||||||
@@ -83,9 +83,6 @@ public:
|
|||||||
|
|
||||||
bool isVisible() const;
|
bool isVisible() const;
|
||||||
|
|
||||||
void setMouseVisible(bool visible);
|
|
||||||
bool getMouseVisible() const;
|
|
||||||
|
|
||||||
void setMouseGrab(bool grab);
|
void setMouseGrab(bool grab);
|
||||||
bool isMouseGrabbed() const;
|
bool isMouseGrabbed() const;
|
||||||
|
|
||||||
@@ -126,7 +123,7 @@ private:
|
|||||||
bool createWindowAndContext(int x, int y, int w, int h, Uint32 windowflags, int msaa);
|
bool createWindowAndContext(int x, int y, int w, int h, Uint32 windowflags, int msaa);
|
||||||
|
|
||||||
// Update the saved window settings based on the window's actual state.
|
// Update the saved window settings based on the window's actual state.
|
||||||
void updateSettings(const WindowSettings &newsettings);
|
void updateSettings(const WindowSettings &newsettings, bool updateGraphicsViewport);
|
||||||
|
|
||||||
SDL_MessageBoxFlags convertMessageBoxType(MessageBoxType type) const;
|
SDL_MessageBoxFlags convertMessageBoxType(MessageBoxType type) const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user