mirror of
https://github.com/love2d/love.git
synced 2026-08-16 00:02:12 +02:00
Fixes to make Löve compile on Windows 10 UWP
This commit is contained in:
@@ -519,7 +519,9 @@ std::string Filesystem::getAppdataDirectory()
|
||||
{
|
||||
if (appdata.empty())
|
||||
{
|
||||
#ifdef LOVE_WINDOWS
|
||||
#ifdef LOVE_WINDOWS_UWP
|
||||
appdata = getUserDirectory();
|
||||
#elif 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;
|
||||
|
||||
FileData *newFileData(void *data, unsigned int size, const char *filename) const;
|
||||
FileData *newFileData(const char *b64, const char *filename) const;
|
||||
|
||||
@@ -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, "Universal Windows Platform");
|
||||
#elif LOVE_WINDOWS
|
||||
lua_pushstring(L, "Windows");
|
||||
#elif defined(LOVE_MACOSX)
|
||||
lua_pushstring(L, "OS X");
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifndef LOVE_NO_MPG123
|
||||
|
||||
namespace love
|
||||
{
|
||||
namespace sound
|
||||
@@ -286,3 +288,5 @@ double Mpg123Decoder::getDuration()
|
||||
} // lullaby
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_NO_MPG123
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "common/Data.h"
|
||||
#include "Decoder.h"
|
||||
|
||||
#ifndef LOVE_NO_MPG123
|
||||
|
||||
// libmpg123
|
||||
#ifdef LOVE_APPLE_USE_FRAMEWORKS
|
||||
#include <mpg123/mpg123.h>
|
||||
@@ -88,4 +90,6 @@ private:
|
||||
} // sound
|
||||
} // love
|
||||
|
||||
#endif // LOVE_NO_MPG123
|
||||
|
||||
#endif // LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H
|
||||
|
||||
@@ -30,9 +30,9 @@
|
||||
#include "WaveDecoder.h"
|
||||
//#include "FLACDecoder.h"
|
||||
|
||||
#ifndef LOVE_NOMPG123
|
||||
#ifndef LOVE_NO_MPG123
|
||||
# include "Mpg123Decoder.h"
|
||||
#endif // LOVE_NOMPG123
|
||||
#endif // LOVE_NO_MPG123
|
||||
|
||||
#ifdef LOVE_SUPPORT_COREAUDIO
|
||||
# include "CoreAudioDecoder.h"
|
||||
@@ -51,9 +51,9 @@ Sound::Sound()
|
||||
|
||||
Sound::~Sound()
|
||||
{
|
||||
#ifndef LOVE_NOMPG123
|
||||
#ifndef LOVE_NO_MPG123
|
||||
Mpg123Decoder::quit();
|
||||
#endif // LOVE_NOMPG123
|
||||
#endif // LOVE_NO_MPG123
|
||||
}
|
||||
|
||||
const char *Sound::getName() const
|
||||
@@ -75,10 +75,10 @@ sound::Decoder *Sound::newDecoder(love::filesystem::FileData *data, int bufferSi
|
||||
else if (ModPlugDecoder::accepts(ext))
|
||||
decoder = new ModPlugDecoder(data, ext, bufferSize);
|
||||
#endif // LOVE_NO_MODPLUG
|
||||
#ifndef LOVE_NOMPG123
|
||||
#ifndef LOVE_NO_MPG123
|
||||
else if (Mpg123Decoder::accepts(ext))
|
||||
decoder = new Mpg123Decoder(data, ext, bufferSize);
|
||||
#endif // LOVE_NOMPG123
|
||||
#endif // LOVE_NO_MPG123
|
||||
else if (VorbisDecoder::accepts(ext))
|
||||
decoder = new VorbisDecoder(data, ext, bufferSize);
|
||||
#ifdef LOVE_SUPPORT_GME
|
||||
|
||||
@@ -147,12 +147,18 @@ 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)
|
||||
|
||||
result = ShellExecuteW(nullptr,
|
||||
L"open",
|
||||
wurl.c_str(),
|
||||
nullptr,
|
||||
nullptr,
|
||||
SW_SHOW);
|
||||
|
||||
#endif // LOVE_WINDOWS_UWP
|
||||
|
||||
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