mirror of
https://github.com/love2d/love.git
synced 2026-08-17 19:23:38 +02:00
Fixes to make Löve compile on Windows 10 UWP
This commit is contained in:
@@ -24,6 +24,11 @@
|
|||||||
// Platform stuff.
|
// Platform stuff.
|
||||||
#if defined(WIN32) || defined(_WIN32)
|
#if defined(WIN32) || defined(_WIN32)
|
||||||
# define LOVE_WINDOWS 1
|
# define LOVE_WINDOWS 1
|
||||||
|
#if WINAPI_FAMILY==WINAPI_FAMILY_APP
|
||||||
|
# define LOVE_WINDOWS_UWP 1
|
||||||
|
# define LOVE_NO_MODPLUG 1
|
||||||
|
# define LOVE_NO_MPG123 1
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
#if defined(linux) || defined(__linux) || defined(__linux__)
|
#if defined(linux) || defined(__linux) || defined(__linux__)
|
||||||
# define LOVE_LINUX 1
|
# define LOVE_LINUX 1
|
||||||
@@ -76,7 +81,9 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(LOVE_WINDOWS)
|
#if defined(LOVE_WINDOWS)
|
||||||
|
#ifndef LOVE_WINDOWS_UWP
|
||||||
# define LOVE_LEGENDARY_CONSOLE_IO_HACK
|
# define LOVE_LEGENDARY_CONSOLE_IO_HACK
|
||||||
|
#endif // LOVE_WINDOWS_UWP
|
||||||
# define NOMINMAX
|
# define NOMINMAX
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -519,7 +519,9 @@ std::string Filesystem::getAppdataDirectory()
|
|||||||
{
|
{
|
||||||
if (appdata.empty())
|
if (appdata.empty())
|
||||||
{
|
{
|
||||||
#ifdef LOVE_WINDOWS
|
#ifdef LOVE_WINDOWS_UWP
|
||||||
|
appdata = getUserDirectory();
|
||||||
|
#elif LOVE_WINDOWS
|
||||||
wchar_t *w_appdata = _wgetenv(L"APPDATA");
|
wchar_t *w_appdata = _wgetenv(L"APPDATA");
|
||||||
appdata = to_utf8(w_appdata);
|
appdata = to_utf8(w_appdata);
|
||||||
replace_char(appdata, '\\', '/');
|
replace_char(appdata, '\\', '/');
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public:
|
|||||||
bool mount(const char *archive, const char *mountpoint, bool appendToPath = false);
|
bool mount(const char *archive, const char *mountpoint, bool appendToPath = false);
|
||||||
bool unmount(const char *archive);
|
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(void *data, unsigned int size, const char *filename) const;
|
||||||
FileData *newFileData(const char *b64, 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_pushcfunction(L, w_love_isVersionCompatible);
|
||||||
lua_setfield(L, -2, "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");
|
lua_pushstring(L, "Windows");
|
||||||
#elif defined(LOVE_MACOSX)
|
#elif defined(LOVE_MACOSX)
|
||||||
lua_pushstring(L, "OS X");
|
lua_pushstring(L, "OS X");
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
|
#ifndef LOVE_NO_MPG123
|
||||||
|
|
||||||
namespace love
|
namespace love
|
||||||
{
|
{
|
||||||
namespace sound
|
namespace sound
|
||||||
@@ -286,3 +288,5 @@ double Mpg123Decoder::getDuration()
|
|||||||
} // lullaby
|
} // lullaby
|
||||||
} // sound
|
} // sound
|
||||||
} // love
|
} // love
|
||||||
|
|
||||||
|
#endif // LOVE_NO_MPG123
|
||||||
@@ -25,6 +25,8 @@
|
|||||||
#include "common/Data.h"
|
#include "common/Data.h"
|
||||||
#include "Decoder.h"
|
#include "Decoder.h"
|
||||||
|
|
||||||
|
#ifndef LOVE_NO_MPG123
|
||||||
|
|
||||||
// libmpg123
|
// libmpg123
|
||||||
#ifdef LOVE_APPLE_USE_FRAMEWORKS
|
#ifdef LOVE_APPLE_USE_FRAMEWORKS
|
||||||
#include <mpg123/mpg123.h>
|
#include <mpg123/mpg123.h>
|
||||||
@@ -88,4 +90,6 @@ private:
|
|||||||
} // sound
|
} // sound
|
||||||
} // love
|
} // love
|
||||||
|
|
||||||
|
#endif // LOVE_NO_MPG123
|
||||||
|
|
||||||
#endif // LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H
|
#endif // LOVE_SOUND_LULLABY_LIBMPG123_DECODER_H
|
||||||
|
|||||||
@@ -30,9 +30,9 @@
|
|||||||
#include "WaveDecoder.h"
|
#include "WaveDecoder.h"
|
||||||
//#include "FLACDecoder.h"
|
//#include "FLACDecoder.h"
|
||||||
|
|
||||||
#ifndef LOVE_NOMPG123
|
#ifndef LOVE_NO_MPG123
|
||||||
# include "Mpg123Decoder.h"
|
# include "Mpg123Decoder.h"
|
||||||
#endif // LOVE_NOMPG123
|
#endif // LOVE_NO_MPG123
|
||||||
|
|
||||||
#ifdef LOVE_SUPPORT_COREAUDIO
|
#ifdef LOVE_SUPPORT_COREAUDIO
|
||||||
# include "CoreAudioDecoder.h"
|
# include "CoreAudioDecoder.h"
|
||||||
@@ -51,9 +51,9 @@ Sound::Sound()
|
|||||||
|
|
||||||
Sound::~Sound()
|
Sound::~Sound()
|
||||||
{
|
{
|
||||||
#ifndef LOVE_NOMPG123
|
#ifndef LOVE_NO_MPG123
|
||||||
Mpg123Decoder::quit();
|
Mpg123Decoder::quit();
|
||||||
#endif // LOVE_NOMPG123
|
#endif // LOVE_NO_MPG123
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *Sound::getName() const
|
const char *Sound::getName() const
|
||||||
@@ -75,10 +75,10 @@ sound::Decoder *Sound::newDecoder(love::filesystem::FileData *data, int bufferSi
|
|||||||
else if (ModPlugDecoder::accepts(ext))
|
else if (ModPlugDecoder::accepts(ext))
|
||||||
decoder = new ModPlugDecoder(data, ext, bufferSize);
|
decoder = new ModPlugDecoder(data, ext, bufferSize);
|
||||||
#endif // LOVE_NO_MODPLUG
|
#endif // LOVE_NO_MODPLUG
|
||||||
#ifndef LOVE_NOMPG123
|
#ifndef LOVE_NO_MPG123
|
||||||
else if (Mpg123Decoder::accepts(ext))
|
else if (Mpg123Decoder::accepts(ext))
|
||||||
decoder = new Mpg123Decoder(data, ext, bufferSize);
|
decoder = new Mpg123Decoder(data, ext, bufferSize);
|
||||||
#endif // LOVE_NOMPG123
|
#endif // LOVE_NO_MPG123
|
||||||
else if (VorbisDecoder::accepts(ext))
|
else if (VorbisDecoder::accepts(ext))
|
||||||
decoder = new VorbisDecoder(data, ext, bufferSize);
|
decoder = new VorbisDecoder(data, ext, bufferSize);
|
||||||
#ifdef LOVE_SUPPORT_GME
|
#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.
|
// Unicode-aware WinAPI functions don't accept UTF-8, so we need to convert.
|
||||||
std::wstring wurl = to_widestr(url);
|
std::wstring wurl = to_widestr(url);
|
||||||
|
|
||||||
HINSTANCE result = ShellExecuteW(nullptr,
|
HINSTANCE result = 0;
|
||||||
L"open",
|
|
||||||
wurl.c_str(),
|
#if !defined(LOVE_WINDOWS_UWP)
|
||||||
nullptr,
|
|
||||||
nullptr,
|
result = ShellExecuteW(nullptr,
|
||||||
SW_SHOW);
|
L"open",
|
||||||
|
wurl.c_str(),
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
SW_SHOW);
|
||||||
|
|
||||||
|
#endif // LOVE_WINDOWS_UWP
|
||||||
|
|
||||||
return (int) result > 32;
|
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+.
|
// 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();
|
auto it = attribslist.begin();
|
||||||
while (it != attribslist.end())
|
while (it != attribslist.end())
|
||||||
@@ -1019,7 +1026,7 @@ int Window::showMessageBox(const MessageBoxData &data)
|
|||||||
|
|
||||||
void Window::requestAttention(bool continuous)
|
void Window::requestAttention(bool continuous)
|
||||||
{
|
{
|
||||||
#if defined(LOVE_WINDOWS)
|
#if defined(LOVE_WINDOWS) && !defined(LOVE_WINDOWS_UWP)
|
||||||
|
|
||||||
if (hasFocus())
|
if (hasFocus())
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user