diff --git a/readme.md b/readme.md index 64d79bf3b..dbc8c171c 100644 --- a/readme.md +++ b/readme.md @@ -24,6 +24,16 @@ Download the required frameworks from [here][dependencies] and place them in `/L Then use the Xcode project found at `platform/xcode/love.xcodeproj` to build the `love-macosx` target. +###iOS +Download the required libraries from [here][dependencies-ios] and place the `include` and `libraries` folders +into the `platform/xcode/ios` folder. + +Then use the Xcode project foind at `platform/xcode/love.xcodeproj` to build the `love-ios` target. + +Note that you must be registered in the [iOS Developer Program][iosdeveloper] in order to build for physical iOS devices. + +The iOS version is currently a work-in-progress. + Repository information ---------------------- @@ -54,7 +64,7 @@ Dependencies - OpenGL - OpenAL - Lua / LuaJIT / LLVM-lua -- DevIL with MNG and TIFF +- jpeg-turbo - FreeType - PhysicsFS - ModPlug @@ -66,9 +76,11 @@ Dependencies [forums]: http://love2d.org/forums [irc]: irc://irc.oftc.net/love [dependencies]: http://love2d.org/sdk +[dependencies-ios]: https://dl.dropboxusercontent.com/u/4214717/love-ios-libraries-0.10.zip [megasource]: https://bitbucket.org/rude/megasource [builds]: http://love2d.org/builds [stableppa]: https://launchpad.net/~bartbes/+archive/love-stable [unstableppa]: https://launchpad.net/~bartbes/+archive/love-unstable [aur]: http://aur.archlinux.org/packages.php?ID=35279 [love-experiments]: https://bitbucket.org/bartbes/love-experiments +[iosdeveloper]: https://developer.apple.com/programs/ios/ diff --git a/src/modules/graphics/opengl/Font.cpp b/src/modules/graphics/opengl/Font.cpp index fe6646c35..aa617c658 100644 --- a/src/modules/graphics/opengl/Font.cpp +++ b/src/modules/graphics/opengl/Font.cpp @@ -48,7 +48,7 @@ Font::Font(love::font::Rasterizer *r, const Texture::Filter &filter) , textureHeight(128) , filter(filter) , useSpacesAsTab(false) - , indexBuffer(20) // We make this bigger at draw-time, if needed. + , quadIndices(20) // We make this bigger at draw-time, if needed. , textureCacheID(0) , textureMemorySize(0) { @@ -523,15 +523,15 @@ void Font::drawVertices(const std::vector &drawcommands) for (const DrawCommand &cmd : drawcommands) totalverts = std::max(cmd.startvertex + cmd.vertexcount, totalverts); - if ((size_t) totalverts / 4 > indexBuffer.getSize()) - indexBuffer = VertexIndex((size_t) totalverts / 4); + if ((size_t) totalverts / 4 > quadIndices.getSize()) + quadIndices = VertexIndex((size_t) totalverts / 4); gl.prepareDraw(); - const GLenum gltype = indexBuffer.getType(); - const size_t elemsize = indexBuffer.getElementSize(); + const GLenum gltype = quadIndices.getType(); + const size_t elemsize = quadIndices.getElementSize(); - GLBuffer::Bind bind(*indexBuffer.getBuffer()); + GLBuffer::Bind bind(*quadIndices.getBuffer()); // We need a separate draw call for every section of the text which uses a // different texture than the previous section. @@ -542,7 +542,7 @@ void Font::drawVertices(const std::vector &drawcommands) // TODO: Use glDrawElementsBaseVertex when supported? gl.bindTexture(cmd.texture); - gl.drawElements(GL_TRIANGLES, count, gltype, indexBuffer.getPointer(offset)); + gl.drawElements(GL_TRIANGLES, count, gltype, quadIndices.getPointer(offset)); } } diff --git a/src/modules/graphics/opengl/Font.h b/src/modules/graphics/opengl/Font.h index 34d827934..a252f4ca8 100644 --- a/src/modules/graphics/opengl/Font.h +++ b/src/modules/graphics/opengl/Font.h @@ -234,7 +234,7 @@ private: bool useSpacesAsTab; // Index buffer used for drawing quads with GL_TRIANGLES. - VertexIndex indexBuffer; + VertexIndex quadIndices; // ID which is incremented when the texture cache is invalidated. uint32 textureCacheID; diff --git a/src/modules/graphics/opengl/ParticleSystem.cpp b/src/modules/graphics/opengl/ParticleSystem.cpp index 6db19ca94..96ff9f1fa 100644 --- a/src/modules/graphics/opengl/ParticleSystem.cpp +++ b/src/modules/graphics/opengl/ParticleSystem.cpp @@ -64,7 +64,7 @@ ParticleSystem::ParticleSystem(Texture *texture, uint32 size) , pHead(nullptr) , pTail(nullptr) , particleVerts(nullptr) - , ibo(1) + , quadIndices(1) , texture(texture) , active(true) , insertMode(INSERT_MODE_TOP) @@ -113,7 +113,7 @@ ParticleSystem::ParticleSystem(const ParticleSystem &p) , pHead(nullptr) , pTail(nullptr) , particleVerts(nullptr) - , ibo(p.ibo) + , quadIndices(p.quadIndices) , texture(p.texture) , active(p.active) , insertMode(p.insertMode) @@ -198,7 +198,7 @@ void ParticleSystem::setBufferSize(uint32 size) { if (size == 0 || size > MAX_PARTICLES) throw love::Exception("Invalid buffer size"); - ibo = VertexIndex(size); + quadIndices = VertexIndex(size); deleteBuffers(); createBuffers(size); reset(); @@ -888,8 +888,9 @@ void ParticleSystem::draw(float x, float y, float angle, float sx, float sy, flo glVertexAttribPointer(ATTRIB_TEXCOORD, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), &particleVerts[0].s); { - GLBuffer::Bind ibo_bind(*ibo.getBuffer()); - gl.drawElements(GL_TRIANGLES, (GLsizei) ibo.getIndexCount(pCount), ibo.getType(), ibo.getPointer(0)); + GLsizei count = (GLsizei) quadIndices.getIndexCount(pCount); + GLBuffer::Bind ibo_bind(*quadIndices.getBuffer()); + gl.drawElements(GL_TRIANGLES, count, quadIndices.getType(), quadIndices.getPointer(0)); } glDisableVertexAttribArray(ATTRIB_TEXCOORD); diff --git a/src/modules/graphics/opengl/ParticleSystem.h b/src/modules/graphics/opengl/ParticleSystem.h index ba4e977b9..b5bd2c691 100644 --- a/src/modules/graphics/opengl/ParticleSystem.h +++ b/src/modules/graphics/opengl/ParticleSystem.h @@ -577,7 +577,7 @@ protected: Vertex *particleVerts; // Vertex index buffer. - VertexIndex ibo; + VertexIndex quadIndices; // The texture to be drawn. StrongRef texture; diff --git a/src/modules/graphics/opengl/SpriteBatch.cpp b/src/modules/graphics/opengl/SpriteBatch.cpp index eaa133db2..2b455fc16 100644 --- a/src/modules/graphics/opengl/SpriteBatch.cpp +++ b/src/modules/graphics/opengl/SpriteBatch.cpp @@ -47,7 +47,7 @@ SpriteBatch::SpriteBatch(Texture *texture, int size, int usage) , next(0) , color(0) , array_buf(nullptr) - , element_buf(size) + , quad_indices(size) , buffer_used_offset(0) , buffer_used_size(0) { @@ -202,7 +202,7 @@ void SpriteBatch::setBufferSize(int newsize) void *new_data = new_array_buf->map(); memcpy(new_data, old_data, sizeof(Vertex) * 4 * std::min(newsize, size)); - element_buf = VertexIndex(newsize); + quad_indices = VertexIndex(newsize); } catch (love::Exception &) { @@ -241,7 +241,7 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float gl.bindTexture(*(GLuint *) texture->getHandle()); GLBuffer::Bind array_bind(*array_buf); - GLBuffer::Bind element_bind(*element_buf.getBuffer()); + GLBuffer::Bind element_bind(*quad_indices.getBuffer()); // Make sure the VBO isn't mapped when we draw (sends data to GPU if needed.) array_buf->unmap(buffer_used_offset, buffer_used_size); @@ -263,7 +263,7 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float glVertexAttribPointer(ATTRIB_TEXCOORD, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), array_buf->getPointer(texel_offset)); gl.prepareDraw(); - gl.drawElements(GL_TRIANGLES, (GLsizei) element_buf.getIndexCount(next), element_buf.getType(), element_buf.getPointer(0)); + gl.drawElements(GL_TRIANGLES, (GLsizei) quad_indices.getIndexCount(next), quad_indices.getType(), quad_indices.getPointer(0)); glDisableVertexAttribArray(ATTRIB_TEXCOORD); glDisableVertexAttribArray(ATTRIB_POS); @@ -322,8 +322,8 @@ bool SpriteBatch::getConstant(UsageHint in, const char *&out) StringMap::Entry SpriteBatch::usageHintEntries[] = { {"dynamic", SpriteBatch::USAGE_DYNAMIC}, - {"static", SpriteBatch::USAGE_STATIC}, - {"stream", SpriteBatch::USAGE_STREAM}, + {"static", SpriteBatch::USAGE_STATIC}, + {"stream", SpriteBatch::USAGE_STREAM}, }; StringMap SpriteBatch::usageHints(usageHintEntries, sizeof(usageHintEntries)); diff --git a/src/modules/graphics/opengl/SpriteBatch.h b/src/modules/graphics/opengl/SpriteBatch.h index 07d4b8e5b..28bd708de 100644 --- a/src/modules/graphics/opengl/SpriteBatch.h +++ b/src/modules/graphics/opengl/SpriteBatch.h @@ -138,7 +138,7 @@ private: Color *color; GLBuffer *array_buf; - VertexIndex element_buf; + VertexIndex quad_indices; // The portion of the vertex buffer that's been modified while mapped. size_t buffer_used_offset;