mirror of
https://github.com/love2d/love-android.git
synced 2026-08-13 09:01:07 +02:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ac43aa717 | |||
| 7fbf155d82 | |||
| 3df1807c6f |
+5
-5
@@ -1,14 +1,14 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 25
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "26.0.2"
|
||||
defaultConfig {
|
||||
applicationId "org.love2d.android"
|
||||
versionCode 24
|
||||
versionName "11.0.0"
|
||||
versionCode 26
|
||||
versionName "11.1"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 25
|
||||
targetSdkVersion 22
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
@@ -24,6 +24,6 @@ android {
|
||||
dependencies {
|
||||
compile 'com.android.support:multidex:1.0.1'
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:25.1.0'
|
||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
||||
compile project(':love')
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<service android:name="org.love2d.android.DownloadService" />
|
||||
<activity
|
||||
android:name="org.love2d.android.GameActivity"
|
||||
android:configChanges="orientation|screenSize"
|
||||
android:configChanges="orientation|screenSize|keyboard|keyboardHidden|navigation"
|
||||
android:label="LÖVE for Android"
|
||||
android:launchMode="singleTop"
|
||||
android:screenOrientation="landscape" >
|
||||
|
||||
+3
-3
@@ -6,11 +6,11 @@ android {
|
||||
// See https://code.google.com/p/android/issues/detail?id=52962
|
||||
// and http://stackoverflow.com/questions/27277433/why-does-gradle-build-my-module-in-release-mode-when-the-app-is-in-debug
|
||||
// defaultPublishConfig "debug"
|
||||
compileSdkVersion 25
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "26.0.2"
|
||||
|
||||
defaultConfig {
|
||||
compileSdkVersion 25
|
||||
compileSdkVersion 22
|
||||
buildToolsVersion "26.0.2"
|
||||
minSdkVersion 14
|
||||
externalNativeBuild {
|
||||
@@ -49,5 +49,5 @@ android {
|
||||
|
||||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
compile 'com.android.support:appcompat-v7:25.1.0'
|
||||
compile 'com.android.support:appcompat-v7:22.2.0'
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
repo: d362ae6ab7f5005b8dbc7cba9ce592637de60f99
|
||||
node: 6504209dc45bbd317a663c02db084a703b9d42c5
|
||||
node: 0ab246b5045d2e697a516fcc0f8b12496a2d5c78
|
||||
branch: default
|
||||
latesttag: 11.0
|
||||
latesttagdistance: 1
|
||||
changessincelatesttag: 1
|
||||
tag: 11.1
|
||||
|
||||
@@ -1853,7 +1853,7 @@ set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/readme.md")
|
||||
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
|
||||
|
||||
set(CPACK_NSIS_EXECUTABLES_DIRECTORY .)
|
||||
set(CPACK_NSIS_PACKAGE_NAME "LÖVE")
|
||||
set(CPACK_NSIS_PACKAGE_NAME "LOVE")
|
||||
set(CPACK_NSIS_DISPLAY_NAME "LOVE ${LOVE_VERSION_STR}")
|
||||
set(CPACK_NSIS_MODIFY_PATH OFF)
|
||||
|
||||
@@ -1874,7 +1874,7 @@ set(NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\love.ico")
|
||||
set(NSIS_MUI_UNICON "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\love.ico")
|
||||
|
||||
set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "
|
||||
!define MUI_WELCOMEPAGE_TITLE \\\"LÖVE ${LOVE_VERSION_STR} Setup\\\"
|
||||
!define MUI_WELCOMEPAGE_TITLE \\\"LOVE ${LOVE_VERSION_STR} Setup\\\"
|
||||
!define MUI_WELCOMEFINISHPAGE_BITMAP \\\"${NSIS_LEFT_BMP}\\\"
|
||||
!define MUI_HEADERIMAGE_BITMAP \\\"${NSIS_TOP_BMP}\\\"
|
||||
!define MUI_ICON \\\"${NSIS_MUI_ICON}\\\"
|
||||
|
||||
@@ -1,5 +1,19 @@
|
||||
LOVE 11.1 [Mysterious Mysteries]
|
||||
--------------------------------
|
||||
|
||||
Released: 2018-04-15
|
||||
|
||||
* Fixed love.graphics.setCanvas failing randomly.
|
||||
* Fixed love.graphics.clear(colortable) when no Canvas is active.
|
||||
* Fixed stencil and depth support on older phones.
|
||||
* Fixed love.event.quit causing crashes and other unexpected behaviour if a Canvas is active.
|
||||
* Fixed Fixture:getShape crashing when returning a ChainShape.
|
||||
* Fixed love.joystick.loadJoystickMappings outputting a deprecation warning about love.filesystem.isFile.
|
||||
* Fixed Source:queue to show the correct argument name in the error message when an invalid data parameter is given.
|
||||
* Fixed t.console=true causing an error on Windows if lovec.exe is used.
|
||||
|
||||
LOVE 11.0 [Mysterious Mysteries]
|
||||
--------------
|
||||
--------------------------------
|
||||
|
||||
Released: 2018-04-01
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version: 11.0.{build}
|
||||
version: 11.1.{build}
|
||||
|
||||
image: Visual Studio 2013
|
||||
|
||||
|
||||
Binary file not shown.
@@ -1,4 +1,4 @@
|
||||
AC_INIT([love], [11.0])
|
||||
AC_INIT([love], [11.1])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_AUX_DIR([platform/unix])
|
||||
AC_CONFIG_MACRO_DIR([platform/unix/m4])
|
||||
|
||||
@@ -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.0
|
||||
.Os LÖVE 11.1
|
||||
.Sh NAME
|
||||
.Nm love
|
||||
.Nd 2D game development framework
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>11.0</string>
|
||||
<string>11.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
A9255F58104324E100BA1496 /* ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255F51104324D700BA1496 /* ogg.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
A93E6E5510420B57007D418B /* Lua.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5310420B57007D418B /* Lua.framework */; };
|
||||
A93E6EED10420BA8007D418B /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A3410420AC0007D418B /* love.cpp */; };
|
||||
A9D307F2106635D3004FEDF8 /* physfs.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9D307E9106635C3004FEDF8 /* physfs.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
A9F169AC109E825000FC83D1 /* mpg123.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F169A6109E824900FC83D1 /* mpg123.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F16926109E7BAD00FC83D1 /* libmodplug.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
CE73F8001EEB64150052DAB3 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */; };
|
||||
@@ -42,6 +41,7 @@
|
||||
FAC1A449196F5DC600125284 /* license.txt in Resources */ = {isa = PBXBuildFile; fileRef = FAC1A448196F5DC600125284 /* license.txt */; };
|
||||
FAD43ED01FF3136500831BB8 /* freetype.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FAD43ECF1FF3133700831BB8 /* freetype.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; };
|
||||
FAD4B1731C1F50A3004CF150 /* theora.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA27B3CA1B498696008A9DCE /* theora.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
|
||||
FAE64A9D2072738600BC7981 /* Metal.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FAE64A9C2072738600BC7981 /* Metal.framework */; settings = {ATTRIBUTES = (Weak, ); }; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXContainerItemProxy section */
|
||||
@@ -89,7 +89,6 @@
|
||||
FAD43ED01FF3136500831BB8 /* freetype.framework in Copy Frameworks */,
|
||||
A9F169AC109E825000FC83D1 /* mpg123.framework in Copy Frameworks */,
|
||||
A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */,
|
||||
A9D307F2106635D3004FEDF8 /* physfs.framework in Copy Frameworks */,
|
||||
A9255F58104324E100BA1496 /* ogg.framework in Copy Frameworks */,
|
||||
A9255E031043195A00BA1496 /* vorbis.framework in Copy Frameworks */,
|
||||
A9255DD31043183600BA1496 /* Lua.framework in Copy Frameworks */,
|
||||
@@ -108,7 +107,6 @@
|
||||
A93E6E4710420B4A007D418B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
|
||||
A93E6E5310420B57007D418B /* Lua.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lua.framework; path = /Library/Frameworks/Lua.framework; sourceTree = "<absolute>"; };
|
||||
A97E3842132A9EDE00198A2F /* love-macosx.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "love-macosx.plist"; path = "macosx/love-macosx.plist"; sourceTree = "<group>"; };
|
||||
A9D307E9106635C3004FEDF8 /* physfs.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = physfs.framework; path = /Library/Frameworks/physfs.framework; sourceTree = "<absolute>"; };
|
||||
A9F16926109E7BAD00FC83D1 /* libmodplug.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = libmodplug.framework; path = /Library/Frameworks/libmodplug.framework; sourceTree = "<absolute>"; };
|
||||
A9F169A6109E824900FC83D1 /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = /Library/Frameworks/mpg123.framework; sourceTree = "<absolute>"; };
|
||||
CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/AVFoundation.framework; sourceTree = DEVELOPER_DIR; };
|
||||
@@ -134,6 +132,7 @@
|
||||
FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = "<absolute>"; };
|
||||
FAC1A448196F5DC600125284 /* license.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = license.txt; path = ../../license.txt; sourceTree = "<group>"; };
|
||||
FAD43ECF1FF3133700831BB8 /* freetype.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = freetype.framework; path = /Library/Frameworks/freetype.framework; sourceTree = "<absolute>"; };
|
||||
FAE64A9C2072738600BC7981 /* Metal.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Metal.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.2.sdk/System/Library/Frameworks/Metal.framework; sourceTree = DEVELOPER_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
@@ -153,6 +152,7 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
FAE64A9D2072738600BC7981 /* Metal.framework in Frameworks */,
|
||||
FA15DFB41F9B8D9E0042AB22 /* libbz2.tbd in Frameworks */,
|
||||
CE73F8001EEB64150052DAB3 /* AVFoundation.framework in Frameworks */,
|
||||
FA5D24D11A96E73300C6FC8F /* liblove.a in Frameworks */,
|
||||
@@ -175,6 +175,7 @@
|
||||
1058C7A0FEA54F0111CA2CBB /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
FAE64A9C2072738600BC7981 /* Metal.framework */,
|
||||
FA15DFB31F9B8D9E0042AB22 /* libbz2.tbd */,
|
||||
CE73F7FF1EEB64150052DAB3 /* AVFoundation.framework */,
|
||||
FA5D24801A96C97900C6FC8F /* ios */,
|
||||
@@ -236,7 +237,6 @@
|
||||
A9255F51104324D700BA1496 /* ogg.framework */,
|
||||
FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */,
|
||||
A93E6E4710420B4A007D418B /* OpenGL.framework */,
|
||||
A9D307E9106635C3004FEDF8 /* physfs.framework */,
|
||||
FA9B4A0916E1579F00074F42 /* SDL2.framework */,
|
||||
FA27B3CA1B498696008A9DCE /* theora.framework */,
|
||||
A9255E021043195A00BA1496 /* vorbis.framework */,
|
||||
@@ -667,6 +667,10 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
"DEBUG=1",
|
||||
@@ -715,6 +719,10 @@
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
@@ -758,6 +766,10 @@
|
||||
ENABLE_BITCODE = NO;
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(PROJECT_DIR)",
|
||||
);
|
||||
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
|
||||
GCC_WARN_UNDECLARED_SELECTOR = YES;
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>11.0</string>
|
||||
<string>11.1</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.0</string>
|
||||
<string>11.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>LoVe</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
|
||||
@@ -25,12 +25,12 @@ namespace love
|
||||
{
|
||||
|
||||
// Version stuff.
|
||||
#define LOVE_VERSION_STRING "11.0"
|
||||
#define LOVE_VERSION_STRING "11.1"
|
||||
static const int VERSION_MAJOR = 11;
|
||||
static const int VERSION_MINOR = 0;
|
||||
static const int VERSION_MINOR = 1;
|
||||
static const int VERSION_REV = 0;
|
||||
static const char *VERSION = LOVE_VERSION_STRING;
|
||||
static const char *VERSION_COMPATIBILITY[] = { VERSION, 0 };
|
||||
static const char *VERSION_COMPATIBILITY[] = { VERSION, "11.0", 0 };
|
||||
static const char *VERSION_CODENAME = "Mysterious Mysteries";
|
||||
|
||||
} // love
|
||||
|
||||
@@ -564,7 +564,7 @@ int w_Source_queue(lua_State *L)
|
||||
});
|
||||
}
|
||||
else
|
||||
return luax_typerror(L, 1, "Sound Data or lightuserdata");
|
||||
return luax_typerror(L, 2, "SoundData or lightuserdata");
|
||||
|
||||
luax_pushboolean(L, success);
|
||||
return 1;
|
||||
|
||||
@@ -628,6 +628,7 @@ void Graphics::setCanvas(const RenderTargets &rts)
|
||||
bool hasSRGBcanvas = firstcolorformat == PIXELFORMAT_sRGBA8;
|
||||
int pixelw = firstcanvas->getPixelWidth(firsttarget.mipmap);
|
||||
int pixelh = firstcanvas->getPixelHeight(firsttarget.mipmap);
|
||||
int reqmsaa = firstcanvas->getRequestedMSAA();
|
||||
|
||||
for (int i = 1; i < ncanvases; i++)
|
||||
{
|
||||
@@ -648,7 +649,7 @@ void Graphics::setCanvas(const RenderTargets &rts)
|
||||
if (!multiformatsupported && format != firstcolorformat)
|
||||
throw love::Exception("This system doesn't support multi-canvas rendering with different canvas formats.");
|
||||
|
||||
if (c->getRequestedMSAA() != firstcanvas->getRequestedMSAA())
|
||||
if (c->getRequestedMSAA() != reqmsaa)
|
||||
throw love::Exception("All Canvases must have the same MSAA value.");
|
||||
|
||||
if (isPixelFormatDepthStencil(format))
|
||||
@@ -684,7 +685,33 @@ void Graphics::setCanvas(const RenderTargets &rts)
|
||||
int h = firstcanvas->getHeight(firsttarget.mipmap);
|
||||
|
||||
flushStreamDraws();
|
||||
setCanvasInternal(rts, w, h, pixelw, pixelh, hasSRGBcanvas);
|
||||
|
||||
if (rts.depthStencil.canvas == nullptr && rts.temporaryRTFlags != 0)
|
||||
{
|
||||
bool wantsdepth = (rts.temporaryRTFlags & TEMPORARY_RT_DEPTH) != 0;
|
||||
bool wantsstencil = (rts.temporaryRTFlags & TEMPORARY_RT_STENCIL) != 0;
|
||||
|
||||
PixelFormat dsformat = PIXELFORMAT_STENCIL8;
|
||||
if (wantsdepth && wantsstencil)
|
||||
dsformat = PIXELFORMAT_DEPTH24_STENCIL8;
|
||||
else if (wantsdepth && isCanvasFormatSupported(PIXELFORMAT_DEPTH24, false))
|
||||
dsformat = PIXELFORMAT_DEPTH24;
|
||||
else if (wantsdepth)
|
||||
dsformat = PIXELFORMAT_DEPTH16;
|
||||
else if (wantsstencil)
|
||||
dsformat = PIXELFORMAT_STENCIL8;
|
||||
|
||||
// We want setCanvasInternal to have a pointer to the temporary RT, but
|
||||
// we don't want to directly store it in the main graphics state.
|
||||
RenderTargets realRTs = rts;
|
||||
|
||||
realRTs.depthStencil.canvas = getTemporaryCanvas(dsformat, pixelw, pixelh, reqmsaa);
|
||||
realRTs.depthStencil.slice = 0;
|
||||
|
||||
setCanvasInternal(realRTs, w, h, pixelw, pixelh, hasSRGBcanvas);
|
||||
}
|
||||
else
|
||||
setCanvasInternal(rts, w, h, pixelw, pixelh, hasSRGBcanvas);
|
||||
|
||||
RenderTargetsStrongRef refs;
|
||||
refs.colors.reserve(rts.colors.size());
|
||||
|
||||
@@ -422,6 +422,24 @@ public:
|
||||
{
|
||||
return colors.empty() ? depthStencil : colors[0];
|
||||
}
|
||||
|
||||
bool operator == (const RenderTargets &other) const
|
||||
{
|
||||
size_t ncolors = colors.size();
|
||||
if (ncolors != other.colors.size())
|
||||
return false;
|
||||
|
||||
for (size_t i = 0; i < ncolors; i++)
|
||||
{
|
||||
if (colors[i] != other.colors[i])
|
||||
return false;
|
||||
}
|
||||
|
||||
if (depthStencil != other.depthStencil || temporaryRTFlags != other.temporaryRTFlags)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
struct RenderTargetsStrongRef
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
|
||||
#include "Canvas.h"
|
||||
#include "graphics/Graphics.h"
|
||||
#include "Graphics.h"
|
||||
|
||||
#include <algorithm> // For min/max
|
||||
|
||||
@@ -270,6 +271,15 @@ bool Canvas::loadVolatile()
|
||||
|
||||
void Canvas::unloadVolatile()
|
||||
{
|
||||
if (fbo != 0 || renderbuffer != 0 || texture != 0)
|
||||
{
|
||||
// This is a bit ugly, but we need some way to destroy the cached FBO
|
||||
// when this Canvas' texture is destroyed.
|
||||
auto gfx = Module::getInstance<Graphics>(Module::M_GRAPHICS);
|
||||
if (gfx != nullptr)
|
||||
gfx->cleanupCanvas(this);
|
||||
}
|
||||
|
||||
if (fbo != 0)
|
||||
gl.deleteFramebuffer(fbo);
|
||||
|
||||
@@ -503,6 +513,18 @@ bool Canvas::isFormatSupported(PixelFormat format, bool readable)
|
||||
GLuint texture = 0;
|
||||
GLuint renderbuffer = 0;
|
||||
|
||||
// Avoid the test for depth/stencil formats - not every GL version
|
||||
// guarantees support for depth/stencil-only render targets (which we would
|
||||
// need for the test below to work), and we already do some finagling in
|
||||
// convertPixelFormat to try to use the best-supported internal
|
||||
// depth/stencil format for a particular driver.
|
||||
if (isPixelFormatDepthStencil(format))
|
||||
{
|
||||
checkedFormats[format].set(readable, true);
|
||||
supportedFormats[format].set(readable, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool unusedSRGB = false;
|
||||
OpenGL::TextureFormat fmt = OpenGL::convertPixelFormat(format, readable, unusedSRGB);
|
||||
|
||||
|
||||
@@ -642,7 +642,7 @@ void Graphics::clear(const std::vector<OptionalColorf> &colors, OptionalInt sten
|
||||
return;
|
||||
|
||||
int ncolorcanvases = (int) states.back().renderTargets.colors.size();
|
||||
int ncolors = std::min((int) colors.size(), ncolorcanvases);
|
||||
int ncolors = (int) colors.size();
|
||||
|
||||
if (ncolors <= 1 && ncolorcanvases <= 1)
|
||||
{
|
||||
@@ -653,6 +653,7 @@ void Graphics::clear(const std::vector<OptionalColorf> &colors, OptionalInt sten
|
||||
flushStreamDraws();
|
||||
|
||||
bool drawbuffersmodified = false;
|
||||
ncolors = std::min(ncolors, ncolorcanvases);
|
||||
|
||||
for (int i = 0; i < ncolors; i++)
|
||||
{
|
||||
@@ -779,21 +780,38 @@ void Graphics::discard(OpenGL::FramebufferTarget target, const std::vector<bool>
|
||||
glDiscardFramebufferEXT(gltarget, (GLint) attachments.size(), &attachments[0]);
|
||||
}
|
||||
|
||||
void Graphics::cleanupCanvas(Canvas *canvas)
|
||||
{
|
||||
for (auto it = framebufferObjects.begin(); it != framebufferObjects.end(); /**/)
|
||||
{
|
||||
bool hascanvas = false;
|
||||
const auto &rts = it->first;
|
||||
|
||||
for (const RenderTarget &rt : rts.colors)
|
||||
{
|
||||
if (rt.canvas == canvas)
|
||||
{
|
||||
hascanvas = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
hascanvas = hascanvas || rts.depthStencil.canvas == canvas;
|
||||
|
||||
if (hascanvas)
|
||||
{
|
||||
if (isCreated())
|
||||
gl.deleteFramebuffer(it->second);
|
||||
it = framebufferObjects.erase(it);
|
||||
}
|
||||
else
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
void Graphics::bindCachedFBO(const RenderTargets &targets)
|
||||
{
|
||||
RenderTarget hashtargets[MAX_COLOR_RENDER_TARGETS + 1];
|
||||
int hashcount = 0;
|
||||
|
||||
for (int i = 0; i < (int) targets.colors.size(); i++)
|
||||
hashtargets[hashcount++] = targets.colors[i];
|
||||
|
||||
if (targets.depthStencil.canvas != nullptr)
|
||||
hashtargets[hashcount++] = targets.depthStencil;
|
||||
else if (targets.temporaryRTFlags != 0)
|
||||
hashtargets[hashcount++] = RenderTarget(nullptr, -1, targets.temporaryRTFlags);
|
||||
|
||||
uint32 hash = XXH32(hashtargets, sizeof(RenderTarget) * hashcount, 0);
|
||||
GLuint fbo = framebufferObjects[hash];
|
||||
GLuint fbo = framebufferObjects[targets];
|
||||
|
||||
if (fbo != 0)
|
||||
{
|
||||
@@ -801,34 +819,7 @@ void Graphics::bindCachedFBO(const RenderTargets &targets)
|
||||
}
|
||||
else
|
||||
{
|
||||
RenderTarget firstRT = targets.getFirstTarget();
|
||||
|
||||
int mip = firstRT.mipmap;
|
||||
int w = firstRT.canvas->getPixelWidth(mip);
|
||||
int h = firstRT.canvas->getPixelHeight(mip);
|
||||
int msaa = firstRT.canvas->getMSAA();
|
||||
int reqmsaa = firstRT.canvas->getRequestedMSAA();
|
||||
|
||||
RenderTarget depthstencil = targets.depthStencil;
|
||||
|
||||
if (depthstencil.canvas == nullptr && targets.temporaryRTFlags != 0)
|
||||
{
|
||||
bool wantsdepth = (targets.temporaryRTFlags & TEMPORARY_RT_DEPTH) != 0;
|
||||
bool wantsstencil = (targets.temporaryRTFlags & TEMPORARY_RT_STENCIL) != 0;
|
||||
|
||||
PixelFormat dsformat = PIXELFORMAT_STENCIL8;
|
||||
if (wantsdepth && wantsstencil)
|
||||
dsformat = PIXELFORMAT_DEPTH24_STENCIL8;
|
||||
else if (wantsdepth && isCanvasFormatSupported(PIXELFORMAT_DEPTH24, false))
|
||||
dsformat = PIXELFORMAT_DEPTH24;
|
||||
else if (wantsdepth)
|
||||
dsformat = PIXELFORMAT_DEPTH16;
|
||||
else if (wantsstencil)
|
||||
dsformat = PIXELFORMAT_STENCIL8;
|
||||
|
||||
depthstencil.canvas = getTemporaryCanvas(dsformat, w, h, reqmsaa);
|
||||
depthstencil.slice = 0;
|
||||
}
|
||||
int msaa = targets.getFirstTarget().canvas->getMSAA();
|
||||
|
||||
glGenFramebuffers(1, &fbo);
|
||||
gl.bindFramebuffer(OpenGL::FRAMEBUFFER_ALL, fbo);
|
||||
@@ -873,8 +864,8 @@ void Graphics::bindCachedFBO(const RenderTargets &targets)
|
||||
for (const auto &rt : targets.colors)
|
||||
attachCanvas(rt);
|
||||
|
||||
if (depthstencil.canvas != nullptr)
|
||||
attachCanvas(depthstencil);
|
||||
if (targets.depthStencil.canvas != nullptr)
|
||||
attachCanvas(targets.depthStencil);
|
||||
|
||||
if (ncolortargets > 1)
|
||||
glDrawBuffers(ncolortargets, drawbuffers);
|
||||
@@ -887,8 +878,8 @@ void Graphics::bindCachedFBO(const RenderTargets &targets)
|
||||
const char *sstr = OpenGL::framebufferStatusString(status);
|
||||
throw love::Exception("Could not create Framebuffer Object! %s", sstr);
|
||||
}
|
||||
|
||||
framebufferObjects[hash] = fbo;
|
||||
|
||||
framebufferObjects[targets] = fbo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,8 @@
|
||||
#include "Canvas.h"
|
||||
#include "Shader.h"
|
||||
|
||||
#include "libraries/xxHash/xxhash.h"
|
||||
|
||||
namespace love
|
||||
{
|
||||
|
||||
@@ -110,8 +112,30 @@ public:
|
||||
|
||||
Shader::Language getShaderLanguageTarget() const override;
|
||||
|
||||
// Internal use.
|
||||
void cleanupCanvas(Canvas *canvas);
|
||||
|
||||
private:
|
||||
|
||||
struct CachedFBOHasher
|
||||
{
|
||||
size_t operator() (const RenderTargets &rts) const
|
||||
{
|
||||
RenderTarget hashtargets[MAX_COLOR_RENDER_TARGETS + 1];
|
||||
int hashcount = 0;
|
||||
|
||||
for (size_t i = 0; i < rts.colors.size(); i++)
|
||||
hashtargets[hashcount++] = rts.colors[i];
|
||||
|
||||
if (rts.depthStencil.canvas != nullptr)
|
||||
hashtargets[hashcount++] = rts.depthStencil;
|
||||
else if (rts.temporaryRTFlags != 0)
|
||||
hashtargets[hashcount++] = RenderTarget(nullptr, -1, rts.temporaryRTFlags);
|
||||
|
||||
return XXH32(hashtargets, sizeof(RenderTarget) * hashcount, 0);
|
||||
}
|
||||
};
|
||||
|
||||
love::graphics::ShaderStage *newShaderStageInternal(ShaderStage::StageType stage, const std::string &cachekey, const std::string &source, bool gles) override;
|
||||
love::graphics::Shader *newShaderInternal(love::graphics::ShaderStage *vertex, love::graphics::ShaderStage *pixel) override;
|
||||
love::graphics::StreamBuffer *newStreamBuffer(BufferType type, size_t size) override;
|
||||
@@ -125,7 +149,7 @@ private:
|
||||
|
||||
void setDebug(bool enable);
|
||||
|
||||
std::unordered_map<uint32, GLuint> framebufferObjects;
|
||||
std::unordered_map<RenderTargets, GLuint, CachedFBOHasher> framebufferObjects;
|
||||
bool windowHasStencil;
|
||||
GLuint mainVAO;
|
||||
|
||||
|
||||
@@ -705,7 +705,7 @@ void OpenGL::setVertexAttributes(const vertex::Attributes &attributes, const ver
|
||||
GLboolean normalized = GL_FALSE;
|
||||
GLenum gltype = getGLVertexDataType(attrib.type, normalized);
|
||||
|
||||
const void *offsetpointer = BUFFER_OFFSET(bufferinfo.offset + attrib.offsetfromvertex);
|
||||
const void *offsetpointer = reinterpret_cast<void*>(bufferinfo.offset + attrib.offsetfromvertex);
|
||||
|
||||
bindBuffer(BUFFER_VERTEX, (GLuint) bufferinfo.buffer->getHandle());
|
||||
glVertexAttribPointer(i, attrib.components, gltype, normalized, attrib.stride, offsetpointer);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "wrap_JoystickModule.h"
|
||||
#include "wrap_Joystick.h"
|
||||
|
||||
#include "filesystem/Filesystem.h"
|
||||
#include "filesystem/wrap_Filesystem.h"
|
||||
|
||||
#include "sdl/JoystickModule.h"
|
||||
@@ -116,15 +117,15 @@ int w_setGamepadMapping(lua_State *L)
|
||||
|
||||
int w_loadGamepadMappings(lua_State *L)
|
||||
{
|
||||
bool isfile = true;
|
||||
std::string mappings;
|
||||
bool isfile = false;
|
||||
std::string mappings = luax_checkstring(L, 1);
|
||||
|
||||
if (lua_isstring(L, 1))
|
||||
auto fs = Module::getInstance<love::filesystem::Filesystem>(Module::M_FILESYSTEM);
|
||||
if (fs)
|
||||
{
|
||||
lua_pushvalue(L, 1);
|
||||
luax_convobj(L, -1, "filesystem", "isFile");
|
||||
isfile = luax_toboolean(L, -1);
|
||||
lua_pop(L, 1);
|
||||
love::filesystem::Filesystem::Info info = {};
|
||||
bool exists = fs->getInfo(mappings.c_str(), info);
|
||||
isfile = exists && info.type == love::filesystem::Filesystem::FILETYPE_FILE;
|
||||
}
|
||||
|
||||
if (isfile)
|
||||
@@ -132,7 +133,6 @@ int w_loadGamepadMappings(lua_State *L)
|
||||
love::filesystem::FileData *fd = love::filesystem::luax_getfiledata(L, 1);
|
||||
mappings = std::string((const char *) fd->getData(), fd->getSize());
|
||||
fd->release();
|
||||
|
||||
}
|
||||
else
|
||||
mappings = luax_checkstring(L, 1);
|
||||
|
||||
@@ -439,22 +439,6 @@ int luaopen_love(lua_State *L)
|
||||
|
||||
#ifdef LOVE_LEGENDARY_CONSOLE_IO_HACK
|
||||
|
||||
// Mostly taken from the Windows 8.1 SDK's VersionHelpers.h.
|
||||
static bool IsWindowsVistaOrGreater()
|
||||
{
|
||||
OSVERSIONINFOEXW osvi = {sizeof(osvi), 0, 0, 0, 0, {0}, 0, 0};
|
||||
|
||||
osvi.dwMajorVersion = HIBYTE(_WIN32_WINNT_VISTA);
|
||||
osvi.dwMinorVersion = LOBYTE(_WIN32_WINNT_VISTA);
|
||||
osvi.wServicePackMajor = 0;
|
||||
|
||||
DWORDLONG majorversionmask = VerSetConditionMask(0, VER_MAJORVERSION, VER_GREATER_EQUAL);
|
||||
DWORDLONG versionmask = VerSetConditionMask(majorversionmask, VER_MINORVERSION, VER_GREATER_EQUAL);
|
||||
DWORDLONG mask = VerSetConditionMask(versionmask, VER_SERVICEPACKMAJOR, VER_GREATER_EQUAL);
|
||||
|
||||
return VerifyVersionInfoW(&osvi, VER_MAJORVERSION | VER_MINORVERSION | VER_SERVICEPACKMAJOR, mask) != FALSE;
|
||||
}
|
||||
|
||||
bool love_openConsole(const char *&err)
|
||||
{
|
||||
static bool is_open = false;
|
||||
@@ -465,11 +449,18 @@ bool love_openConsole(const char *&err)
|
||||
|
||||
is_open = true;
|
||||
|
||||
// FIXME: we don't call AttachConsole in Windows XP because it seems to
|
||||
// break later AllocConsole calls if it fails. A better workaround might be
|
||||
// possible, but it's hard to find a WinXP system to test on these days...
|
||||
if (!IsWindowsVistaOrGreater() || !AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
if (!AttachConsole(ATTACH_PARENT_PROCESS))
|
||||
{
|
||||
DWORD winerr = GetLastError();
|
||||
|
||||
if (winerr == ERROR_ACCESS_DENIED)
|
||||
{
|
||||
// The process is already attached to a console. We'll assume stdout
|
||||
// and friends are already being directed there.
|
||||
is_open = true;
|
||||
return is_open;
|
||||
}
|
||||
|
||||
// Create our own console if we can't attach to an existing one.
|
||||
if (!AllocConsole())
|
||||
{
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace box2d
|
||||
|
||||
love::Type ChainShape::type("ChainShape", &Shape::type);
|
||||
|
||||
ChainShape::ChainShape(b2ChainShape *c, bool loop, bool own)
|
||||
: Shape(c, own), loop(loop)
|
||||
ChainShape::ChainShape(b2ChainShape *c, bool own)
|
||||
: Shape(c, own)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -47,11 +47,6 @@ ChainShape::~ChainShape()
|
||||
|
||||
void ChainShape::setNextVertex(float x, float y)
|
||||
{
|
||||
if (loop)
|
||||
{
|
||||
throw love::Exception("Physics error: Can't call setNextVertex on a loop ChainShape");
|
||||
return;
|
||||
}
|
||||
b2Vec2 v(x, y);
|
||||
b2ChainShape *c = (b2ChainShape *)shape;
|
||||
c->SetNextVertex(Physics::scaleDown(v));
|
||||
@@ -65,11 +60,6 @@ void ChainShape::setNextVertex()
|
||||
|
||||
void ChainShape::setPreviousVertex(float x, float y)
|
||||
{
|
||||
if (loop)
|
||||
{
|
||||
throw love::Exception("Physics error: Can't call setPreviousVertex on a loop ChainShape");
|
||||
return;
|
||||
}
|
||||
b2Vec2 v(x, y);
|
||||
b2ChainShape *c = (b2ChainShape *)shape;
|
||||
c->SetPrevVertex(Physics::scaleDown(v));
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
* Create a new ChainShape from a Box2D chain shape.
|
||||
* @param c The chain shape.
|
||||
**/
|
||||
ChainShape(b2ChainShape *c, bool loop = false, bool own = true);
|
||||
ChainShape(b2ChainShape *c, bool own = true);
|
||||
|
||||
virtual ~ChainShape();
|
||||
|
||||
@@ -103,9 +103,6 @@ public:
|
||||
**/
|
||||
const b2Vec2 *getPoints() const;
|
||||
|
||||
private:
|
||||
// True if this ChainShape is a loop.
|
||||
bool loop;
|
||||
};
|
||||
|
||||
} // box2d
|
||||
|
||||
@@ -77,7 +77,7 @@ Window::Window()
|
||||
|
||||
Window::~Window()
|
||||
{
|
||||
close();
|
||||
close(false);
|
||||
|
||||
graphics.set(nullptr);
|
||||
|
||||
@@ -413,7 +413,7 @@ bool Window::setWindow(int width, int height, WindowSettings *settings)
|
||||
graphics.set(Module::getInstance<graphics::Graphics>(Module::M_GRAPHICS));
|
||||
|
||||
if (graphics.get() && graphics->isCanvasActive())
|
||||
throw love::Exception("setMode cannot be called while a Canvas is active in love.graphics.");
|
||||
throw love::Exception("love.window.setMode cannot be called while a Canvas is active in love.graphics.");
|
||||
|
||||
WindowSettings f;
|
||||
|
||||
@@ -640,11 +640,16 @@ void Window::getWindow(int &width, int &height, WindowSettings &newsettings)
|
||||
}
|
||||
|
||||
void Window::close()
|
||||
{
|
||||
close(true);
|
||||
}
|
||||
|
||||
void Window::close(bool allowExceptions)
|
||||
{
|
||||
if (graphics.get())
|
||||
{
|
||||
if (graphics->isCanvasActive())
|
||||
throw love::Exception("close cannot be called while a Canvas is active in love.graphics.");
|
||||
if (allowExceptions && graphics->isCanvasActive())
|
||||
throw love::Exception("love.window.close cannot be called while a Canvas is active in love.graphics.");
|
||||
|
||||
graphics->unSetMode();
|
||||
}
|
||||
@@ -674,7 +679,7 @@ bool Window::setFullscreen(bool fullscreen, Window::FullscreenType fstype)
|
||||
return false;
|
||||
|
||||
if (graphics.get() && graphics->isCanvasActive())
|
||||
throw love::Exception("setFullscreen cannot be called while a Canvas is active in love.graphics.");
|
||||
throw love::Exception("love.window.setFullscreen cannot be called while a Canvas is active in love.graphics.");
|
||||
|
||||
WindowSettings newsettings = settings;
|
||||
newsettings.fullscreen = fullscreen;
|
||||
|
||||
@@ -121,6 +121,8 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
void close(bool allowExceptions);
|
||||
|
||||
struct ContextAttribs
|
||||
{
|
||||
int versionMajor;
|
||||
|
||||
Reference in New Issue
Block a user