mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Merge default into minor
--HG-- branch : minor
This commit is contained in:
@@ -496,7 +496,9 @@ std::string Filesystem::getAppdataDirectory()
|
||||
{
|
||||
if (appdata.empty())
|
||||
{
|
||||
#ifdef LOVE_WINDOWS
|
||||
#ifdef LOVE_WINDOWS_UWP
|
||||
appdata = getUserDirectory();
|
||||
#elif defined(LOVE_WINDOWS)
|
||||
wchar_t *w_appdata = _wgetenv(L"APPDATA");
|
||||
appdata = to_utf8(w_appdata);
|
||||
replace_char(appdata, '\\', '/');
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
bool mount(const char *archive, const char *mountpoint, bool appendToPath = false);
|
||||
bool unmount(const char *archive);
|
||||
|
||||
File *newFile(const char *filename) const;
|
||||
love::filesystem::File *newFile(const char *filename) const;
|
||||
|
||||
const char *getWorkingDirectory();
|
||||
std::string getUserDirectory();
|
||||
|
||||
@@ -79,6 +79,16 @@ Quad::Viewport Quad::getViewport() const
|
||||
return viewport;
|
||||
}
|
||||
|
||||
double Quad::getTextureWidth() const
|
||||
{
|
||||
return sw;
|
||||
}
|
||||
|
||||
double Quad::getTextureHeight() const
|
||||
{
|
||||
return sh;
|
||||
}
|
||||
|
||||
const Vertex *Quad::getVertices() const
|
||||
{
|
||||
return vertices;
|
||||
|
||||
@@ -47,6 +47,9 @@ public:
|
||||
void setViewport(const Viewport &v);
|
||||
Viewport getViewport() const;
|
||||
|
||||
double getTextureWidth() const;
|
||||
double getTextureHeight() const;
|
||||
|
||||
const Vertex *getVertices() const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -252,7 +252,7 @@ love::font::GlyphData *Font::getRasterizerGlyphData(uint32 glyph)
|
||||
|
||||
const Font::Glyph &Font::addGlyph(uint32 glyph)
|
||||
{
|
||||
love::font::GlyphData *gd = getRasterizerGlyphData(glyph);
|
||||
StrongRef<love::font::GlyphData> gd(getRasterizerGlyphData(glyph), Acquire::NORETAIN);
|
||||
|
||||
int w = gd->getWidth();
|
||||
int h = gd->getHeight();
|
||||
@@ -264,18 +264,15 @@ const Font::Glyph &Font::addGlyph(uint32 glyph)
|
||||
textureY += rowHeight;
|
||||
rowHeight = TEXTURE_PADDING;
|
||||
}
|
||||
|
||||
if (textureY + h + TEXTURE_PADDING > textureHeight)
|
||||
{
|
||||
// totally out of space - new texture!
|
||||
try
|
||||
{
|
||||
createTexture();
|
||||
}
|
||||
catch (love::Exception &)
|
||||
{
|
||||
gd->release();
|
||||
throw;
|
||||
}
|
||||
createTexture();
|
||||
|
||||
// Makes sure the above code for checking if the glyph can fit at
|
||||
// the current position in the texture is run again for this glyph.
|
||||
return addGlyph(glyph);
|
||||
}
|
||||
|
||||
Glyph g;
|
||||
@@ -318,18 +315,12 @@ const Font::Glyph &Font::addGlyph(uint32 glyph)
|
||||
g.vertices[i].x += gd->getBearingX();
|
||||
g.vertices[i].y -= gd->getBearingY();
|
||||
}
|
||||
|
||||
textureX += w + TEXTURE_PADDING;
|
||||
rowHeight = std::max(rowHeight, h + TEXTURE_PADDING);
|
||||
}
|
||||
|
||||
if (w > 0)
|
||||
textureX += (w + TEXTURE_PADDING);
|
||||
|
||||
if (h > 0)
|
||||
rowHeight = std::max(rowHeight, h + TEXTURE_PADDING);
|
||||
|
||||
gd->release();
|
||||
|
||||
const auto p = glyphs.insert(std::make_pair(glyph, g));
|
||||
|
||||
return p.first->second;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,10 +64,21 @@ int w_Quad_getViewport(lua_State *L)
|
||||
return 4;
|
||||
}
|
||||
|
||||
int w_Quad_getTextureDimensions(lua_State *L)
|
||||
{
|
||||
Quad *quad = luax_checkquad(L, 1);
|
||||
double sw = quad->getTextureWidth();
|
||||
double sh = quad->getTextureHeight();
|
||||
lua_pushnumber(L, sw);
|
||||
lua_pushnumber(L, sh);
|
||||
return 2;
|
||||
}
|
||||
|
||||
static const luaL_Reg w_Quad_functions[] =
|
||||
{
|
||||
{ "setViewport", w_Quad_setViewport },
|
||||
{ "getViewport", w_Quad_getViewport },
|
||||
{ "getTextureDimensions", w_Quad_getTextureDimensions },
|
||||
{ 0, 0 }
|
||||
};
|
||||
|
||||
|
||||
@@ -307,7 +307,9 @@ int luaopen_love(lua_State *L)
|
||||
lua_pushcfunction(L, w_love_isVersionCompatible);
|
||||
lua_setfield(L, -2, "isVersionCompatible");
|
||||
|
||||
#ifdef LOVE_WINDOWS
|
||||
#ifdef LOVE_WINDOWS_UWP
|
||||
lua_pushstring(L, "UWP");
|
||||
#elif LOVE_WINDOWS
|
||||
lua_pushstring(L, "Windows");
|
||||
#elif defined(LOVE_MACOSX)
|
||||
lua_pushstring(L, "OS X");
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifndef LOVE_NOMPG123
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
@@ -286,3 +288,5 @@ double Mpg123Decoder::getDuration()
|
||||
} // lullaby
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_NOMPG123
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "common/Data.h"
|
||||
#include "Decoder.h"
|
||||
|
||||
#ifndef LOVE_NOMPG123
|
||||
|
||||
// libmpg123
|
||||
#ifdef LOVE_APPLE_USE_FRAMEWORKS
|
||||
#include <mpg123/mpg123.h>
|
||||
@@ -88,4 +90,6 @@ private:
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_NOMPG123
|
||||
|
||||
#endif // LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H
|
||||
|
||||
@@ -83,6 +83,8 @@ std::string System::getOS() const
|
||||
return "OS X";
|
||||
#elif defined(LOVE_IOS)
|
||||
return "iOS";
|
||||
#elif defined(LOVE_WINDOWS_UWP)
|
||||
return "UWP";
|
||||
#elif defined(LOVE_WINDOWS)
|
||||
return "Windows";
|
||||
#elif defined(LOVE_ANDROID)
|
||||
@@ -147,12 +149,24 @@ bool System::openURL(const std::string &url) const
|
||||
// Unicode-aware WinAPI functions don't accept UTF-8, so we need to convert.
|
||||
std::wstring wurl = to_widestr(url);
|
||||
|
||||
HINSTANCE result = ShellExecuteW(nullptr,
|
||||
L"open",
|
||||
wurl.c_str(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
SW_SHOW);
|
||||
HINSTANCE result = 0;
|
||||
|
||||
#if defined(LOVE_WINDOWS_UWP)
|
||||
|
||||
Platform::String^ urlString = ref new Platform::String(wurl.c_str());
|
||||
auto uwpUri = ref new Windows::Foundation::Uri(urlString);
|
||||
Windows::System::Launcher::LaunchUriAsync(uwpUri);
|
||||
|
||||
#else
|
||||
|
||||
result = ShellExecuteW(nullptr,
|
||||
L"open",
|
||||
wurl.c_str(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
SW_SHOW);
|
||||
|
||||
#endif
|
||||
|
||||
return (int) result > 32;
|
||||
|
||||
|
||||
@@ -229,7 +229,14 @@ bool Window::createWindowAndContext(int x, int y, int w, int h, Uint32 windowfla
|
||||
};
|
||||
|
||||
// OpenGL ES 3+ contexts are only properly supported in SDL 2.0.4+.
|
||||
if (hasSDL203orEarlier)
|
||||
bool removeES3 = hasSDL203orEarlier;
|
||||
|
||||
// While UWP SDL is above 2.0.4, it still doesn't support OpenGL ES 3+
|
||||
#ifdef LOVE_WINDOWS_UWP
|
||||
removeES3 = true;
|
||||
#endif
|
||||
|
||||
if (removeES3)
|
||||
{
|
||||
auto it = attribslist.begin();
|
||||
while (it != attribslist.end())
|
||||
@@ -1019,7 +1026,7 @@ int Window::showMessageBox(const MessageBoxData &data)
|
||||
|
||||
void Window::requestAttention(bool continuous)
|
||||
{
|
||||
#if defined(LOVE_WINDOWS)
|
||||
#if defined(LOVE_WINDOWS) && !defined(LOVE_WINDOWS_UWP)
|
||||
|
||||
if (hasFocus())
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user