Updated LÖVE code to tag 11.2 (changeset 55dc225ee2)

This commit is contained in:
Martin Felis
2018-12-07 18:34:41 +01:00
parent 34e88d43ae
commit 0000c326a8
38 changed files with 197 additions and 73 deletions
+1
View File
@@ -54,4 +54,5 @@ dependencies {
repositories {
google()
jcenter()
}
+2 -2
View File
@@ -1,4 +1,4 @@
repo: d362ae6ab7f5005b8dbc7cba9ce592637de60f99
node: 0ab246b5045d2e697a516fcc0f8b12496a2d5c78
node: 55dc225ee239c15eff5751d35ca40252588abd92
branch: default
tag: 11.1
tag: 11.2
+1
View File
@@ -12,3 +12,4 @@ a5e405cdf14d030b71d09a105086797942ae91a9 0.9.2
3cb3559eebb89803c0b7fa83d51d8e48a2b20b7a 0.10.1
afc69c4f714534c64e6f8c8660b724b5b736d7f3 0.10.2
bf8892ecbd07a10453c4bb36aa538b90a2830d2b 11.0
0ab246b5045d2e697a516fcc0f8b12496a2d5c78 11.1
+18 -1
View File
@@ -66,6 +66,10 @@ endif()
message(STATUS "Target platform: ${LOVE_TARGET_PLATFORM}")
if(POLICY CMP0072)
cmake_policy(SET CMP0072 NEW)
endif()
find_package(OpenGL)
if(MEGA)
@@ -174,6 +178,8 @@ Please see http://bitbucket.org/rude/megasource
find_package(SDL2 REQUIRED)
find_package(Theora REQUIRED)
find_package(Vorbis REQUIRED)
find_package(ZLIB REQUIRED)
find_package(Ogg REQUIRED)
# required for enet
add_definitions(-D HAS_SOCKLEN_T)
@@ -182,6 +188,11 @@ Please see http://bitbucket.org/rude/megasource
${SDL2_INCLUDE_DIR}
${FREETYPE_INCLUDE_DIRS}
${VORBIS_INCLUDE_DIR}
${OPENAL_INCLUDE_DIR}
${ZLIB_INCLUDE_DIRS}
${MODPLUG_INCLUDE_DIR}
${OGG_INCLUDE_DIR}
${THEORA_INCLUDE_DIR}
)
set(LOVE_LINK_LIBRARIES
@@ -194,14 +205,20 @@ Please see http://bitbucket.org/rude/megasource
${THEORADEC_LIBRARY}
${VORBISFILE_LIBRARY}
${LOVE_LUA_LIBRARY}
${OGG_LIBRARY}
${ZLIB_LIBRARY}
)
if(LOVE_MPG123)
find_package(MPG123 REQUIRED)
set(LOVE_LINK_LIBRARIES
${LOVE_LINK_LIBRARIES}
${MPG123_LIBRARY}
)
set(LOVE_INCLUDE_DIRS
${LOVE_INCLUDE_DIRS}
${MPG123_INCLUDE_DIR}
)
endif()
if(LOVE_JIT)
+18
View File
@@ -1,3 +1,21 @@
LOVE 11.2 [Mysterious Mysteries]
--------------------------------
Released: 2018-11-25
* Added Source:setAirAbsorption and Source:getAirAbsorption.
* Added Body:setTransform and Body:getTransform.
* Improved performance of love.graphics.draw slightly on iOS and Android.
* Fixed filesystem initialization on Windows 10 update 1809.
* Fixed compatibility with Lua 5.2 and 5.3.
* Fixed the explicit format + Data argument variant of love.data.decompress.
* Fixed love.joystick.setGamepadMapping not being able to change existing mappings.
* Fixed a crash on quit on Linux if a custom cursor is active when quitting.
* Fixed a crash in the Data variant of Shader:send when it's called after love.window.setMode.
* Fixed a love.graphics.setCanvas error message to be less confusing.
LOVE 11.1 [Mysterious Mysteries]
--------------------------------
@@ -1,4 +1,4 @@
version: 11.1.{build}
version: 11.2.{build}
image: Visual Studio 2013
@@ -11,7 +11,7 @@ set(LUAJIT_SEARCH_PATHS
find_path(LUAJIT_INCLUDE_DIR
NAMES luajit.h
PATH_SUFFIXES include include/luajit-2.0
PATH_SUFFIXES include include/luajit-2.0 include/luajit-2.1
PATHS ${LUAJIT_SEARCH_PATHS})
find_library(LUAJIT_LIBRARY
Binary file not shown.
+2 -1
View File
@@ -1,4 +1,4 @@
AC_INIT([love], [11.1])
AC_INIT([love], [11.2])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([platform/unix])
AC_CONFIG_MACRO_DIR([platform/unix/m4])
@@ -63,6 +63,7 @@ ACLOVE_DEP_LUA
ACLOVE_DEP_SDL2
ACLOVE_DEP_LIBM
ACLOVE_DEP_ZLIB
ACLOVE_DEP_PTHREAD
# Conditional dependencies
AS_VAR_IF([enable_module_audio], [yes], [ACLOVE_DEP_OPENAL], [])
@@ -1,5 +1,5 @@
love@LOVE_SUFFIX@ (0.11.0~pre3420ppa3) trusty; urgency=medium
love@LOVE_SUFFIX@ (11.2~pre3458ppa1) trusty; urgency=medium
* Upstream testing release
-- Bart van Strien <bart.bes@gmail.com> Sat, 31 Mar 2018 13:50:30 +0200
-- Bart van Strien <bart.bes@gmail.com> Tue, 10 Jul 2018 19:22:30 +0200
@@ -35,7 +35,8 @@ Description: 2D game engine - runtime
Package: love@LOVE_SUFFIX@
Architecture: any
Depends: ${misc:Depends},
${shlibs:Depends}
${shlibs:Depends},
liblove@LOVE_SUFFIX@0 (= ${binary:Version})
Description: 2D game engine
LOVE is a free 2D game engine which enables easy game creation in Lua.
+3
View File
@@ -22,6 +22,9 @@ AC_DEFUN([ACLOVE_DEP_LIBM], [
AC_DEFUN([ACLOVE_DEP_SDL2], [
AM_PATH_SDL2([], [], [LOVE_MSG_ERROR([SDL 2])])])
AC_DEFUN([ACLOVE_DEP_PTHREAD], [
AC_SEARCH_LIBS([pthread_create], [pthread], [], [LOVE_MSG_ERROR([the POSIX threads library])])])
# does not use pkg-config because of the FILE_OFFSET_BITS.. bit
AC_DEFUN([ACLOVE_DEP_MPG123], [
AC_SEARCH_LIBS([mpg123_open_feed], [mpg123], [],
+1 -1
View File
@@ -12,7 +12,7 @@
.\" 3. This notice may not be removed or altered from any source distribution.
.Dd March 31, 2018
.Dt LOVE 6
.Os LÖVE 11.1
.Os LÖVE 11.2
.Sh NAME
.Nm love
.Nd 2D game development framework
@@ -40,7 +40,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>11.1</string>
<string>11.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
@@ -1081,7 +1081,6 @@
FADF543D1E3DAFF700012CC0 /* wrap_Graphics.h in Headers */ = {isa = PBXBuildFile; fileRef = FADF543A1E3DAFF700012CC0 /* wrap_Graphics.h */; };
FAE272521C05A15B00A67640 /* ParticleSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FAE272501C05A15B00A67640 /* ParticleSystem.cpp */; };
FAE272531C05A15B00A67640 /* ParticleSystem.h in Headers */ = {isa = PBXBuildFile; fileRef = FAE272511C05A15B00A67640 /* ParticleSystem.h */; };
FAE64A7E2071359C00BC7981 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE64A7D2071359C00BC7981 /* libfreetype.a */; };
FAE64A7F207135AD00BC7981 /* libfreetype.a in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE64A7D2071359C00BC7981 /* libfreetype.a */; };
FAE64A802071362A00BC7981 /* physfs_archiver_7z.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD5D1FE35E95006A60C7 /* physfs_archiver_7z.c */; };
FAE64A812071363100BC7981 /* physfs_archiver_dir.c in Sources */ = {isa = PBXBuildFile; fileRef = FAC7CD6C1FE35E95006A60C7 /* physfs_archiver_dir.c */; };
@@ -2079,7 +2078,6 @@
FA9B4A0816E1578300074F42 /* SDL2.framework in Frameworks */,
FAAFF04416CB11C700CCDE45 /* OpenAL-Soft.framework in Frameworks */,
FAD43ECC1FF312D800831BB8 /* freetype.framework in Frameworks */,
FAE64A7E2071359C00BC7981 /* libfreetype.a in Frameworks */,
FA577AB016C7507900860150 /* Cocoa.framework in Frameworks */,
FA577AC516C7513400860150 /* libmodplug.framework in Frameworks */,
FA577AC716C7513A00860150 /* mpg123.framework in Frameworks */,
@@ -4125,7 +4123,7 @@
08FB7793FE84155DC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0920;
LastUpgradeCheck = 1000;
TargetAttributes = {
FA0B78DC1A958B90000E1D17 = {
CreatedOnToolsVersion = 6.1.1;
@@ -4966,12 +4964,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = NO;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -5026,12 +5026,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = NO;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -5214,12 +5216,14 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = NO;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
@@ -326,7 +326,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0920;
LastUpgradeCheck = 1000;
TargetAttributes = {
FA0B7F051A95AAF3000E1D17 = {
CreatedOnToolsVersion = 6.1.1;
@@ -503,11 +503,13 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
@@ -580,11 +582,13 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
@@ -806,11 +810,13 @@
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
@@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>11.1</string>
<string>11.2</string>
<key>CFBundleSignature</key>
<string>LoVe</string>
<key>NSPrincipalClass</key>
@@ -62,7 +62,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>11.1</string>
<string>11.2</string>
<key>CFBundleSignature</key>
<string>LoVe</string>
<key>LSApplicationCategoryType</key>
+36 -3
View File
@@ -29,6 +29,10 @@
#include <xmmintrin.h>
#endif
#if defined(LOVE_SIMD_NEON)
#include <arm_neon.h>
#endif
namespace love
{
@@ -43,9 +47,6 @@ namespace love
void Matrix4::multiply(const Matrix4 &a, const Matrix4 &b, float t[16])
{
// NOTE: in my testing with ARM NEON instructions (on an iPhone 6 with arm64)
// it performed slightly worse than the regular add/multiply code. Further
// investigation would be useful.
#if defined(LOVE_SIMD_SSE)
// We can't guarantee 16-bit alignment (e.g. for heap-allocated Matrix4
@@ -70,6 +71,38 @@ void Matrix4::multiply(const Matrix4 &a, const Matrix4 &b, float t[16])
_mm_storeu_ps(&t[4*i], col);
}
#elif defined(LOVE_SIMD_NEON)
float32x4_t cola1 = vld1q_f32(&a.e[0]);
float32x4_t cola2 = vld1q_f32(&a.e[4]);
float32x4_t cola3 = vld1q_f32(&a.e[8]);
float32x4_t cola4 = vld1q_f32(&a.e[12]);
float32x4_t col1 = vmulq_n_f32(cola1, b.e[0]);
col1 = vmlaq_n_f32(col1, cola2, b.e[1]);
col1 = vmlaq_n_f32(col1, cola3, b.e[2]);
col1 = vmlaq_n_f32(col1, cola4, b.e[3]);
float32x4_t col2 = vmulq_n_f32(cola1, b.e[4]);
col2 = vmlaq_n_f32(col2, cola2, b.e[5]);
col2 = vmlaq_n_f32(col2, cola3, b.e[6]);
col2 = vmlaq_n_f32(col2, cola4, b.e[7]);
float32x4_t col3 = vmulq_n_f32(cola1, b.e[8]);
col3 = vmlaq_n_f32(col3, cola2, b.e[9]);
col3 = vmlaq_n_f32(col3, cola3, b.e[10]);
col3 = vmlaq_n_f32(col3, cola4, b.e[11]);
float32x4_t col4 = vmulq_n_f32(cola1, b.e[12]);
col4 = vmlaq_n_f32(col4, cola2, b.e[13]);
col4 = vmlaq_n_f32(col4, cola3, b.e[14]);
col4 = vmlaq_n_f32(col4, cola4, b.e[15]);
vst1q_f32(&t[0], col1);
vst1q_f32(&t[4], col2);
vst1q_f32(&t[8], col3);
vst1q_f32(&t[12], col4);
#else
t[0] = (a.e[0]*b.e[0]) + (a.e[4]*b.e[1]) + (a.e[8]*b.e[2]) + (a.e[12]*b.e[3]);
@@ -22,4 +22,3 @@
// See the header
template class std::vector<std::string>;
template decltype(std::vector<std::string>().emplace_back("")) std::vector<std::string>::emplace_back<const char *const&>(const char *const&);
-1
View File
@@ -30,7 +30,6 @@
// getNames(), we end up with multiple copies in the object files. This
// declaration means we only emit it once (in StringMap.cpp).
extern template class std::vector<std::string>;
extern template decltype(std::vector<std::string>().emplace_back("")) std::vector<std::string>::emplace_back<const char *const&>(const char *const&);
namespace love
{
+3 -3
View File
@@ -123,14 +123,14 @@ bool openURL(const std::string &url)
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
jclass activity = env->FindClass("org/love2d/android/GameActivity");
jmethodID openURL= env->GetStaticMethodID(activity, "openURL", "(Ljava/lang/String;)V");
jmethodID openURL = env->GetStaticMethodID(activity, "openURL", "(Ljava/lang/String;)Z");
jstring url_jstring = (jstring) env->NewStringUTF(url.c_str());
env->CallStaticVoidMethod(activity, openURL, url_jstring);
jboolean result = env->CallStaticBooleanMethod(activity, openURL, url_jstring);
env->DeleteLocalRef(url_jstring);
env->DeleteLocalRef(activity);
return true;
return result;
}
void vibrate(double seconds)
+9
View File
@@ -879,4 +879,13 @@ Type *luax_type(lua_State *L, int idx)
return Type::byName(luaL_checkstring(L, idx));
}
int luax_resume(lua_State *L, int nargs)
{
#if LUA_VERSION_NUM >= 502
return lua_resume(L, nullptr, nargs);
#else
return lua_resume(L, nargs);
#endif
}
} // love
+6
View File
@@ -676,6 +676,12 @@ int luax_catchexcept(lua_State *L, const T& func, const F& finallyfunc)
return 0;
}
/**
* Compatibility shim for lua_resume
* Exported because it's used in the launcher
**/
LOVE_EXPORT int luax_resume(lua_State *L, int nargs);
} // love
#endif // LOVE_RUNTIME_H
+3 -3
View File
@@ -25,12 +25,12 @@ namespace love
{
// Version stuff.
#define LOVE_VERSION_STRING "11.1"
#define LOVE_VERSION_STRING "11.2"
static const int VERSION_MAJOR = 11;
static const int VERSION_MINOR = 1;
static const int VERSION_MINOR = 2;
static const int VERSION_REV = 0;
static const char *VERSION = LOVE_VERSION_STRING;
static const char *VERSION_COMPATIBILITY[] = { VERSION, "11.0", 0 };
static const char *VERSION_COMPATIBILITY[] = { VERSION, "11.0", "11.1", 0 };
static const char *VERSION_CODENAME = "Mysterious Mysteries";
} // love
@@ -566,7 +566,6 @@ char *__PHYSFS_platformCalcUserDir(void)
else
{
DWORD psize = 0;
WCHAR dummy = 0;
LPWSTR wstr = NULL;
BOOL rc = 0;
@@ -575,7 +574,14 @@ char *__PHYSFS_platformCalcUserDir(void)
* psize. Also note that the second parameter can't be
* NULL or the function fails.
*/
rc = pGetDir(accessToken, &dummy, &psize);
/*
* EDIT: (03.10.2018) after Windows 10 Update 1809 psize will be zero
* if something other than NULL is passed for the second argument.
* Passing NULL now makes GetUserProfileDirectoryW fail (rc == 0)
* and psize receives the correct user directory length.
* It seems to work fine on Windows 7 and Windows 10 Update 1803 too
*/
rc = pGetDir(accessToken, NULL, &psize);
GOTO_IF(rc, PHYSFS_ERR_OS_ERROR, done); /* should have failed! */
/* Allocate memory for the profile directory */
+2 -1
View File
@@ -19,6 +19,7 @@
**/
#include "common/version.h"
#include "common/runtime.h"
#include "modules/love/love.h"
#include <SDL.h>
@@ -214,7 +215,7 @@ static DoneAction runlove(int argc, char **argv, int &retval)
lua_newthread(L);
lua_pushvalue(L, -2);
int stackpos = lua_gettop(L);
while (lua_resume(L, 0) == LUA_YIELD)
while (love::luax_resume(L, 0) == LUA_YIELD)
lua_pop(L, lua_gettop(L) - stackpos);
retval = 0;
@@ -338,6 +338,13 @@ int w_Source_setAirAbsorption(lua_State *L)
return 0;
}
int w_Source_getAirAbsorption(lua_State *L)
{
Source *t = luax_checksource(L, 1);
luax_catchexcept(L, [&](){ lua_pushnumber(L, t->getAirAbsorptionFactor()); });
return 1;
}
int w_Source_getChannelCount(lua_State *L)
{
Source *t = luax_checksource(L, 1);
@@ -628,6 +635,8 @@ static const luaL_Reg w_Source_functions[] =
{ "getAttenuationDistances", w_Source_getAttenuationDistances },
{ "setRolloff", w_Source_setRolloff },
{ "getRolloff", w_Source_getRolloff },
{ "setAirAbsorption", w_Source_setAirAbsorption },
{ "getAirAbsorption", w_Source_getAirAbsorption },
{ "getChannelCount", w_Source_getChannelCount },
@@ -171,7 +171,7 @@ int w_decompress(lua_State *L)
if (luax_istype(L, 3, Data::type))
{
Data *data = luax_checktype<Data>(L, 2);
Data *data = luax_checktype<Data>(L, 3);
cbytes = (const char *) data->getData();
compressedsize = data->getSize();
}
@@ -28,6 +28,7 @@ namespace graphics
StreamBuffer::StreamBuffer(BufferType mode, size_t size)
: bufferSize(size)
, frameGPUReadOffset(0)
, mode(mode)
{
}
@@ -54,8 +54,8 @@ public:
size_t getSize() const { return bufferSize; }
BufferType getMode() const { return mode; }
size_t getUsableSize() const { return bufferSize - frameGPUReadOffset; }
virtual size_t getUsableSize() const = 0;
virtual MapInfo map(size_t minsize) = 0;
virtual size_t unmap(size_t usedsize) = 0;
virtual void markUsed(size_t usedsize) = 0;
@@ -67,6 +67,7 @@ protected:
StreamBuffer(BufferType mode, size_t size);
size_t bufferSize;
size_t frameGPUReadOffset;
BufferType mode;
}; // StreamBuffer
@@ -38,7 +38,7 @@ class FenceSync
{
public:
FenceSync() {}
FenceSync() : sync(0) {}
~FenceSync();
bool fence();
@@ -148,6 +148,7 @@ void Shader::mapActiveUniforms()
if (oldu != olduniforms.end())
{
u.data = oldu->second.data;
u.dataSize = oldu->second.dataSize;
u.textures = oldu->second.textures;
updateUniform(&u, u.count, true);
@@ -62,11 +62,6 @@ public:
delete[] data;
}
size_t getUsableSize() const override
{
return bufferSize;
}
MapInfo map(size_t /*minsize*/) override
{
return MapInfo(data, bufferSize);
@@ -96,7 +91,6 @@ public:
, glMode(OpenGL::getGLBufferType(mode))
, data(nullptr)
, offset(0)
, frameOffset(0)
{
try
{
@@ -116,17 +110,12 @@ public:
delete[] data;
}
size_t getUsableSize() const override
{
return bufferSize - frameOffset;
}
MapInfo map(size_t minsize) override
{
if (offset + minsize > bufferSize)
{
offset = 0;
frameOffset = 0;
frameGPUReadOffset = 0;
gl.bindBuffer(mode, vbo);
glBufferData(glMode, bufferSize, nullptr, GL_STREAM_DRAW);
}
@@ -144,12 +133,12 @@ public:
void markUsed(size_t usedsize) override
{
offset += usedsize;
frameOffset += usedsize;
frameGPUReadOffset += usedsize;
}
void nextFrame() override
{
frameOffset = 0;
frameGPUReadOffset = 0;
}
ptrdiff_t getHandle() const override { return vbo; }
@@ -164,7 +153,7 @@ public:
glBufferData(glMode, bufferSize, nullptr, GL_STREAM_DRAW);
offset = 0;
frameOffset = 0;
frameGPUReadOffset = 0;
return true;
}
@@ -186,7 +175,6 @@ protected:
uint8 *data;
size_t offset;
size_t frameOffset;
}; // StreamBufferSubDataOrphan
@@ -198,7 +186,6 @@ public:
: love::graphics::StreamBuffer(type, size)
, syncSize((size + MAX_SYNCS_PER_FRAME - 1) / MAX_SYNCS_PER_FRAME)
, frameIndex(0)
, frameGPUReadOffset(0)
, syncs()
{}
@@ -231,7 +218,6 @@ protected:
const size_t syncSize;
int frameIndex;
size_t frameGPUReadOffset;
FenceSync syncs[MAX_SYNCS_PER_FRAME * BUFFER_FRAMES];
@@ -259,11 +245,6 @@ public:
unloadVolatile();
}
size_t getUsableSize() const override
{
return bufferSize - frameGPUReadOffset;
}
MapInfo map(size_t /*minsize*/) override
{
gl.bindBuffer(mode, vbo);
@@ -351,11 +332,6 @@ public:
unloadVolatile();
}
size_t getUsableSize() const override
{
return bufferSize - frameGPUReadOffset;
}
MapInfo map(size_t /*minsize*/) override
{
MapInfo info;
@@ -454,11 +430,6 @@ public:
alignedFree(data);
}
size_t getUsableSize() const override
{
return bufferSize - frameGPUReadOffset;
}
MapInfo map(size_t /*minsize*/) override
{
MapInfo info;
@@ -290,7 +290,7 @@ int w_setCanvas(lua_State *L)
targets.colors.emplace_back(luax_checkcanvas(L, -1), 0);
if (targets.colors.back().canvas->getTextureType() != TEXTURE_2D)
return luaL_error(L, "The table-of-tables variant of setCanvas must be used with non-2D Canvases.");
return luaL_error(L, "Non-2D canvases must use the table-of-tables variant of setCanvas.");
}
lua_pop(L, 1);
@@ -356,7 +356,7 @@ void JoystickModule::checkGamepads(const std::string &guid) const
for (auto stick : activeSticks)
{
if (stick->isGamepad() || guid.compare(stick->getGUID()) != 0)
if (guid.compare(stick->getGUID()) != 0)
continue;
// Big hack time: open the index as a game controller and compare
@@ -365,12 +365,15 @@ void JoystickModule::checkGamepads(const std::string &guid) const
if (controller == nullptr)
continue;
// GameController objects are reference-counted in SDL, so we don't want to
// have a joystick open when trying to re-initialize it
SDL_Joystick *sdlstick = SDL_GameControllerGetJoystick(controller);
if (sdlstick == (SDL_Joystick *) stick->getHandle())
stick->openGamepad(d_index);
// GameController objects are reference-counted in SDL.
bool open_gamepad = (sdlstick == (SDL_Joystick *) stick->getHandle());
SDL_GameControllerClose(controller);
// open as gamepad if necessary
if (open_gamepad)
stick->openGamepad(d_index);
}
}
}
@@ -57,6 +57,9 @@ const char *Mouse::getName() const
Mouse::Mouse()
: curCursor(nullptr)
{
// SDL may need the video subsystem in order to clean up the cursor when
// quitting. Subsystems are reference-counted.
SDL_InitSubSystem(SDL_INIT_VIDEO);
}
Mouse::~Mouse()
@@ -66,6 +69,8 @@ Mouse::~Mouse()
for (auto &c : systemCursors)
c.second->release();
SDL_QuitSubSystem(SDL_INIT_VIDEO);
}
love::mouse::Cursor *Mouse::newCursor(love::image::ImageData *data, int hotx, int hoty)
@@ -69,6 +69,19 @@ int w_Body_getPosition(lua_State *L)
return 2;
}
int w_Body_getTransform(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
float x_o, y_o;
t->getPosition(x_o, y_o);
lua_pushnumber(L, x_o);
lua_pushnumber(L, y_o);
lua_pushnumber(L, t->getAngle());
return 3;
}
int w_Body_getLinearVelocity(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
@@ -253,6 +266,19 @@ int w_Body_setY(lua_State *L)
return 0;
}
int w_Body_setTransform(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
float x = (float)luaL_checknumber(L, 2);
float y = (float)luaL_checknumber(L, 3);
float angle = (float)luaL_checknumber(L, 4);
luax_catchexcept(L, [&](){
t->setPosition(x, y);
t->setAngle(angle);
});
return 0;
}
int w_Body_setLinearVelocity(lua_State *L)
{
Body *t = luax_checkbody(L, 1);
@@ -617,6 +643,8 @@ static const luaL_Reg w_Body_functions[] =
{ "getY", w_Body_getY },
{ "getAngle", w_Body_getAngle },
{ "getPosition", w_Body_getPosition },
{ "getTransform", w_Body_getTransform },
{ "setTransform", w_Body_setTransform },
{ "getLinearVelocity", w_Body_getLinearVelocity },
{ "getWorldCenter", w_Body_getWorldCenter },
{ "getLocalCenter", w_Body_getLocalCenter },