diff --git a/extra/windows/love.rc b/extra/windows/love.rc index 8b5d9fb92..8493de94e 100644 Binary files a/extra/windows/love.rc and b/extra/windows/love.rc differ diff --git a/platform/macosx/Info-Framework.plist b/platform/macosx/Info-Framework.plist index 9ac7b9f46..d2104642e 100644 --- a/platform/macosx/Info-Framework.plist +++ b/platform/macosx/Info-Framework.plist @@ -17,11 +17,11 @@ CFBundlePackageType FMWK CFBundleShortVersionString - 0.9.1 + 0.9.2 CFBundleSignature LoVe CFBundleVersion - 0.9.1 + 0.9.2 NSPrincipalClass diff --git a/platform/macosx/love-Info.plist b/platform/macosx/love-Info.plist index c7585e930..3dbad5b89 100644 --- a/platform/macosx/love-Info.plist +++ b/platform/macosx/love-Info.plist @@ -46,7 +46,7 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.1 + 0.9.2 CFBundleSignature LoVe LSApplicationCategoryType diff --git a/platform/unix/love.desktop.in b/platform/unix/love.desktop.in index 3a9e2df12..94c9bb418 100644 --- a/platform/unix/love.desktop.in +++ b/platform/unix/love.desktop.in @@ -2,7 +2,7 @@ Name=LÖVE Comment=The unquestionably awesome 2D game engine MimeType=application/x-love-game; -Exec=@bindir@/love +Exec=@bindir@/love %f Type=Application Categories=Development;Game; Terminal=false diff --git a/src/common/version.h b/src/common/version.h index 5e3e15f72..68b5f6b9d 100644 --- a/src/common/version.h +++ b/src/common/version.h @@ -27,9 +27,9 @@ namespace love // Version stuff. const int VERSION_MAJOR = 0; const int VERSION_MINOR = 9; -const int VERSION_REV = 1; -const char *VERSION = "0.9.1"; -const char *VERSION_COMPATIBILITY[] = { VERSION, "0.9.0", 0 }; +const int VERSION_REV = 2; +const char *VERSION = "0.9.2"; +const char *VERSION_COMPATIBILITY[] = { VERSION, "0.9.1", "0.9.0", 0 }; const char *VERSION_CODENAME = "Baby Inspector"; } // love diff --git a/src/modules/graphics/Graphics.cpp b/src/modules/graphics/Graphics.cpp index b95786d81..fb26dc3d1 100644 --- a/src/modules/graphics/Graphics.cpp +++ b/src/modules/graphics/Graphics.cpp @@ -89,16 +89,6 @@ bool Graphics::getConstant(Support in, const char *&out) return support.find(in, out); } -bool Graphics::getConstant(const char *in, RendererInfo &out) -{ - return rendererInfo.find(in, out); -} - -bool Graphics::getConstant(RendererInfo in, const char *&out) -{ - return rendererInfo.find(in, out); -} - bool Graphics::getConstant(const char *in, SystemLimit &out) { return systemLimits.find(in, out); @@ -169,16 +159,6 @@ StringMap::Entry Graphics::suppor StringMap Graphics::support(Graphics::supportEntries, sizeof(Graphics::supportEntries)); -StringMap::Entry Graphics::rendererInfoEntries[] = -{ - { "name", Graphics::RENDERER_INFO_NAME }, - { "version", Graphics::RENDERER_INFO_VERSION }, - { "vendor", Graphics::RENDERER_INFO_VENDOR }, - { "device", Graphics::RENDERER_INFO_DEVICE }, -}; - -StringMap Graphics::rendererInfo(Graphics::rendererInfoEntries, sizeof(Graphics::rendererInfoEntries)); - StringMap::Entry Graphics::systemLimitEntries[] = { {"pointsize", Graphics::LIMIT_POINT_SIZE}, diff --git a/src/modules/graphics/Graphics.h b/src/modules/graphics/Graphics.h index 766d7e23d..e251d528a 100644 --- a/src/modules/graphics/Graphics.h +++ b/src/modules/graphics/Graphics.h @@ -25,6 +25,9 @@ #include "common/Module.h" #include "common/StringMap.h" +// C++ +#include + namespace love { namespace graphics @@ -88,15 +91,6 @@ public: SUPPORT_MAX_ENUM }; - enum RendererInfo - { - RENDERER_INFO_NAME, - RENDERER_INFO_VERSION, - RENDERER_INFO_VENDOR, - RENDERER_INFO_DEVICE, - RENDERER_INFO_MAX_ENUM - }; - enum SystemLimit { LIMIT_POINT_SIZE, @@ -106,6 +100,14 @@ public: LIMIT_MAX_ENUM }; + struct RendererInfo + { + std::string name; + std::string version; + std::string vendor; + std::string device; + }; + virtual ~Graphics(); /** @@ -144,9 +146,6 @@ public: static bool getConstant(const char *in, Support &out); static bool getConstant(Support in, const char *&out); - static bool getConstant(const char *in, RendererInfo &out); - static bool getConstant(RendererInfo in, const char *&out); - static bool getConstant(const char *in, SystemLimit &out); static bool getConstant(SystemLimit in, const char *&out); @@ -170,9 +169,6 @@ private: static StringMap::Entry supportEntries[]; static StringMap support; - static StringMap::Entry rendererInfoEntries[]; - static StringMap rendererInfo; - static StringMap::Entry systemLimitEntries[]; static StringMap systemLimits; diff --git a/src/modules/graphics/opengl/Graphics.cpp b/src/modules/graphics/opengl/Graphics.cpp index b9af5723f..24b61b135 100644 --- a/src/modules/graphics/opengl/Graphics.cpp +++ b/src/modules/graphics/opengl/Graphics.cpp @@ -1051,31 +1051,30 @@ love::image::ImageData *Graphics::newScreenshot(love::image::Image *image, bool return img; } -std::string Graphics::getRendererInfo(Graphics::RendererInfo infotype) const +Graphics::RendererInfo Graphics::getRendererInfo() const { - const char *infostr = 0; + RendererInfo info; + info.name = "OpenGL"; - switch (infotype) - { - case Graphics::RENDERER_INFO_NAME: - default: - infostr = "OpenGL"; - break; - case Graphics::RENDERER_INFO_VERSION: - infostr = (const char *) glGetString(GL_VERSION); - break; - case Graphics::RENDERER_INFO_VENDOR: - infostr = (const char *) glGetString(GL_VENDOR); - break; - case Graphics::RENDERER_INFO_DEVICE: - infostr = (const char *) glGetString(GL_RENDERER); - break; - } + const char *str = (const char *) glGetString(GL_VERSION); + if (str) + info.version = str; + else + throw love::Exception("Cannot retrieve renderer version information."); - if (!infostr) - throw love::Exception("Cannot retrieve renderer information."); + str = (const char *) glGetString(GL_VENDOR); + if (str) + info.vendor = str; + else + throw love::Exception("Cannot retrieve renderer vendor information."); - return std::string(infostr); + str = (const char *) glGetString(GL_RENDERER); + if (str) + info.device = str; + else + throw love::Exception("Cannot retrieve renderer device information."); + + return info; } double Graphics::getSystemLimit(SystemLimit limittype) const diff --git a/src/modules/graphics/opengl/Graphics.h b/src/modules/graphics/opengl/Graphics.h index 316ad292b..80ad87c27 100644 --- a/src/modules/graphics/opengl/Graphics.h +++ b/src/modules/graphics/opengl/Graphics.h @@ -431,12 +431,11 @@ public: love::image::ImageData *newScreenshot(love::image::Image *image, bool copyAlpha = true); /** - * Returns a string containing system-dependent renderer information. - * Returned string can vary greatly between systems! Do not rely on it for + * Returns system-dependent renderer information. + * Returned string s can vary greatly between systems! Do not rely on it for * anything! - * @param infotype The type of information to return. **/ - std::string getRendererInfo(Graphics::RendererInfo infotype) const; + RendererInfo getRendererInfo() const; /** * Gets the system-dependent numeric limit for the specified parameter. diff --git a/src/modules/graphics/opengl/Mesh.cpp b/src/modules/graphics/opengl/Mesh.cpp index 7d38a5710..ec79b4b2c 100644 --- a/src/modules/graphics/opengl/Mesh.cpp +++ b/src/modules/graphics/opengl/Mesh.cpp @@ -79,6 +79,9 @@ Mesh::Mesh(int vertexcount, Mesh::DrawMode mode) Mesh::~Mesh() { + if (texture) + texture->release(); + delete vbo; delete ibo; } diff --git a/src/modules/graphics/opengl/SpriteBatch.cpp b/src/modules/graphics/opengl/SpriteBatch.cpp index 7e7efc609..f9266a477 100644 --- a/src/modules/graphics/opengl/SpriteBatch.cpp +++ b/src/modules/graphics/opengl/SpriteBatch.cpp @@ -46,8 +46,8 @@ SpriteBatch::SpriteBatch(Texture *texture, int size, int usage) , size(size) , next(0) , color(0) - , array_buf(0) - , element_buf(0) + , array_buf(nullptr) + , element_buf(nullptr) , buffer_used_offset(0) , buffer_used_size(0) { diff --git a/src/modules/graphics/opengl/VertexBuffer.cpp b/src/modules/graphics/opengl/VertexBuffer.cpp index a23d63880..20eaed52a 100644 --- a/src/modules/graphics/opengl/VertexBuffer.cpp +++ b/src/modules/graphics/opengl/VertexBuffer.cpp @@ -21,18 +21,12 @@ #include "VertexBuffer.h" #include "common/Exception.h" -#include "common/config.h" #include #include #include #include -// Conflicts with std::numeric_limits::max() (Windows). -#ifdef max -# undef max -#endif - namespace love { namespace graphics @@ -55,7 +49,7 @@ VertexBuffer::VertexBuffer(size_t size, GLenum target, GLenum usage, MemoryBacki , usage(usage) , backing(backing) , vbo(0) - , memory_map(0) + , memory_map(nullptr) , is_dirty(true) { if (getMemoryBacking() == BACKING_FULL) @@ -207,7 +201,7 @@ bool VertexBuffer::load(bool restore) VertexBuffer::Bind bind(*this); // Copy the old buffer only if 'restore' was requested. - const GLvoid *src = restore ? memory_map : 0; + const GLvoid *src = restore ? memory_map : nullptr; while (GL_NO_ERROR != glGetError()) /* clear error messages */; diff --git a/src/modules/graphics/opengl/VertexBuffer.h b/src/modules/graphics/opengl/VertexBuffer.h index e2c221145..68eb10456 100644 --- a/src/modules/graphics/opengl/VertexBuffer.h +++ b/src/modules/graphics/opengl/VertexBuffer.h @@ -23,6 +23,7 @@ #define LOVE_GRAPHICS_OPENGL_VERTEX_BUFFER_H // LOVE +#include "common/config.h" #include "graphics/Volatile.h" // OpenGL diff --git a/src/modules/graphics/opengl/wrap_Graphics.cpp b/src/modules/graphics/opengl/wrap_Graphics.cpp index 0f668bf4d..e227b1e50 100644 --- a/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -1018,20 +1018,13 @@ int w_hasCanvasFormat(lua_State *L) int w_getRendererInfo(lua_State *L) { - std::string name, version, vendor, device; - - luax_catchexcept(L, [&]() { - name = instance->getRendererInfo(Graphics::RENDERER_INFO_NAME); - version = instance->getRendererInfo(Graphics::RENDERER_INFO_VERSION); - vendor = instance->getRendererInfo(Graphics::RENDERER_INFO_VENDOR); - device = instance->getRendererInfo(Graphics::RENDERER_INFO_DEVICE); - }); - - luax_pushstring(L, name); - luax_pushstring(L, version); - luax_pushstring(L, vendor); - luax_pushstring(L, device); + Graphics::RendererInfo info; + luax_catchexcept(L, [&](){ info = instance->getRendererInfo(); }); + luax_pushstring(L, info.name); + luax_pushstring(L, info.version); + luax_pushstring(L, info.vendor); + luax_pushstring(L, info.device); return 4; } diff --git a/src/modules/physics/box2d/World.cpp b/src/modules/physics/box2d/World.cpp index bf6f6ee1b..400772ffd 100644 --- a/src/modules/physics/box2d/World.cpp +++ b/src/modules/physics/box2d/World.cpp @@ -131,6 +131,8 @@ bool World::ContactFilter::process(Fixture *a, Fixture *b) if (ref != 0) { + a->retain(); + b->retain(); lua_State *L = ref->getL(); ref->push(); luax_pushtype(L, "Fixture", PHYSICS_FIXTURE_T, a); @@ -318,11 +320,9 @@ bool World::ShouldCollide(b2Fixture *fixtureA, b2Fixture *fixtureB) Fixture *a = (Fixture *)Memoizer::find(fixtureA); if (!a) throw love::Exception("A fixture has escaped Memoizer!"); - a->retain(); Fixture *b = (Fixture *)Memoizer::find(fixtureB); if (!b) throw love::Exception("A fixture has escaped Memoizer!"); - b->retain(); return filter.process(a, b); }