From fd9e9758a9fea79c3a9bd69866bf46fecdb90312 Mon Sep 17 00:00:00 2001 From: fysx Date: Fri, 16 Jan 2015 12:31:11 +0100 Subject: [PATCH] Using latest changeset 593639000823 of love-android --- jni/love/src/common/Data.h | 2 +- jni/love/src/common/EnumMap.h | 2 +- jni/love/src/common/Exception.cpp | 2 +- jni/love/src/common/Exception.h | 2 +- jni/love/src/common/Matrix.cpp | 7 +- jni/love/src/common/Matrix.h | 7 +- jni/love/src/common/Memoizer.cpp | 2 +- jni/love/src/common/Memoizer.h | 2 +- jni/love/src/common/Module.cpp | 2 +- jni/love/src/common/Module.h | 2 +- jni/love/src/common/Object.cpp | 2 +- jni/love/src/common/Object.h | 2 +- jni/love/src/common/Reference.cpp | 2 +- jni/love/src/common/Reference.h | 2 +- jni/love/src/common/StringMap.h | 2 +- jni/love/src/common/Variant.cpp | 2 +- jni/love/src/common/Variant.h | 2 +- jni/love/src/common/Vector.cpp | 2 +- jni/love/src/common/Vector.h | 2 +- jni/love/src/common/b64.cpp | 2 +- jni/love/src/common/b64.h | 2 +- jni/love/src/common/config.h | 2 +- jni/love/src/common/delay.cpp | 2 +- jni/love/src/common/delay.h | 2 +- jni/love/src/common/int.h | 2 +- jni/love/src/common/math.h | 2 +- jni/love/src/common/runtime.cpp | 5 +- jni/love/src/common/runtime.h | 2 +- jni/love/src/common/types.h | 2 +- jni/love/src/common/utf8.cpp | 2 +- jni/love/src/common/utf8.h | 2 +- jni/love/src/common/version.h | 2 +- jni/love/src/common/wrap_Data.cpp | 2 +- jni/love/src/common/wrap_Data.h | 2 +- .../Box2D/Collision/Shapes/b2ChainShape.cpp | 3 +- .../Box2D/Collision/b2BroadPhase.cpp | 2 +- .../Box2D/Collision/b2DynamicTree.cpp | 3 +- .../Box2D/Common/b2BlockAllocator.cpp | 2 +- .../libraries/Box2D/Common/b2GrowableStack.h | 1 - jni/love/src/libraries/ddsparse/ddsparse.cpp | 2 +- jni/love/src/libraries/ddsparse/ddsparse.h | 2 +- jni/love/src/libraries/enet/enet.cpp | 100 +++++-- jni/love/src/libraries/enet/lua-enet.h | 2 +- .../src/libraries/luasocket/luasocket.cpp | 2 +- jni/love/src/libraries/luasocket/luasocket.h | 2 +- jni/love/src/love.cpp | 4 +- jni/love/src/modules/audio/Audio.cpp | 2 +- jni/love/src/modules/audio/Audio.h | 2 +- jni/love/src/modules/audio/Source.cpp | 2 +- jni/love/src/modules/audio/Source.h | 2 +- jni/love/src/modules/audio/null/Audio.cpp | 2 +- jni/love/src/modules/audio/null/Audio.h | 2 +- jni/love/src/modules/audio/null/Source.cpp | 2 +- jni/love/src/modules/audio/null/Source.h | 2 +- jni/love/src/modules/audio/openal/Audio.cpp | 2 +- jni/love/src/modules/audio/openal/Audio.h | 3 +- jni/love/src/modules/audio/openal/Pool.cpp | 2 +- jni/love/src/modules/audio/openal/Pool.h | 3 +- jni/love/src/modules/audio/openal/Source.cpp | 7 +- jni/love/src/modules/audio/openal/Source.h | 4 +- jni/love/src/modules/audio/wrap_Audio.cpp | 5 +- jni/love/src/modules/audio/wrap_Audio.h | 2 +- jni/love/src/modules/audio/wrap_Source.cpp | 2 +- jni/love/src/modules/audio/wrap_Source.h | 2 +- jni/love/src/modules/event/Event.cpp | 2 +- jni/love/src/modules/event/Event.h | 2 +- jni/love/src/modules/event/sdl/Event.cpp | 35 +-- jni/love/src/modules/event/sdl/Event.h | 4 +- jni/love/src/modules/event/sdl/wrap_Event.cpp | 2 +- jni/love/src/modules/event/sdl/wrap_Event.h | 2 +- jni/love/src/modules/filesystem/File.cpp | 2 +- jni/love/src/modules/filesystem/File.h | 2 +- jni/love/src/modules/filesystem/FileData.cpp | 2 +- jni/love/src/modules/filesystem/FileData.h | 2 +- .../src/modules/filesystem/physfs/File.cpp | 2 +- jni/love/src/modules/filesystem/physfs/File.h | 2 +- .../modules/filesystem/physfs/Filesystem.cpp | 2 +- .../modules/filesystem/physfs/Filesystem.h | 3 +- jni/love/src/modules/filesystem/wrap_File.cpp | 2 +- jni/love/src/modules/filesystem/wrap_File.h | 2 +- .../src/modules/filesystem/wrap_FileData.cpp | 2 +- .../src/modules/filesystem/wrap_FileData.h | 2 +- .../modules/filesystem/wrap_Filesystem.cpp | 2 +- .../src/modules/filesystem/wrap_Filesystem.h | 2 +- jni/love/src/modules/font/Font.h | 2 +- jni/love/src/modules/font/GlyphData.cpp | 4 +- jni/love/src/modules/font/GlyphData.h | 2 +- jni/love/src/modules/font/ImageRasterizer.cpp | 2 +- jni/love/src/modules/font/ImageRasterizer.h | 2 +- jni/love/src/modules/font/Rasterizer.cpp | 6 +- jni/love/src/modules/font/Rasterizer.h | 2 +- jni/love/src/modules/font/freetype/Font.cpp | 6 +- jni/love/src/modules/font/freetype/Font.h | 2 +- .../font/freetype/TrueTypeRasterizer.cpp | 2 +- .../font/freetype/TrueTypeRasterizer.h | 2 +- .../src/modules/font/freetype/wrap_Font.cpp | 2 +- .../src/modules/font/freetype/wrap_Font.h | 2 +- jni/love/src/modules/font/wrap_GlyphData.cpp | 2 +- jni/love/src/modules/font/wrap_GlyphData.h | 2 +- jni/love/src/modules/font/wrap_Rasterizer.cpp | 2 +- jni/love/src/modules/font/wrap_Rasterizer.h | 2 +- jni/love/src/modules/graphics/Drawable.h | 2 +- jni/love/src/modules/graphics/Graphics.cpp | 2 +- jni/love/src/modules/graphics/Graphics.h | 2 +- jni/love/src/modules/graphics/Quad.cpp | 2 +- jni/love/src/modules/graphics/Quad.h | 2 +- jni/love/src/modules/graphics/Texture.cpp | 3 +- jni/love/src/modules/graphics/Texture.h | 3 +- jni/love/src/modules/graphics/Volatile.cpp | 2 +- jni/love/src/modules/graphics/Volatile.h | 2 +- .../src/modules/graphics/opengl/Canvas.cpp | 2 +- jni/love/src/modules/graphics/opengl/Canvas.h | 2 +- jni/love/src/modules/graphics/opengl/Font.cpp | 6 +- jni/love/src/modules/graphics/opengl/Font.h | 2 +- .../src/modules/graphics/opengl/Graphics.cpp | 40 ++- .../src/modules/graphics/opengl/Graphics.h | 12 +- .../src/modules/graphics/opengl/Image.cpp | 36 ++- jni/love/src/modules/graphics/opengl/Image.h | 2 +- jni/love/src/modules/graphics/opengl/Mesh.cpp | 2 +- jni/love/src/modules/graphics/opengl/Mesh.h | 2 +- .../src/modules/graphics/opengl/OpenGL.cpp | 92 ++----- jni/love/src/modules/graphics/opengl/OpenGL.h | 7 +- .../graphics/opengl/ParticleSystem.cpp | 81 +++--- .../modules/graphics/opengl/ParticleSystem.h | 32 ++- .../src/modules/graphics/opengl/Polyline.cpp | 2 +- .../src/modules/graphics/opengl/Polyline.h | 2 +- .../src/modules/graphics/opengl/Shader.cpp | 249 +++++++++--------- jni/love/src/modules/graphics/opengl/Shader.h | 40 +-- .../modules/graphics/opengl/SpriteBatch.cpp | 78 ++---- .../src/modules/graphics/opengl/SpriteBatch.h | 12 +- .../src/modules/graphics/opengl/Texture.h | 2 +- .../modules/graphics/opengl/VertexBuffer.cpp | 16 +- .../modules/graphics/opengl/VertexBuffer.h | 5 +- .../modules/graphics/opengl/wrap_Canvas.cpp | 2 +- .../src/modules/graphics/opengl/wrap_Canvas.h | 2 +- .../src/modules/graphics/opengl/wrap_Font.cpp | 2 +- .../src/modules/graphics/opengl/wrap_Font.h | 2 +- .../modules/graphics/opengl/wrap_Graphics.cpp | 44 ++-- .../modules/graphics/opengl/wrap_Graphics.h | 2 +- .../modules/graphics/opengl/wrap_Image.cpp | 2 +- .../src/modules/graphics/opengl/wrap_Image.h | 2 +- .../src/modules/graphics/opengl/wrap_Mesh.cpp | 2 +- .../src/modules/graphics/opengl/wrap_Mesh.h | 2 +- .../graphics/opengl/wrap_ParticleSystem.cpp | 37 ++- .../graphics/opengl/wrap_ParticleSystem.h | 4 +- .../src/modules/graphics/opengl/wrap_Quad.cpp | 2 +- .../src/modules/graphics/opengl/wrap_Quad.h | 2 +- .../modules/graphics/opengl/wrap_Shader.cpp | 2 +- .../src/modules/graphics/opengl/wrap_Shader.h | 2 +- .../graphics/opengl/wrap_SpriteBatch.cpp | 2 +- .../graphics/opengl/wrap_SpriteBatch.h | 2 +- .../modules/graphics/opengl/wrap_Texture.cpp | 2 +- .../modules/graphics/opengl/wrap_Texture.h | 2 +- jni/love/src/modules/image/CompressedData.cpp | 6 +- jni/love/src/modules/image/CompressedData.h | 6 +- jni/love/src/modules/image/Image.h | 2 +- jni/love/src/modules/image/ImageData.cpp | 2 +- jni/love/src/modules/image/ImageData.h | 2 +- .../modules/image/magpie/CompressedData.cpp | 2 +- .../src/modules/image/magpie/CompressedData.h | 2 +- .../image/magpie/CompressedFormatHandler.h | 2 +- .../src/modules/image/magpie/DevilHandler.cpp | 2 +- .../src/modules/image/magpie/DevilHandler.h | 2 +- .../modules/image/magpie/FormatHandler.cpp | 2 +- .../src/modules/image/magpie/FormatHandler.h | 2 +- jni/love/src/modules/image/magpie/Image.cpp | 2 +- jni/love/src/modules/image/magpie/Image.h | 2 +- .../src/modules/image/magpie/ImageData.cpp | 2 +- jni/love/src/modules/image/magpie/ImageData.h | 2 +- .../src/modules/image/magpie/JPEGHandler.cpp | 2 +- .../src/modules/image/magpie/JPEGHandler.h | 2 +- .../src/modules/image/magpie/KTXHandler.cpp | 2 +- .../src/modules/image/magpie/KTXHandler.h | 2 +- .../src/modules/image/magpie/PKMHandler.cpp | 2 +- .../src/modules/image/magpie/PKMHandler.h | 2 +- .../src/modules/image/magpie/PNGHandler.cpp | 2 +- .../src/modules/image/magpie/PNGHandler.h | 2 +- .../src/modules/image/magpie/PVRHandler.cpp | 2 +- .../src/modules/image/magpie/PVRHandler.h | 2 +- .../src/modules/image/magpie/STBHandler.cpp | 2 +- .../src/modules/image/magpie/STBHandler.h | 2 +- .../src/modules/image/magpie/ddsHandler.cpp | 10 +- .../src/modules/image/magpie/ddsHandler.h | 2 +- .../src/modules/image/wrap_CompressedData.cpp | 2 +- .../src/modules/image/wrap_CompressedData.h | 2 +- jni/love/src/modules/image/wrap_Image.cpp | 2 +- jni/love/src/modules/image/wrap_Image.h | 2 +- jni/love/src/modules/image/wrap_ImageData.cpp | 2 +- jni/love/src/modules/image/wrap_ImageData.h | 2 +- jni/love/src/modules/joystick/Joystick.cpp | 2 +- jni/love/src/modules/joystick/Joystick.h | 2 +- .../src/modules/joystick/JoystickModule.h | 2 +- .../src/modules/joystick/sdl/Joystick.cpp | 2 +- jni/love/src/modules/joystick/sdl/Joystick.h | 2 +- .../modules/joystick/sdl/JoystickModule.cpp | 10 +- .../src/modules/joystick/sdl/JoystickModule.h | 2 +- .../src/modules/joystick/wrap_Joystick.cpp | 2 +- jni/love/src/modules/joystick/wrap_Joystick.h | 2 +- .../modules/joystick/wrap_JoystickModule.cpp | 16 +- .../modules/joystick/wrap_JoystickModule.h | 2 +- jni/love/src/modules/keyboard/Keyboard.cpp | 2 +- jni/love/src/modules/keyboard/Keyboard.h | 4 +- .../src/modules/keyboard/sdl/Keyboard.cpp | 19 +- jni/love/src/modules/keyboard/sdl/Keyboard.h | 11 +- .../src/modules/keyboard/wrap_Keyboard.cpp | 2 +- jni/love/src/modules/keyboard/wrap_Keyboard.h | 2 +- jni/love/src/modules/love/love.cpp | 2 +- jni/love/src/modules/love/love.h | 2 +- jni/love/src/modules/math/BezierCurve.cpp | 2 +- jni/love/src/modules/math/BezierCurve.h | 2 +- jni/love/src/modules/math/MathModule.cpp | 2 +- jni/love/src/modules/math/MathModule.h | 2 +- jni/love/src/modules/math/RandomGenerator.cpp | 7 +- jni/love/src/modules/math/RandomGenerator.h | 2 +- .../src/modules/math/wrap_BezierCurve.cpp | 2 +- jni/love/src/modules/math/wrap_BezierCurve.h | 2 +- jni/love/src/modules/math/wrap_Math.cpp | 2 +- jni/love/src/modules/math/wrap_Math.h | 2 +- .../src/modules/math/wrap_RandomGenerator.cpp | 2 +- .../src/modules/math/wrap_RandomGenerator.h | 2 +- jni/love/src/modules/mouse/Cursor.cpp | 2 +- jni/love/src/modules/mouse/Cursor.h | 2 +- jni/love/src/modules/mouse/Mouse.cpp | 2 +- jni/love/src/modules/mouse/Mouse.h | 2 +- jni/love/src/modules/mouse/sdl/Cursor.cpp | 2 +- jni/love/src/modules/mouse/sdl/Cursor.h | 2 +- jni/love/src/modules/mouse/sdl/Mouse.cpp | 46 ++-- jni/love/src/modules/mouse/sdl/Mouse.h | 2 +- jni/love/src/modules/mouse/wrap_Cursor.cpp | 2 +- jni/love/src/modules/mouse/wrap_Cursor.h | 2 +- jni/love/src/modules/mouse/wrap_Mouse.cpp | 2 +- jni/love/src/modules/mouse/wrap_Mouse.h | 2 +- jni/love/src/modules/physics/Body.cpp | 2 +- jni/love/src/modules/physics/Body.h | 2 +- jni/love/src/modules/physics/Joint.cpp | 2 +- jni/love/src/modules/physics/Joint.h | 2 +- jni/love/src/modules/physics/Shape.cpp | 2 +- jni/love/src/modules/physics/Shape.h | 2 +- jni/love/src/modules/physics/box2d/Body.cpp | 29 +- jni/love/src/modules/physics/box2d/Body.h | 7 +- .../src/modules/physics/box2d/ChainShape.cpp | 2 +- .../src/modules/physics/box2d/ChainShape.h | 2 +- .../src/modules/physics/box2d/CircleShape.cpp | 2 +- .../src/modules/physics/box2d/CircleShape.h | 2 +- .../src/modules/physics/box2d/Contact.cpp | 2 +- jni/love/src/modules/physics/box2d/Contact.h | 2 +- .../modules/physics/box2d/DistanceJoint.cpp | 2 +- .../src/modules/physics/box2d/DistanceJoint.h | 2 +- .../src/modules/physics/box2d/EdgeShape.cpp | 2 +- .../src/modules/physics/box2d/EdgeShape.h | 2 +- .../src/modules/physics/box2d/Fixture.cpp | 2 +- jni/love/src/modules/physics/box2d/Fixture.h | 2 +- .../modules/physics/box2d/FrictionJoint.cpp | 2 +- .../src/modules/physics/box2d/FrictionJoint.h | 2 +- .../src/modules/physics/box2d/GearJoint.cpp | 29 +- .../src/modules/physics/box2d/GearJoint.h | 5 +- jni/love/src/modules/physics/box2d/Joint.cpp | 30 ++- jni/love/src/modules/physics/box2d/Joint.h | 6 +- .../src/modules/physics/box2d/MotorJoint.cpp | 2 +- .../src/modules/physics/box2d/MotorJoint.h | 2 +- .../src/modules/physics/box2d/MouseJoint.cpp | 2 +- .../src/modules/physics/box2d/MouseJoint.h | 2 +- .../src/modules/physics/box2d/Physics.cpp | 70 ++++- jni/love/src/modules/physics/box2d/Physics.h | 2 +- .../modules/physics/box2d/PolygonShape.cpp | 2 +- .../src/modules/physics/box2d/PolygonShape.h | 2 +- .../modules/physics/box2d/PrismaticJoint.cpp | 2 +- .../modules/physics/box2d/PrismaticJoint.h | 2 +- .../src/modules/physics/box2d/PulleyJoint.cpp | 2 +- .../src/modules/physics/box2d/PulleyJoint.h | 2 +- .../modules/physics/box2d/RevoluteJoint.cpp | 2 +- .../src/modules/physics/box2d/RevoluteJoint.h | 2 +- .../src/modules/physics/box2d/RopeJoint.cpp | 2 +- .../src/modules/physics/box2d/RopeJoint.h | 2 +- jni/love/src/modules/physics/box2d/Shape.cpp | 2 +- jni/love/src/modules/physics/box2d/Shape.h | 2 +- .../src/modules/physics/box2d/WeldJoint.cpp | 2 +- .../src/modules/physics/box2d/WeldJoint.h | 2 +- .../src/modules/physics/box2d/WheelJoint.cpp | 2 +- .../src/modules/physics/box2d/WheelJoint.h | 2 +- jni/love/src/modules/physics/box2d/World.cpp | 2 +- jni/love/src/modules/physics/box2d/World.h | 2 +- .../src/modules/physics/box2d/wrap_Body.cpp | 20 +- .../src/modules/physics/box2d/wrap_Body.h | 4 +- .../modules/physics/box2d/wrap_ChainShape.cpp | 2 +- .../modules/physics/box2d/wrap_ChainShape.h | 2 +- .../physics/box2d/wrap_CircleShape.cpp | 2 +- .../modules/physics/box2d/wrap_CircleShape.h | 2 +- .../modules/physics/box2d/wrap_Contact.cpp | 10 +- .../src/modules/physics/box2d/wrap_Contact.h | 3 +- .../physics/box2d/wrap_DistanceJoint.cpp | 4 +- .../physics/box2d/wrap_DistanceJoint.h | 2 +- .../modules/physics/box2d/wrap_EdgeShape.cpp | 2 +- .../modules/physics/box2d/wrap_EdgeShape.h | 2 +- .../modules/physics/box2d/wrap_Fixture.cpp | 10 +- .../src/modules/physics/box2d/wrap_Fixture.h | 3 +- .../physics/box2d/wrap_FrictionJoint.cpp | 4 +- .../physics/box2d/wrap_FrictionJoint.h | 2 +- .../modules/physics/box2d/wrap_GearJoint.cpp | 21 +- .../modules/physics/box2d/wrap_GearJoint.h | 3 +- .../src/modules/physics/box2d/wrap_Joint.cpp | 62 ++++- .../src/modules/physics/box2d/wrap_Joint.h | 5 +- .../modules/physics/box2d/wrap_MotorJoint.cpp | 4 +- .../modules/physics/box2d/wrap_MotorJoint.h | 2 +- .../modules/physics/box2d/wrap_MouseJoint.cpp | 4 +- .../modules/physics/box2d/wrap_MouseJoint.h | 2 +- .../modules/physics/box2d/wrap_Physics.cpp | 2 +- .../src/modules/physics/box2d/wrap_Physics.h | 2 +- .../physics/box2d/wrap_PolygonShape.cpp | 2 +- .../modules/physics/box2d/wrap_PolygonShape.h | 2 +- .../physics/box2d/wrap_PrismaticJoint.cpp | 4 +- .../physics/box2d/wrap_PrismaticJoint.h | 2 +- .../physics/box2d/wrap_PulleyJoint.cpp | 4 +- .../modules/physics/box2d/wrap_PulleyJoint.h | 2 +- .../physics/box2d/wrap_RevoluteJoint.cpp | 4 +- .../physics/box2d/wrap_RevoluteJoint.h | 2 +- .../modules/physics/box2d/wrap_RopeJoint.cpp | 4 +- .../modules/physics/box2d/wrap_RopeJoint.h | 2 +- .../src/modules/physics/box2d/wrap_Shape.cpp | 2 +- .../src/modules/physics/box2d/wrap_Shape.h | 2 +- .../modules/physics/box2d/wrap_WeldJoint.cpp | 4 +- .../modules/physics/box2d/wrap_WeldJoint.h | 2 +- .../modules/physics/box2d/wrap_WheelJoint.cpp | 4 +- .../modules/physics/box2d/wrap_WheelJoint.h | 2 +- .../src/modules/physics/box2d/wrap_World.cpp | 10 +- .../src/modules/physics/box2d/wrap_World.h | 3 +- jni/love/src/modules/sound/Decoder.h | 4 +- jni/love/src/modules/sound/Sound.cpp | 2 +- jni/love/src/modules/sound/Sound.h | 2 +- jni/love/src/modules/sound/SoundData.cpp | 2 +- jni/love/src/modules/sound/SoundData.h | 2 +- .../src/modules/sound/lullaby/Decoder.cpp | 2 +- jni/love/src/modules/sound/lullaby/Decoder.h | 2 +- .../src/modules/sound/lullaby/FLACDecoder.cpp | 2 +- .../src/modules/sound/lullaby/FLACDecoder.h | 2 +- .../src/modules/sound/lullaby/GmeDecoder.cpp | 2 +- .../src/modules/sound/lullaby/GmeDecoder.h | 2 +- .../modules/sound/lullaby/ModPlugDecoder.cpp | 2 +- .../modules/sound/lullaby/ModPlugDecoder.h | 2 +- .../modules/sound/lullaby/Mpg123Decoder.cpp | 2 +- .../src/modules/sound/lullaby/Mpg123Decoder.h | 2 +- jni/love/src/modules/sound/lullaby/Sound.cpp | 2 +- jni/love/src/modules/sound/lullaby/Sound.h | 2 +- .../modules/sound/lullaby/VorbisDecoder.cpp | 2 +- .../src/modules/sound/lullaby/VorbisDecoder.h | 2 +- .../src/modules/sound/lullaby/WaveDecoder.cpp | 2 +- .../src/modules/sound/lullaby/WaveDecoder.h | 2 +- jni/love/src/modules/sound/wrap_Decoder.cpp | 2 +- jni/love/src/modules/sound/wrap_Decoder.h | 2 +- jni/love/src/modules/sound/wrap_Sound.cpp | 2 +- jni/love/src/modules/sound/wrap_Sound.h | 2 +- jni/love/src/modules/sound/wrap_SoundData.cpp | 2 +- jni/love/src/modules/sound/wrap_SoundData.h | 2 +- jni/love/src/modules/system/System.cpp | 2 +- jni/love/src/modules/system/System.h | 2 +- jni/love/src/modules/system/sdl/System.cpp | 2 +- jni/love/src/modules/system/sdl/System.h | 2 +- jni/love/src/modules/system/wrap_System.cpp | 2 +- jni/love/src/modules/system/wrap_System.h | 2 +- jni/love/src/modules/thread/Channel.cpp | 2 +- jni/love/src/modules/thread/Channel.h | 2 +- jni/love/src/modules/thread/LuaThread.cpp | 2 +- jni/love/src/modules/thread/LuaThread.h | 2 +- jni/love/src/modules/thread/Thread.h | 2 +- jni/love/src/modules/thread/ThreadModule.cpp | 2 +- jni/love/src/modules/thread/ThreadModule.h | 2 +- jni/love/src/modules/thread/sdl/Thread.cpp | 2 +- jni/love/src/modules/thread/sdl/Thread.h | 2 +- jni/love/src/modules/thread/sdl/threads.cpp | 2 +- jni/love/src/modules/thread/sdl/threads.h | 2 +- jni/love/src/modules/thread/threads.cpp | 2 +- jni/love/src/modules/thread/threads.h | 2 +- jni/love/src/modules/thread/wrap_Channel.h | 2 +- jni/love/src/modules/thread/wrap_LuaThread.h | 2 +- .../src/modules/thread/wrap_ThreadModule.cpp | 26 +- .../src/modules/thread/wrap_ThreadModule.h | 2 +- jni/love/src/modules/timer/Timer.h | 2 +- jni/love/src/modules/timer/sdl/Timer.cpp | 2 +- jni/love/src/modules/timer/sdl/Timer.h | 2 +- jni/love/src/modules/timer/wrap_Timer.cpp | 2 +- jni/love/src/modules/timer/wrap_Timer.h | 2 +- jni/love/src/modules/touch/Touch.h | 2 +- jni/love/src/modules/touch/sdl/Touch.cpp | 2 +- jni/love/src/modules/touch/sdl/Touch.h | 2 +- jni/love/src/modules/touch/wrap_Touch.cpp | 2 +- jni/love/src/modules/touch/wrap_Touch.h | 2 +- jni/love/src/modules/window/Window.cpp | 7 +- jni/love/src/modules/window/Window.h | 23 +- jni/love/src/modules/window/sdl/Window.cpp | 138 +++++++--- jni/love/src/modules/window/sdl/Window.h | 13 +- jni/love/src/modules/window/wrap_Window.cpp | 120 ++++++++- jni/love/src/modules/window/wrap_Window.h | 7 +- jni/love/src/scripts/auto.lua | 2 +- jni/love/src/scripts/boot.lua | 37 +-- jni/love/src/scripts/boot.lua.h | 72 ++--- jni/love/src/scripts/graphics.lua | 10 +- jni/love/src/scripts/graphics.lua.h | 11 +- 397 files changed, 1625 insertions(+), 971 deletions(-) diff --git a/jni/love/src/common/Data.h b/jni/love/src/common/Data.h index aa203107..268073bc 100644 --- a/jni/love/src/common/Data.h +++ b/jni/love/src/common/Data.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/EnumMap.h b/jni/love/src/common/EnumMap.h index af666084..ca6c7252 100644 --- a/jni/love/src/common/EnumMap.h +++ b/jni/love/src/common/EnumMap.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Exception.cpp b/jni/love/src/common/Exception.cpp index 9f8a58b3..69a9639a 100644 --- a/jni/love/src/common/Exception.cpp +++ b/jni/love/src/common/Exception.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Exception.h b/jni/love/src/common/Exception.h index 49d9961d..84685b9a 100644 --- a/jni/love/src/common/Exception.h +++ b/jni/love/src/common/Exception.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Matrix.cpp b/jni/love/src/common/Matrix.cpp index d403e8b0..d2307ee7 100644 --- a/jni/love/src/common/Matrix.cpp +++ b/jni/love/src/common/Matrix.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -37,6 +37,11 @@ Matrix::Matrix() setIdentity(); } +Matrix::Matrix(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky) +{ + setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky); +} + Matrix::~Matrix() { } diff --git a/jni/love/src/common/Matrix.h b/jni/love/src/common/Matrix.h index 0e33b37d..9815d28f 100644 --- a/jni/love/src/common/Matrix.h +++ b/jni/love/src/common/Matrix.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -41,6 +41,11 @@ public: **/ Matrix(); + /** + * Creates a new matrix set to a transformation. + **/ + Matrix(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky); + /** * Destructor. **/ diff --git a/jni/love/src/common/Memoizer.cpp b/jni/love/src/common/Memoizer.cpp index 8d6ec7d4..2f3eac51 100644 --- a/jni/love/src/common/Memoizer.cpp +++ b/jni/love/src/common/Memoizer.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Memoizer.h b/jni/love/src/common/Memoizer.h index a110b7af..a99521ba 100644 --- a/jni/love/src/common/Memoizer.h +++ b/jni/love/src/common/Memoizer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Module.cpp b/jni/love/src/common/Module.cpp index 049da405..e5fcd72a 100644 --- a/jni/love/src/common/Module.cpp +++ b/jni/love/src/common/Module.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Module.h b/jni/love/src/common/Module.h index a3b66335..cac50a3c 100644 --- a/jni/love/src/common/Module.h +++ b/jni/love/src/common/Module.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Object.cpp b/jni/love/src/common/Object.cpp index dc7df230..c821569b 100644 --- a/jni/love/src/common/Object.cpp +++ b/jni/love/src/common/Object.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Object.h b/jni/love/src/common/Object.h index 791c1dac..d362c5ce 100644 --- a/jni/love/src/common/Object.h +++ b/jni/love/src/common/Object.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Reference.cpp b/jni/love/src/common/Reference.cpp index d2ea0577..e077c3d6 100644 --- a/jni/love/src/common/Reference.cpp +++ b/jni/love/src/common/Reference.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Reference.h b/jni/love/src/common/Reference.h index eb8e8b28..29506953 100644 --- a/jni/love/src/common/Reference.h +++ b/jni/love/src/common/Reference.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/StringMap.h b/jni/love/src/common/StringMap.h index 456a4605..dfc7f414 100644 --- a/jni/love/src/common/StringMap.h +++ b/jni/love/src/common/StringMap.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Variant.cpp b/jni/love/src/common/Variant.cpp index 654d284f..8a55274f 100644 --- a/jni/love/src/common/Variant.cpp +++ b/jni/love/src/common/Variant.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Variant.h b/jni/love/src/common/Variant.h index dd8b68fa..d52e510f 100644 --- a/jni/love/src/common/Variant.h +++ b/jni/love/src/common/Variant.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Vector.cpp b/jni/love/src/common/Vector.cpp index c2d37869..5707dcd9 100644 --- a/jni/love/src/common/Vector.cpp +++ b/jni/love/src/common/Vector.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/Vector.h b/jni/love/src/common/Vector.h index 8342af98..3aeb9fdb 100644 --- a/jni/love/src/common/Vector.h +++ b/jni/love/src/common/Vector.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/b64.cpp b/jni/love/src/common/b64.cpp index c4009187..a404d8f0 100644 --- a/jni/love/src/common/b64.cpp +++ b/jni/love/src/common/b64.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/b64.h b/jni/love/src/common/b64.h index 55fe47de..0d1b5557 100644 --- a/jni/love/src/common/b64.h +++ b/jni/love/src/common/b64.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/config.h b/jni/love/src/common/config.h index 3333e71b..47023d1f 100644 --- a/jni/love/src/common/config.h +++ b/jni/love/src/common/config.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/delay.cpp b/jni/love/src/common/delay.cpp index 932231e6..1ee8d07d 100644 --- a/jni/love/src/common/delay.cpp +++ b/jni/love/src/common/delay.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/delay.h b/jni/love/src/common/delay.h index aa574ca3..3e5284c1 100644 --- a/jni/love/src/common/delay.h +++ b/jni/love/src/common/delay.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/int.h b/jni/love/src/common/int.h index 42ff9e24..56a7a9a2 100644 --- a/jni/love/src/common/int.h +++ b/jni/love/src/common/int.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/math.h b/jni/love/src/common/math.h index 7fe57a21..22681db4 100644 --- a/jni/love/src/common/math.h +++ b/jni/love/src/common/math.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/runtime.cpp b/jni/love/src/common/runtime.cpp index 6e4c3413..5c37baba 100644 --- a/jni/love/src/common/runtime.cpp +++ b/jni/love/src/common/runtime.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -398,7 +398,10 @@ void luax_rawnewtype(lua_State *L, const char *name, bits flags, love::Object *o void luax_pushtype(lua_State *L, const char *name, bits flags, love::Object *object) { if (object == nullptr) + { lua_pushnil(L); + return; + } // Fetch the registry table of instantiated types. luax_getregistry(L, REGISTRY_TYPES); diff --git a/jni/love/src/common/runtime.h b/jni/love/src/common/runtime.h index 2bb907fa..e0002cca 100644 --- a/jni/love/src/common/runtime.h +++ b/jni/love/src/common/runtime.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/types.h b/jni/love/src/common/types.h index e9319ea5..4d71ec03 100644 --- a/jni/love/src/common/types.h +++ b/jni/love/src/common/types.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/utf8.cpp b/jni/love/src/common/utf8.cpp index 2d593c75..6ec419df 100755 --- a/jni/love/src/common/utf8.cpp +++ b/jni/love/src/common/utf8.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/utf8.h b/jni/love/src/common/utf8.h index cd7867ec..bbd02600 100755 --- a/jni/love/src/common/utf8.h +++ b/jni/love/src/common/utf8.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/version.h b/jni/love/src/common/version.h index 68b5f6b9..ba4b1525 100644 --- a/jni/love/src/common/version.h +++ b/jni/love/src/common/version.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/wrap_Data.cpp b/jni/love/src/common/wrap_Data.cpp index 76a8b687..1485326b 100644 --- a/jni/love/src/common/wrap_Data.cpp +++ b/jni/love/src/common/wrap_Data.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/common/wrap_Data.h b/jni/love/src/common/wrap_Data.h index 94cc31cd..50c944fe 100644 --- a/jni/love/src/common/wrap_Data.h +++ b/jni/love/src/common/wrap_Data.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp b/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp index 25af2415..f1ed2cca 100755 --- a/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp +++ b/jni/love/src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp @@ -19,8 +19,7 @@ #include #include #include -#include -#include +#include b2ChainShape::~b2ChainShape() { diff --git a/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.cpp b/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.cpp index 5cd6f0e8..f46e4d09 100755 --- a/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.cpp +++ b/jni/love/src/libraries/Box2D/Collision/b2BroadPhase.cpp @@ -17,7 +17,7 @@ */ #include -#include +#include b2BroadPhase::b2BroadPhase() { diff --git a/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.cpp b/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.cpp index 2ccb2d94..ef57b422 100755 --- a/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.cpp +++ b/jni/love/src/libraries/Box2D/Collision/b2DynamicTree.cpp @@ -17,8 +17,7 @@ */ #include -#include -#include +#include b2DynamicTree::b2DynamicTree() { diff --git a/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.cpp b/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.cpp index af81a593..f16db702 100755 --- a/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.cpp +++ b/jni/love/src/libraries/Box2D/Common/b2BlockAllocator.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include #include #include diff --git a/jni/love/src/libraries/Box2D/Common/b2GrowableStack.h b/jni/love/src/libraries/Box2D/Common/b2GrowableStack.h index 44813e3e..98924771 100755 --- a/jni/love/src/libraries/Box2D/Common/b2GrowableStack.h +++ b/jni/love/src/libraries/Box2D/Common/b2GrowableStack.h @@ -19,7 +19,6 @@ #ifndef B2_GROWABLE_STACK_H #define B2_GROWABLE_STACK_H #include -#include #include /// This is a growable LIFO stack with an initial capacity of N. diff --git a/jni/love/src/libraries/ddsparse/ddsparse.cpp b/jni/love/src/libraries/ddsparse/ddsparse.cpp index f6fe62bc..4fbdd16a 100644 --- a/jni/love/src/libraries/ddsparse/ddsparse.cpp +++ b/jni/love/src/libraries/ddsparse/ddsparse.cpp @@ -116,7 +116,7 @@ static Format parseDX10Format(DXGIFormat fmt) f = FORMAT_BC6H; break; case DXGI_FORMAT_BC6H_SF16: - f = FORAMT_BC6Hs; + f = FORMAT_BC6Hs; break; case DXGI_FORMAT_BC7_TYPELESS: case DXGI_FORMAT_BC7_UNORM: diff --git a/jni/love/src/libraries/ddsparse/ddsparse.h b/jni/love/src/libraries/ddsparse/ddsparse.h index 6ab65934..425919ba 100644 --- a/jni/love/src/libraries/ddsparse/ddsparse.h +++ b/jni/love/src/libraries/ddsparse/ddsparse.h @@ -45,7 +45,7 @@ enum Format FORMAT_BC5, FORMAT_BC5s, FORMAT_BC6H, - FORAMT_BC6Hs, + FORMAT_BC6Hs, FORMAT_BC7, FORMAT_BC7srgb, // sRGB color space. FORMAT_UNKNOWN diff --git a/jni/love/src/libraries/enet/enet.cpp b/jni/love/src/libraries/enet/enet.cpp index 7d915cfc..04b3b4a4 100644 --- a/jni/love/src/libraries/enet/enet.cpp +++ b/jni/love/src/libraries/enet/enet.cpp @@ -1,6 +1,6 @@ /** * - * Copyright (C) 2011 by Leaf Corcoran + * Copyright (C) 2014 by Leaf Corcoran * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -40,9 +40,9 @@ extern "C" { /** * Parse address string, eg: - * *:5959 - * 127.0.0.1:* - * website.com:8080 + * *:5959 + * 127.0.0.1:* + * website.com:8080 */ static void parse_address(lua_State *l, const char *addr_str, ENetAddress *address) { int host_i = 0, port_i = 0; @@ -204,11 +204,11 @@ static ENetPacket *read_packet(lua_State *l, int idx, enet_uint8 *channel_id) { /** * Create a new host * Args: - * address (nil for client) - * [peer_count = 64] - * [channel_count = 1] - * [in_bandwidth = 0] - * [out_bandwidth = 0] + * address (nil for client) + * [peer_count = 64] + * [channel_count = 1] + * [in_bandwidth = 0] + * [out_bandwidth = 0] */ static int host_create(lua_State *l) { ENetHost *host; @@ -236,7 +236,7 @@ static int host_create(lua_State *l) { } // printf("host create, peers=%d, channels=%d, in=%d, out=%d\n", - // peer_count, channel_count, in_bandwidth, out_bandwidth); + // peer_count, channel_count, in_bandwidth, out_bandwidth); host = enet_host_create(have_address ? &address : NULL, peer_count, channel_count, in_bandwidth, out_bandwidth); @@ -264,14 +264,17 @@ static int linked_version(lua_State *l) { /** * Serice a host * Args: - * timeout + * timeout * * Return - * nil on no event - * an event table on event + * nil on no event + * an event table on event */ static int host_service(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } ENetEvent event; int timeout = 0, out; @@ -291,6 +294,9 @@ static int host_service(lua_State *l) { */ static int host_check_events(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } ENetEvent event; int out = enet_host_check_events(host, &event); if (out == 0) return 0; @@ -306,6 +312,9 @@ static int host_check_events(lua_State *l) { */ static int host_compress_with_range_coder(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } int result = enet_host_compress_with_range_coder (host); if (result == 0) { @@ -320,12 +329,15 @@ static int host_compress_with_range_coder(lua_State *l) { /** * Connect a host to an address * Args: - * the address - * [channel_count = 1] - * [data = 0] + * the address + * [channel_count = 1] + * [data = 0] */ static int host_connect(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } ENetAddress address; ENetPeer *peer; @@ -355,12 +367,18 @@ static int host_connect(lua_State *l) { static int host_flush(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } enet_host_flush(host); return 0; } static int host_broadcast(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } enet_uint8 channel_id; ENetPacket *packet = read_packet(l, 2, &channel_id); @@ -371,6 +389,9 @@ static int host_broadcast(lua_State *l) { // Args: limit:number static int host_channel_limit(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } int limit = luaL_checkint(l, 2); enet_host_channel_limit(host, limit); return 0; @@ -378,14 +399,20 @@ static int host_channel_limit(lua_State *l) { static int host_bandwidth_limit(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } enet_uint32 in_bandwidth = luaL_checkint(l, 2); enet_uint32 out_bandwidth = luaL_checkint(l, 2); enet_host_bandwidth_limit(host, in_bandwidth, out_bandwidth); return 0; } -static int host_socket_get_address(lua_State *l) { +static int host_get_socket_address(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } ENetAddress address; enet_socket_get_address (host->socket, &address); @@ -399,6 +426,9 @@ static int host_socket_get_address(lua_State *l) { } static int host_total_sent_data(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } lua_pushinteger (l, host->totalSentData); @@ -407,6 +437,9 @@ static int host_total_sent_data(lua_State *l) { static int host_total_received_data(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } lua_pushinteger (l, host->totalReceivedData); @@ -414,6 +447,9 @@ static int host_total_received_data(lua_State *l) { } static int host_service_time(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } lua_pushinteger (l, host->serviceTime); @@ -422,6 +458,9 @@ static int host_service_time(lua_State *l) { static int host_peer_count(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } lua_pushinteger (l, host->peerCount); @@ -430,6 +469,9 @@ static int host_peer_count(lua_State *l) { static int host_get_peer(lua_State *l) { ENetHost *host = check_host(l, 1); + if (!host) { + return luaL_error(l, "Tried to index a nil host!"); + } int peer_index = luaL_checkint(l, 2) - 1; @@ -444,8 +486,13 @@ static int host_get_peer(lua_State *l) { } static int host_gc(lua_State *l) { - ENetHost *host = check_host(l, 1); - enet_host_destroy(host); + // We have to manually grab the userdata so that we can set it to NULL. + ENetHost** host = (ENetHost**)luaL_checkudata(l, 1, "enet_host"); + // We don't want to crash by destroying a non-existant host. + if (*host) { + enet_host_destroy(*host); + } + *host = NULL; return 0; } @@ -653,9 +700,9 @@ static int peer_receive(lua_State *l) { /** * Send a lua string to a peer * Args: - * packet data, string - * channel id - * flags ["reliable", nil] + * packet data, string + * channel id + * flags ["reliable", nil] * */ static int peer_send(lua_State *l) { @@ -684,7 +731,14 @@ static const struct luaL_Reg enet_host_funcs [] = { {"broadcast", host_broadcast}, {"channel_limit", host_channel_limit}, {"bandwidth_limit", host_bandwidth_limit}, - {"socket_get_address", host_socket_get_address}, + // Since ENetSocket isn't part of enet-lua, we should try to keep + // naming conventions the same as the rest of the lib. + {"get_socket_address", host_get_socket_address}, + // TODO: Remove the line below in future versions, it's for backward + // compatibility only. + {"socket_get_address", host_get_socket_address}, + // We need this function to free up our ports when needed! + {"destroy", host_gc}, // additional convenience functions (mostly accessors) {"total_sent_data", host_total_sent_data}, diff --git a/jni/love/src/libraries/enet/lua-enet.h b/jni/love/src/libraries/enet/lua-enet.h index e42fcf0f..75cc985e 100644 --- a/jni/love/src/libraries/enet/lua-enet.h +++ b/jni/love/src/libraries/enet/lua-enet.h @@ -1,5 +1,5 @@ /** -* Copyright (c) 2006-2014 LOVE Development Team +* Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/libraries/luasocket/luasocket.cpp b/jni/love/src/libraries/luasocket/luasocket.cpp index b7a5cb21..57a1544c 100644 --- a/jni/love/src/libraries/luasocket/luasocket.cpp +++ b/jni/love/src/libraries/luasocket/luasocket.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/libraries/luasocket/luasocket.h b/jni/love/src/libraries/luasocket/luasocket.h index 804061e6..93a623e4 100644 --- a/jni/love/src/libraries/luasocket/luasocket.h +++ b/jni/love/src/libraries/luasocket/luasocket.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/love.cpp b/jni/love/src/love.cpp index 2a46f235..000b8678 100644 --- a/jni/love/src/love.cpp +++ b/jni/love/src/love.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -217,7 +217,7 @@ int main(int argc, char **argv) lua_pushstring(L, "love"); lua_call(L, 1, 1); // leave the returned table on the stack. - // Add love.__exe = true. + // Add love._exe = true. // This indicates that we're running the standalone version of love, and not // the library version. { diff --git a/jni/love/src/modules/audio/Audio.cpp b/jni/love/src/modules/audio/Audio.cpp index e9240add..398cc787 100644 --- a/jni/love/src/modules/audio/Audio.cpp +++ b/jni/love/src/modules/audio/Audio.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/Audio.h b/jni/love/src/modules/audio/Audio.h index e02cb970..9405bde3 100644 --- a/jni/love/src/modules/audio/Audio.h +++ b/jni/love/src/modules/audio/Audio.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/Source.cpp b/jni/love/src/modules/audio/Source.cpp index 10a89fe6..bc81f5f0 100644 --- a/jni/love/src/modules/audio/Source.cpp +++ b/jni/love/src/modules/audio/Source.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/Source.h b/jni/love/src/modules/audio/Source.h index bf2756b0..1aab7363 100644 --- a/jni/love/src/modules/audio/Source.h +++ b/jni/love/src/modules/audio/Source.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/null/Audio.cpp b/jni/love/src/modules/audio/null/Audio.cpp index 6b6fd3f9..6e950d23 100644 --- a/jni/love/src/modules/audio/null/Audio.cpp +++ b/jni/love/src/modules/audio/null/Audio.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/null/Audio.h b/jni/love/src/modules/audio/null/Audio.h index 372f756c..852aebda 100644 --- a/jni/love/src/modules/audio/null/Audio.h +++ b/jni/love/src/modules/audio/null/Audio.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/null/Source.cpp b/jni/love/src/modules/audio/null/Source.cpp index 0fc043cc..0db59550 100644 --- a/jni/love/src/modules/audio/null/Source.cpp +++ b/jni/love/src/modules/audio/null/Source.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/null/Source.h b/jni/love/src/modules/audio/null/Source.h index 326ff23d..dcbe4714 100644 --- a/jni/love/src/modules/audio/null/Source.h +++ b/jni/love/src/modules/audio/null/Source.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/openal/Audio.cpp b/jni/love/src/modules/audio/openal/Audio.cpp index cc5fdd4f..59e96dda 100644 --- a/jni/love/src/modules/audio/openal/Audio.cpp +++ b/jni/love/src/modules/audio/openal/Audio.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/openal/Audio.h b/jni/love/src/modules/audio/openal/Audio.h index 9e0ccb44..bec9082c 100644 --- a/jni/love/src/modules/audio/openal/Audio.h +++ b/jni/love/src/modules/audio/openal/Audio.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,6 @@ // STD #include #include -#include #include // LOVE diff --git a/jni/love/src/modules/audio/openal/Pool.cpp b/jni/love/src/modules/audio/openal/Pool.cpp index 3472c249..7491c189 100644 --- a/jni/love/src/modules/audio/openal/Pool.cpp +++ b/jni/love/src/modules/audio/openal/Pool.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/openal/Pool.h b/jni/love/src/modules/audio/openal/Pool.h index f0896ea9..dc596012 100644 --- a/jni/love/src/modules/audio/openal/Pool.h +++ b/jni/love/src/modules/audio/openal/Pool.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,6 @@ // STD #include #include -#include #include // LOVE diff --git a/jni/love/src/modules/audio/openal/Source.cpp b/jni/love/src/modules/audio/openal/Source.cpp index 20d2daf0..4be115da 100644 --- a/jni/love/src/modules/audio/openal/Source.cpp +++ b/jni/love/src/modules/audio/openal/Source.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -68,7 +68,10 @@ Source::Source(Pool *pool, love::sound::SoundData *soundData) , toLoop(0) { ALenum fmt = getFormat(soundData->getChannels(), soundData->getBitDepth()); - staticBuffer = new StaticDataBuffer(fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate()); + staticBuffer.set(new StaticDataBuffer(fmt, soundData->getData(), soundData->getSize(), soundData->getSampleRate())); + + // The buffer has a +2 retain count right now, but we want it to have +1. + staticBuffer->release(); float z[3] = {0, 0, 0}; diff --git a/jni/love/src/modules/audio/openal/Source.h b/jni/love/src/modules/audio/openal/Source.h index 6c923e3e..24824cf2 100644 --- a/jni/love/src/modules/audio/openal/Source.h +++ b/jni/love/src/modules/audio/openal/Source.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -145,7 +145,7 @@ private: ALuint source; bool valid; - static const unsigned int MAX_BUFFERS = 32; + static const unsigned int MAX_BUFFERS = 8; ALuint streamBuffers[MAX_BUFFERS]; Object::StrongRef staticBuffer; diff --git a/jni/love/src/modules/audio/wrap_Audio.cpp b/jni/love/src/modules/audio/wrap_Audio.cpp index c2be44f8..a1829ef1 100644 --- a/jni/love/src/modules/audio/wrap_Audio.cpp +++ b/jni/love/src/modules/audio/wrap_Audio.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -26,6 +26,9 @@ #include "common/runtime.h" +// C++ +#include + namespace love { namespace audio diff --git a/jni/love/src/modules/audio/wrap_Audio.h b/jni/love/src/modules/audio/wrap_Audio.h index 1960e0d1..31d9af13 100644 --- a/jni/love/src/modules/audio/wrap_Audio.h +++ b/jni/love/src/modules/audio/wrap_Audio.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/wrap_Source.cpp b/jni/love/src/modules/audio/wrap_Source.cpp index 1f199b81..ba5d64e5 100644 --- a/jni/love/src/modules/audio/wrap_Source.cpp +++ b/jni/love/src/modules/audio/wrap_Source.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/audio/wrap_Source.h b/jni/love/src/modules/audio/wrap_Source.h index 0a49b4c6..008ceae1 100644 --- a/jni/love/src/modules/audio/wrap_Source.h +++ b/jni/love/src/modules/audio/wrap_Source.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/event/Event.cpp b/jni/love/src/modules/event/Event.cpp index 874b1ded..cb789d08 100644 --- a/jni/love/src/modules/event/Event.cpp +++ b/jni/love/src/modules/event/Event.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/event/Event.h b/jni/love/src/modules/event/Event.h index 92f0fadb..b3a3d78c 100644 --- a/jni/love/src/modules/event/Event.h +++ b/jni/love/src/modules/event/Event.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/event/sdl/Event.cpp b/jni/love/src/modules/event/sdl/Event.cpp index 56a8fecc..894c7e70 100644 --- a/jni/love/src/modules/event/sdl/Event.cpp +++ b/jni/love/src/modules/event/sdl/Event.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -45,17 +45,11 @@ namespace sdl static void windowToPixelCoords(int *x, int *y) { #ifndef LOVE_ANDROID - double scale = 1.0; - window::Window *window = Module::getInstance(Module::M_WINDOW); - if (window != nullptr) - scale = window->getPixelScale(); - - if (x != nullptr) - *x = int(double(*x) * scale); - - if (y != nullptr) - *y = int(double(*y) * scale); + if (window && x) + *x = (int) window->toPixels(*x); + if (window && y) + *y = (int) window->toPixels(*y); #endif } @@ -109,15 +103,11 @@ Event::~Event() void Event::pump() { - SDL_PumpEvents(); - - static SDL_Event e; - - Message *msg; + SDL_Event e; while (SDL_PollEvent(&e)) { - msg = convert(e); + Message *msg = convert(e); if (msg) { push(msg); @@ -128,16 +118,17 @@ void Event::pump() Message *Event::wait() { - static SDL_Event e; - bool ok = (SDL_WaitEvent(&e) == 1); - if (!ok) - return NULL; + SDL_Event e; + + if (SDL_WaitEvent(&e) != 1) + return nullptr; + return convert(e); } void Event::clear() { - static SDL_Event e; + SDL_Event e; while (SDL_PollEvent(&e)) { diff --git a/jni/love/src/modules/event/sdl/Event.h b/jni/love/src/modules/event/sdl/Event.h index 1028a721..5e1a9b4c 100644 --- a/jni/love/src/modules/event/sdl/Event.h +++ b/jni/love/src/modules/event/sdl/Event.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ #include "common/EnumMap.h" // SDL -#include +#include // STL #include diff --git a/jni/love/src/modules/event/sdl/wrap_Event.cpp b/jni/love/src/modules/event/sdl/wrap_Event.cpp index b652ec41..dc76f991 100644 --- a/jni/love/src/modules/event/sdl/wrap_Event.cpp +++ b/jni/love/src/modules/event/sdl/wrap_Event.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/event/sdl/wrap_Event.h b/jni/love/src/modules/event/sdl/wrap_Event.h index b689335a..b99b433e 100644 --- a/jni/love/src/modules/event/sdl/wrap_Event.h +++ b/jni/love/src/modules/event/sdl/wrap_Event.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/File.cpp b/jni/love/src/modules/filesystem/File.cpp index ef20621d..ffc301b7 100644 --- a/jni/love/src/modules/filesystem/File.cpp +++ b/jni/love/src/modules/filesystem/File.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/File.h b/jni/love/src/modules/filesystem/File.h index e0be859e..f7a161f1 100644 --- a/jni/love/src/modules/filesystem/File.h +++ b/jni/love/src/modules/filesystem/File.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/FileData.cpp b/jni/love/src/modules/filesystem/FileData.cpp index 4da8ea43..d8c055d4 100644 --- a/jni/love/src/modules/filesystem/FileData.cpp +++ b/jni/love/src/modules/filesystem/FileData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/FileData.h b/jni/love/src/modules/filesystem/FileData.h index 55a0eee0..b35b13cd 100644 --- a/jni/love/src/modules/filesystem/FileData.h +++ b/jni/love/src/modules/filesystem/FileData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/physfs/File.cpp b/jni/love/src/modules/filesystem/physfs/File.cpp index be137c4b..790398b9 100644 --- a/jni/love/src/modules/filesystem/physfs/File.cpp +++ b/jni/love/src/modules/filesystem/physfs/File.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/physfs/File.h b/jni/love/src/modules/filesystem/physfs/File.h index a3fe3379..5738fbc3 100644 --- a/jni/love/src/modules/filesystem/physfs/File.h +++ b/jni/love/src/modules/filesystem/physfs/File.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/physfs/Filesystem.cpp b/jni/love/src/modules/filesystem/physfs/Filesystem.cpp index 038557a2..8690ccee 100644 --- a/jni/love/src/modules/filesystem/physfs/Filesystem.cpp +++ b/jni/love/src/modules/filesystem/physfs/Filesystem.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/physfs/Filesystem.h b/jni/love/src/modules/filesystem/physfs/Filesystem.h index 8c2f9620..23d7eb1f 100644 --- a/jni/love/src/modules/filesystem/physfs/Filesystem.h +++ b/jni/love/src/modules/filesystem/physfs/Filesystem.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -24,7 +24,6 @@ // STD #include #include -#include #include // LOVE diff --git a/jni/love/src/modules/filesystem/wrap_File.cpp b/jni/love/src/modules/filesystem/wrap_File.cpp index dda6da74..f31a8932 100644 --- a/jni/love/src/modules/filesystem/wrap_File.cpp +++ b/jni/love/src/modules/filesystem/wrap_File.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/wrap_File.h b/jni/love/src/modules/filesystem/wrap_File.h index d4bd65d7..0f78074d 100644 --- a/jni/love/src/modules/filesystem/wrap_File.h +++ b/jni/love/src/modules/filesystem/wrap_File.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/wrap_FileData.cpp b/jni/love/src/modules/filesystem/wrap_FileData.cpp index 3b78c47a..fdf768f6 100644 --- a/jni/love/src/modules/filesystem/wrap_FileData.cpp +++ b/jni/love/src/modules/filesystem/wrap_FileData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/wrap_FileData.h b/jni/love/src/modules/filesystem/wrap_FileData.h index 32638702..703e4ce4 100644 --- a/jni/love/src/modules/filesystem/wrap_FileData.h +++ b/jni/love/src/modules/filesystem/wrap_FileData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/wrap_Filesystem.cpp b/jni/love/src/modules/filesystem/wrap_Filesystem.cpp index 6384e7ba..59af698c 100644 --- a/jni/love/src/modules/filesystem/wrap_Filesystem.cpp +++ b/jni/love/src/modules/filesystem/wrap_Filesystem.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/filesystem/wrap_Filesystem.h b/jni/love/src/modules/filesystem/wrap_Filesystem.h index eb50dbf9..4c6f3953 100644 --- a/jni/love/src/modules/filesystem/wrap_Filesystem.h +++ b/jni/love/src/modules/filesystem/wrap_Filesystem.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/Font.h b/jni/love/src/modules/font/Font.h index fbcf4298..eb57889d 100644 --- a/jni/love/src/modules/font/Font.h +++ b/jni/love/src/modules/font/Font.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/GlyphData.cpp b/jni/love/src/modules/font/GlyphData.cpp index 7ed2b3db..b507e840 100644 --- a/jni/love/src/modules/font/GlyphData.cpp +++ b/jni/love/src/modules/font/GlyphData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -106,7 +106,7 @@ std::string GlyphData::getGlyphString() const } catch (utf8::exception &e) { - throw love::Exception("Decoding error: %s", e.what()); + throw love::Exception("UTF-8 decoding error: %s", e.what()); } // Just in case... diff --git a/jni/love/src/modules/font/GlyphData.h b/jni/love/src/modules/font/GlyphData.h index a7775594..a065dce8 100644 --- a/jni/love/src/modules/font/GlyphData.h +++ b/jni/love/src/modules/font/GlyphData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/ImageRasterizer.cpp b/jni/love/src/modules/font/ImageRasterizer.cpp index f7d1fada..410218fd 100644 --- a/jni/love/src/modules/font/ImageRasterizer.cpp +++ b/jni/love/src/modules/font/ImageRasterizer.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/ImageRasterizer.h b/jni/love/src/modules/font/ImageRasterizer.h index 59a16205..20d00615 100644 --- a/jni/love/src/modules/font/ImageRasterizer.h +++ b/jni/love/src/modules/font/ImageRasterizer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/Rasterizer.cpp b/jni/love/src/modules/font/Rasterizer.cpp index cec9f0be..eecb5892 100644 --- a/jni/love/src/modules/font/Rasterizer.cpp +++ b/jni/love/src/modules/font/Rasterizer.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -63,7 +63,7 @@ GlyphData *Rasterizer::getGlyphData(const std::string &text) const } catch (utf8::exception &e) { - throw love::Exception("Decoding error: %s", e.what()); + throw love::Exception("UTF-8 decoding error: %s", e.what()); } return getGlyphData(codepoint); @@ -89,7 +89,7 @@ bool Rasterizer::hasGlyphs(const std::string &text) const } catch (utf8::exception &e) { - throw love::Exception("Decoding error: %s", e.what()); + throw love::Exception("UTF-8 decoding error: %s", e.what()); } return true; diff --git a/jni/love/src/modules/font/Rasterizer.h b/jni/love/src/modules/font/Rasterizer.h index ff1cd22e..97752223 100644 --- a/jni/love/src/modules/font/Rasterizer.h +++ b/jni/love/src/modules/font/Rasterizer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/freetype/Font.cpp b/jni/love/src/modules/font/freetype/Font.cpp index ece8e8dd..f1c239e9 100644 --- a/jni/love/src/modules/font/freetype/Font.cpp +++ b/jni/love/src/modules/font/freetype/Font.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -66,7 +66,7 @@ Rasterizer *Font::newRasterizer(love::image::ImageData *data, const std::string catch (utf8::exception &e) { delete [] glyphs; - throw love::Exception("Decoding error: %s", e.what()); + throw love::Exception("UTF-8 decoding error: %s", e.what()); } Rasterizer *r = newRasterizer(data, glyphs, numglyphs); @@ -90,7 +90,7 @@ GlyphData *Font::newGlyphData(Rasterizer *r, const std::string &text) } catch (utf8::exception &e) { - throw love::Exception("Decoding error: %s", e.what()); + throw love::Exception("UTF-8 decoding error: %s", e.what()); } return r->getGlyphData(codepoint); diff --git a/jni/love/src/modules/font/freetype/Font.h b/jni/love/src/modules/font/freetype/Font.h index 814ee63b..3a7216aa 100644 --- a/jni/love/src/modules/font/freetype/Font.h +++ b/jni/love/src/modules/font/freetype/Font.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/freetype/TrueTypeRasterizer.cpp b/jni/love/src/modules/font/freetype/TrueTypeRasterizer.cpp index 0cf92f87..71b6a5c1 100644 --- a/jni/love/src/modules/font/freetype/TrueTypeRasterizer.cpp +++ b/jni/love/src/modules/font/freetype/TrueTypeRasterizer.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/freetype/TrueTypeRasterizer.h b/jni/love/src/modules/font/freetype/TrueTypeRasterizer.h index 6ddaf046..8f3caf52 100644 --- a/jni/love/src/modules/font/freetype/TrueTypeRasterizer.h +++ b/jni/love/src/modules/font/freetype/TrueTypeRasterizer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/freetype/wrap_Font.cpp b/jni/love/src/modules/font/freetype/wrap_Font.cpp index 53459447..574e3f58 100644 --- a/jni/love/src/modules/font/freetype/wrap_Font.cpp +++ b/jni/love/src/modules/font/freetype/wrap_Font.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/freetype/wrap_Font.h b/jni/love/src/modules/font/freetype/wrap_Font.h index 6cf7b7b0..d5af7efb 100644 --- a/jni/love/src/modules/font/freetype/wrap_Font.h +++ b/jni/love/src/modules/font/freetype/wrap_Font.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/wrap_GlyphData.cpp b/jni/love/src/modules/font/wrap_GlyphData.cpp index 9a8bcfb6..d38e5d96 100644 --- a/jni/love/src/modules/font/wrap_GlyphData.cpp +++ b/jni/love/src/modules/font/wrap_GlyphData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/wrap_GlyphData.h b/jni/love/src/modules/font/wrap_GlyphData.h index 72ed79bb..3d485dc3 100644 --- a/jni/love/src/modules/font/wrap_GlyphData.h +++ b/jni/love/src/modules/font/wrap_GlyphData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/wrap_Rasterizer.cpp b/jni/love/src/modules/font/wrap_Rasterizer.cpp index 99844ba8..0ba4285a 100644 --- a/jni/love/src/modules/font/wrap_Rasterizer.cpp +++ b/jni/love/src/modules/font/wrap_Rasterizer.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/font/wrap_Rasterizer.h b/jni/love/src/modules/font/wrap_Rasterizer.h index e2b895ee..b8d6eae1 100644 --- a/jni/love/src/modules/font/wrap_Rasterizer.h +++ b/jni/love/src/modules/font/wrap_Rasterizer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/Drawable.h b/jni/love/src/modules/graphics/Drawable.h index a4cd7e2f..8cbd8022 100644 --- a/jni/love/src/modules/graphics/Drawable.h +++ b/jni/love/src/modules/graphics/Drawable.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/Graphics.cpp b/jni/love/src/modules/graphics/Graphics.cpp index 82c27382..4dc4a271 100644 --- a/jni/love/src/modules/graphics/Graphics.cpp +++ b/jni/love/src/modules/graphics/Graphics.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/Graphics.h b/jni/love/src/modules/graphics/Graphics.h index 97e9cf3c..b50155ee 100644 --- a/jni/love/src/modules/graphics/Graphics.h +++ b/jni/love/src/modules/graphics/Graphics.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/Quad.cpp b/jni/love/src/modules/graphics/Quad.cpp index 4f0ba472..0eb60d1c 100644 --- a/jni/love/src/modules/graphics/Quad.cpp +++ b/jni/love/src/modules/graphics/Quad.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/Quad.h b/jni/love/src/modules/graphics/Quad.h index d8c5ca88..99047513 100644 --- a/jni/love/src/modules/graphics/Quad.h +++ b/jni/love/src/modules/graphics/Quad.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/Texture.cpp b/jni/love/src/modules/graphics/Texture.cpp index 477eb33c..891a3800 100644 --- a/jni/love/src/modules/graphics/Texture.cpp +++ b/jni/love/src/modules/graphics/Texture.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -121,6 +121,7 @@ StringMap::Entry Texture::wrapModeEnt { { "clamp", Texture::WRAP_CLAMP }, { "repeat", Texture::WRAP_REPEAT }, + { "mirroredrepeat", Texture::WRAP_MIRRORED_REPEAT }, }; StringMap Texture::wrapModes(Texture::wrapModeEntries, sizeof(Texture::wrapModeEntries)); diff --git a/jni/love/src/modules/graphics/Texture.h b/jni/love/src/modules/graphics/Texture.h index 87284fd7..d4488d13 100644 --- a/jni/love/src/modules/graphics/Texture.h +++ b/jni/love/src/modules/graphics/Texture.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -44,6 +44,7 @@ public: { WRAP_CLAMP, WRAP_REPEAT, + WRAP_MIRRORED_REPEAT, WRAP_MAX_ENUM }; diff --git a/jni/love/src/modules/graphics/Volatile.cpp b/jni/love/src/modules/graphics/Volatile.cpp index d97b1623..7f53957f 100644 --- a/jni/love/src/modules/graphics/Volatile.cpp +++ b/jni/love/src/modules/graphics/Volatile.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/Volatile.h b/jni/love/src/modules/graphics/Volatile.h index 8fa1e412..1d7f801e 100644 --- a/jni/love/src/modules/graphics/Volatile.h +++ b/jni/love/src/modules/graphics/Volatile.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/Canvas.cpp b/jni/love/src/modules/graphics/opengl/Canvas.cpp index 5e582a50..492eb954 100644 --- a/jni/love/src/modules/graphics/opengl/Canvas.cpp +++ b/jni/love/src/modules/graphics/opengl/Canvas.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/Canvas.h b/jni/love/src/modules/graphics/opengl/Canvas.h index ffdc2f27..46ad5a9d 100644 --- a/jni/love/src/modules/graphics/opengl/Canvas.h +++ b/jni/love/src/modules/graphics/opengl/Canvas.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/Font.cpp b/jni/love/src/modules/graphics/opengl/Font.cpp index f8fca74b..145b187b 100644 --- a/jni/love/src/modules/graphics/opengl/Font.cpp +++ b/jni/love/src/modules/graphics/opengl/Font.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -371,7 +371,7 @@ void Font::print(const std::string &text, float x, float y, float extra_spacing, } catch (utf8::exception &e) { - throw love::Exception("Decoding error: %s", e.what()); + throw love::Exception("UTF-8 decoding error: %s", e.what()); } if (vertexcount <= 0 || glyphinfolist.size() == 0) @@ -466,7 +466,7 @@ int Font::getWidth(const std::string &str) } catch(utf8::exception &e) { - throw love::Exception("Decoding error: %s", e.what()); + throw love::Exception("UTF-8 decoding error: %s", e.what()); } if (width > max_width) diff --git a/jni/love/src/modules/graphics/opengl/Font.h b/jni/love/src/modules/graphics/opengl/Font.h index 8119593e..70f04ad7 100644 --- a/jni/love/src/modules/graphics/opengl/Font.h +++ b/jni/love/src/modules/graphics/opengl/Font.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/Graphics.cpp b/jni/love/src/modules/graphics/opengl/Graphics.cpp index 56159ecb..a9fdbb78 100644 --- a/jni/love/src/modules/graphics/opengl/Graphics.cpp +++ b/jni/love/src/modules/graphics/opengl/Graphics.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -35,6 +35,7 @@ // C #include +#include namespace love { @@ -108,6 +109,9 @@ void Graphics::restoreState(const DisplayState &s) setColorMask(s.colorMask); setWireframe(s.wireframe); + + setDefaultFilter(s.defaultFilter); + setDefaultMipmapFilter(s.defaultMipmapFilter, s.defaultMipmapSharpness); } void Graphics::restoreStateChecked(const DisplayState &s) @@ -165,6 +169,9 @@ void Graphics::restoreStateChecked(const DisplayState &s) if (s.wireframe != cur.wireframe) setWireframe(s.wireframe); + + setDefaultFilter(s.defaultFilter); + setDefaultMipmapFilter(s.defaultMipmapFilter, s.defaultMipmapSharpness); } void Graphics::setViewportSize(int width, int height) @@ -283,7 +290,7 @@ bool Graphics::setMode(int width, int height, bool &sRGB) // Reload all volatile objects. if (!Volatile::loadAll()) - std::cerr << "Could not reload all volatile objects." << std::endl; + ::printf("Could not reload all volatile objects.\n"); // Restore the graphics state. restoreState(states.back()); @@ -662,9 +669,9 @@ Canvas *Graphics::newCanvas(int width, int height, Canvas::Format format, int ms return nullptr; // never reached } -Shader *Graphics::newShader(const Shader::ShaderSources &sources) +Shader *Graphics::newShader(const Shader::ShaderSource &source) { - return new Shader(sources); + return new Shader(source); } Mesh *Graphics::newMesh(const std::vector &vertices, Mesh::DrawMode mode) @@ -701,6 +708,12 @@ Color Graphics::getBackgroundColor() const void Graphics::setFont(Font *font) { + // Hack: the Lua-facing love.graphics.print function will set the current + // font if needed, but only on its first call... we want to make sure a nil + // font is never accidentally set (e.g. via love.graphics.reset.) + if (font == nullptr) + return; + DisplayState &state = states.back(); state.font.set(font); } @@ -877,6 +890,7 @@ Graphics::BlendMode Graphics::getBlendMode() const void Graphics::setDefaultFilter(const Texture::Filter &f) { Texture::setDefaultFilter(f); + states.back().defaultFilter = f; } const Texture::Filter &Graphics::getDefaultFilter() const @@ -888,6 +902,9 @@ void Graphics::setDefaultMipmapFilter(Texture::FilterMode filter, float sharpnes { Image::setDefaultMipmapFilter(filter); Image::setDefaultMipmapSharpness(sharpness); + + states.back().defaultMipmapFilter = filter; + states.back().defaultMipmapSharpness = sharpness; } void Graphics::getDefaultMipmapFilter(Texture::FilterMode *filter, float *sharpness) const @@ -1418,11 +1435,6 @@ void Graphics::pop() { DisplayState &newstate = states[states.size() - 2]; - // Hack: the Lua-facing love.graphics.print function will set the current - // font if needed, but only on its first call... we always want a font. - if (newstate.font.get() == nullptr) - newstate.font.set(states.back().font.get()); - restoreStateChecked(newstate); // The last two states in the stack should be equal now. @@ -1473,6 +1485,9 @@ Graphics::DisplayState::DisplayState() , font(nullptr) , shader(nullptr) , wireframe(false) + , defaultFilter() + , defaultMipmapFilter(Texture::FILTER_NONE) + , defaultMipmapSharpness(0.0f) { // We should just directly initialize the array in the initializer list, but // that feature of C++11 is broken in Visual Studio 2013... @@ -1494,6 +1509,9 @@ Graphics::DisplayState::DisplayState(const DisplayState &other) , shader(other.shader) , canvases(other.canvases) , wireframe(other.wireframe) + , defaultFilter(other.defaultFilter) + , defaultMipmapFilter(other.defaultMipmapFilter) + , defaultMipmapSharpness(other.defaultMipmapSharpness) { for (int i = 0; i < 4; i++) colorMask[i] = other.colorMask[i]; @@ -1525,6 +1543,10 @@ Graphics::DisplayState &Graphics::DisplayState::operator = (const DisplayState & wireframe = other.wireframe; + defaultFilter = other.defaultFilter; + defaultMipmapFilter = other.defaultMipmapFilter; + defaultMipmapSharpness = other.defaultMipmapSharpness; + return *this; } diff --git a/jni/love/src/modules/graphics/opengl/Graphics.h b/jni/love/src/modules/graphics/opengl/Graphics.h index 5360c8b3..298d7e7c 100644 --- a/jni/love/src/modules/graphics/opengl/Graphics.h +++ b/jni/love/src/modules/graphics/opengl/Graphics.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -22,7 +22,6 @@ #define LOVE_GRAPHICS_OPENGL_GRAPHICS_H // STD -#include #include #include @@ -168,7 +167,7 @@ public: Canvas *newCanvas(int width, int height, Canvas::Format format = Canvas::FORMAT_NORMAL, int msaa = 0); - Shader *newShader(const Shader::ShaderSources &sources); + Shader *newShader(const Shader::ShaderSource &source); Mesh *newMesh(const std::vector &vertices, Mesh::DrawMode mode = Mesh::DRAW_MODE_FAN); Mesh *newMesh(int vertexcount, Mesh::DrawMode mode = Mesh::DRAW_MODE_FAN); @@ -478,6 +477,13 @@ private: bool wireframe; + // Default filter. + Texture::Filter defaultFilter; + + // Default mipmap filter and sharpness. + Texture::FilterMode defaultMipmapFilter; + float defaultMipmapSharpness; + DisplayState(); DisplayState(const DisplayState &other); ~DisplayState(); diff --git a/jni/love/src/modules/graphics/opengl/Image.cpp b/jni/love/src/modules/graphics/opengl/Image.cpp index cc786b6a..23f7a9a3 100644 --- a/jni/love/src/modules/graphics/opengl/Image.cpp +++ b/jni/love/src/modules/graphics/opengl/Image.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -260,6 +260,7 @@ void Image::checkMipmapsCreated() void Image::setFilter(const Texture::Filter &f) { + const Filter oldfilter = filter; filter = f; // We don't want filtering or (attempted) mipmaps on the default texture. @@ -277,7 +278,18 @@ void Image::setFilter(const Texture::Filter &f) bind(); gl.setTextureFilter(filter); - checkMipmapsCreated(); + + try + { + checkMipmapsCreated(); + } + catch (love::Exception &) + { + // Don't keep the new mipmap filter if we can't create mipmaps. + filter = oldfilter; + gl.setTextureFilter(filter); + throw; + } } bool Image::setWrap(const Texture::Wrap &w) @@ -646,6 +658,17 @@ GLenum Image::getCompressedFormat(image::CompressedData::Format cformat) const return GL_COMPRESSED_RG_RGTC2; case image::CompressedData::FORMAT_BC5s: return GL_COMPRESSED_SIGNED_RG_RGTC2; + case image::CompressedData::FORMAT_BC6H: + return GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB; + case image::CompressedData::FORMAT_BC6Hs: + return GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB; + case image::CompressedData::FORMAT_BC7: + if (srgb) + return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB; + else + return GL_COMPRESSED_RGBA_BPTC_UNORM_ARB; + case image::CompressedData::FORMAT_BC7SRGB: + return GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB; case image::CompressedData::FORMAT_ETC1: // The ETC2 format can load ETC1 textures. if (GLAD_VERSION_4_3 || GLAD_ES_VERSION_3_0 || GLAD_ARB_ES3_compatibility) @@ -703,6 +726,11 @@ bool Image::hasCompressedTextureSupport(image::CompressedData::Format format) case image::CompressedData::FORMAT_BC5: case image::CompressedData::FORMAT_BC5s: return (GLAD_VERSION_3_0 || GLAD_ARB_texture_compression_rgtc || GLAD_EXT_texture_compression_rgtc); + case image::CompressedData::FORMAT_BC6H: + case image::CompressedData::FORMAT_BC6Hs: + case image::CompressedData::FORMAT_BC7: + case image::CompressedData::FORMAT_BC7SRGB: + return GLAD_VERSION_4_2 || GLAD_ARB_texture_compression_bptc; case image::CompressedData::FORMAT_ETC1: // ETC2 support guarantees ETC1 support as well. return GLAD_VERSION_4_3 || GLAD_ES_VERSION_3_0 || GLAD_ARB_ES3_compatibility || GLAD_OES_compressed_ETC1_RGB8_texture; @@ -712,10 +740,8 @@ bool Image::hasCompressedTextureSupport(image::CompressedData::Format format) case image::CompressedData::FORMAT_PVR1_RGBA4: return GLAD_IMG_texture_compression_pvrtc; default: - break; + return false; } - - return false; } bool Image::hasSRGBSupport() diff --git a/jni/love/src/modules/graphics/opengl/Image.h b/jni/love/src/modules/graphics/opengl/Image.h index 0ff452d9..4236087d 100644 --- a/jni/love/src/modules/graphics/opengl/Image.h +++ b/jni/love/src/modules/graphics/opengl/Image.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/Mesh.cpp b/jni/love/src/modules/graphics/opengl/Mesh.cpp index 7b8e5cc6..7481320d 100644 --- a/jni/love/src/modules/graphics/opengl/Mesh.cpp +++ b/jni/love/src/modules/graphics/opengl/Mesh.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/Mesh.h b/jni/love/src/modules/graphics/opengl/Mesh.h index 5836893d..fab7daca 100644 --- a/jni/love/src/modules/graphics/opengl/Mesh.h +++ b/jni/love/src/modules/graphics/opengl/Mesh.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/OpenGL.cpp b/jni/love/src/modules/graphics/opengl/OpenGL.cpp index cf015129..f23c3760 100644 --- a/jni/love/src/modules/graphics/opengl/OpenGL.cpp +++ b/jni/love/src/modules/graphics/opengl/OpenGL.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -729,86 +729,24 @@ float OpenGL::setTextureFilter(graphics::Texture::Filter &f) return f.anisotropy; } -Texture::Filter OpenGL::getTextureFilter() -{ - GLint gmin, gmag; - glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, &gmin); - glGetTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, &gmag); - - Texture::Filter f; - - switch (gmin) - { - case GL_NEAREST: - f.min = Texture::FILTER_NEAREST; - f.mipmap = Texture::FILTER_NONE; - break; - case GL_NEAREST_MIPMAP_NEAREST: - f.min = f.mipmap = Texture::FILTER_NEAREST; - break; - case GL_NEAREST_MIPMAP_LINEAR: - f.min = Texture::FILTER_NEAREST; - f.mipmap = Texture::FILTER_LINEAR; - break; - case GL_LINEAR_MIPMAP_NEAREST: - f.min = Texture::FILTER_LINEAR; - f.mipmap = Texture::FILTER_NEAREST; - break; - case GL_LINEAR_MIPMAP_LINEAR: - f.min = f.mipmap = Texture::FILTER_LINEAR; - break; - case GL_LINEAR: - default: - f.min = Texture::FILTER_LINEAR; - f.mipmap = Texture::FILTER_NONE; - break; - } - - switch (gmag) - { - case GL_NEAREST: - f.mag = Texture::FILTER_NEAREST; - break; - case GL_LINEAR: - default: - f.mag = Texture::FILTER_LINEAR; - break; - } - - if (GLAD_EXT_texture_filter_anisotropic) - glGetTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, &f.anisotropy); - - return f; -} - void OpenGL::setTextureWrap(const graphics::Texture::Wrap &w) { - GLint gs, gt; - - switch (w.s) + auto glWrapMode = [](Texture::WrapMode wmode) -> GLint { - case Texture::WRAP_CLAMP: - gs = GL_CLAMP_TO_EDGE; - break; - case Texture::WRAP_REPEAT: - default: - gs = GL_REPEAT; - break; - } + switch (wmode) + { + case Texture::WRAP_CLAMP: + default: + return GL_CLAMP_TO_EDGE; + case Texture::WRAP_REPEAT: + return GL_REPEAT; + case Texture::WRAP_MIRRORED_REPEAT: + return GL_MIRRORED_REPEAT; + } + }; - switch (w.t) - { - case Texture::WRAP_CLAMP: - gt = GL_CLAMP_TO_EDGE; - break; - case Texture::WRAP_REPEAT: - default: - gt = GL_REPEAT; - break; - } - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, gs); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, gt); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, glWrapMode(w.s)); + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, glWrapMode(w.t)); } int OpenGL::getMaxTextureSize() const diff --git a/jni/love/src/modules/graphics/opengl/OpenGL.h b/jni/love/src/modules/graphics/opengl/OpenGL.h index 28678701..bd69be27 100644 --- a/jni/love/src/modules/graphics/opengl/OpenGL.h +++ b/jni/love/src/modules/graphics/opengl/OpenGL.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -318,11 +318,6 @@ public: **/ float setTextureFilter(graphics::Texture::Filter &f); - /** - * Returns the texture filter mode for the currently bound texture. - **/ - graphics::Texture::Filter getTextureFilter(); - /** * Sets the texture wrap mode for the currently bound texture. **/ diff --git a/jni/love/src/modules/graphics/opengl/ParticleSystem.cpp b/jni/love/src/modules/graphics/opengl/ParticleSystem.cpp index defa22b8..6e00899d 100644 --- a/jni/love/src/modules/graphics/opengl/ParticleSystem.cpp +++ b/jni/love/src/modules/graphics/opengl/ParticleSystem.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -87,6 +87,8 @@ ParticleSystem::ParticleSystem(Texture *texture, uint32 size) , radialAccelerationMax(0) , tangentialAccelerationMin(0) , tangentialAccelerationMax(0) + , linearDampingMin(0.0f) + , linearDampingMax(0.0f) , sizeVariation(0) , rotationMin(0) , rotationMax(0) @@ -136,6 +138,8 @@ ParticleSystem::ParticleSystem(const ParticleSystem &p) , radialAccelerationMax(p.radialAccelerationMax) , tangentialAccelerationMin(p.tangentialAccelerationMin) , tangentialAccelerationMax(p.tangentialAccelerationMax) + , linearDampingMin(p.linearDampingMin) + , linearDampingMax(p.linearDampingMax) , sizes(p.sizes) , sizeVariation(p.sizeVariation) , rotationMin(p.rotationMin) @@ -294,6 +298,10 @@ void ParticleSystem::initParticle(Particle *p, float t) max = tangentialAccelerationMax; p->tangentialAcceleration = (float) rng.random(min, max); + min = linearDampingMin; + max = linearDampingMax; + p->linearDamping = (float) rng.random(min, max); + p->sizeOffset = (float) rng.random(sizeVariation); // time offset for size change p->sizeIntervalSize = (1.0f - (float) rng.random(sizeVariation)) - p->sizeOffset; p->size = sizes[(size_t)(p->sizeOffset - .5f) * (sizes.size() - 1)]; @@ -470,12 +478,10 @@ void ParticleSystem::setParticleLifetime(float min, float max) particleLifeMax = max; } -void ParticleSystem::getParticleLifetime(float *min, float *max) const +void ParticleSystem::getParticleLifetime(float &min, float &max) const { - if (min) - *min = particleLifeMin; - if (max) - *max = particleLifeMax; + min = particleLifeMin; + max = particleLifeMax; } void ParticleSystem::setPosition(float x, float y) @@ -541,12 +547,10 @@ void ParticleSystem::setSpeed(float min, float max) speedMax = max; } -void ParticleSystem::getSpeed(float *min, float *max) const +void ParticleSystem::getSpeed(float &min, float &max) const { - if (min) - *min = speedMin; - if (max) - *max = speedMax; + min = speedMin; + max = speedMax; } void ParticleSystem::setLinearAcceleration(float x, float y) @@ -561,12 +565,10 @@ void ParticleSystem::setLinearAcceleration(float xmin, float ymin, float xmax, f linearAccelerationMax = love::Vector(xmax, ymax); } -void ParticleSystem::getLinearAcceleration(love::Vector *min, love::Vector *max) const +void ParticleSystem::getLinearAcceleration(love::Vector &min, love::Vector &max) const { - if (min) - *min = linearAccelerationMin; - if (max) - *max = linearAccelerationMax; + min = linearAccelerationMin; + max = linearAccelerationMax; } void ParticleSystem::setRadialAcceleration(float acceleration) @@ -580,12 +582,10 @@ void ParticleSystem::setRadialAcceleration(float min, float max) radialAccelerationMax = max; } -void ParticleSystem::getRadialAcceleration(float *min, float *max) const +void ParticleSystem::getRadialAcceleration(float &min, float &max) const { - if (min) - *min = radialAccelerationMin; - if (max) - *max = radialAccelerationMax; + min = radialAccelerationMin; + max = radialAccelerationMax; } void ParticleSystem::setTangentialAcceleration(float acceleration) @@ -599,12 +599,22 @@ void ParticleSystem::setTangentialAcceleration(float min, float max) tangentialAccelerationMax = max; } -void ParticleSystem::getTangentialAcceleration(float *min, float *max) const +void ParticleSystem::getTangentialAcceleration(float &min, float &max) const { - if (min) - *min = tangentialAccelerationMin; - if (max) - *max = tangentialAccelerationMax; + min = tangentialAccelerationMin; + max = tangentialAccelerationMax; +} + +void ParticleSystem::setLinearDamping(float min, float max) +{ + linearDampingMin = min; + linearDampingMax = max; +} + +void ParticleSystem::getLinearDamping(float &min, float &max) const +{ + min = linearDampingMin; + max = linearDampingMax; } void ParticleSystem::setSize(float size) @@ -644,12 +654,10 @@ void ParticleSystem::setRotation(float min, float max) rotationMax = max; } -void ParticleSystem::getRotation(float *min, float *max) const +void ParticleSystem::getRotation(float &min, float &max) const { - if (min) - *min = rotationMin; - if (max) - *max = rotationMax; + min = rotationMin; + max = rotationMax; } void ParticleSystem::setSpin(float spin) @@ -664,12 +672,10 @@ void ParticleSystem::setSpin(float start, float end) spinEnd = end; } -void ParticleSystem::getSpin(float *start, float *end) const +void ParticleSystem::getSpin(float &start, float &end) const { - if (start) - *start = spinStart; - if (end) - *end = spinEnd; + start = spinStart; + end = spinEnd; } void ParticleSystem::setSpinVariation(float variation) @@ -944,6 +950,9 @@ void ParticleSystem::update(float dt) // Update velocity. p->velocity += (radial + tangential + p->linearAcceleration) * dt; + // Apply damping. + p->velocity *= 1.0f / (1.0f + p->linearDamping * dt); + // Modify position. ppos += p->velocity * dt; diff --git a/jni/love/src/modules/graphics/opengl/ParticleSystem.h b/jni/love/src/modules/graphics/opengl/ParticleSystem.h index ac05268f..171d4b25 100644 --- a/jni/love/src/modules/graphics/opengl/ParticleSystem.h +++ b/jni/love/src/modules/graphics/opengl/ParticleSystem.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -163,7 +163,7 @@ public: * @param[out] min The minimum life. * @param[out] max The maximum life. **/ - void getParticleLifetime(float *min, float *max) const; + void getParticleLifetime(float &min, float &max) const; /** * Sets the position of the center of the emitter. @@ -250,7 +250,7 @@ public: * @param[out] min The minimum speed. * @param[out] max The maximum speed. **/ - void getSpeed(float *min, float *max) const; + void getSpeed(float &min, float &max) const; /** * Sets the linear acceleration (the acceleration along the x and y axes). @@ -273,7 +273,7 @@ public: * @param[out] min The minimum acceleration. * @param[out] max The maximum acceleration. **/ - void getLinearAcceleration(love::Vector *min, love::Vector *max) const; + void getLinearAcceleration(love::Vector &min, love::Vector &max) const; /** * Sets the radial acceleration (the acceleration towards the particle emitter). @@ -293,7 +293,7 @@ public: * @param[out] min The minimum amount of radial acceleration. * @param[out] max The maximum amount of radial acceleration. **/ - void getRadialAcceleration(float *min, float *max) const; + void getRadialAcceleration(float &min, float &max) const; /** * Sets the tangential acceleration (the acceleration perpendicular to the particle's direction). @@ -313,7 +313,18 @@ public: * @param[out] min The minimum tangential acceleration. * @param[out] max The maximum tangential acceleration. **/ - void getTangentialAcceleration(float *min, float *max) const; + void getTangentialAcceleration(float &min, float &max) const; + + /** + * Sets the amount of linear damping. Damping reduces the velocity of + * particles over time. A value of 0 corresponds to no damping. + **/ + void setLinearDamping(float min, float max); + + /** + * Gets the current amount of linear damping. + **/ + void getLinearDamping(float &min, float &max) const; /** * Sets the size of the sprite (1.0 being the default size). @@ -361,7 +372,7 @@ public: * @param[out] min The minimum initial rotation. * @param[out] max The maximum initial rotation. **/ - void getRotation(float *min, float *max) const; + void getRotation(float &min, float &max) const; /** * Sets the spin of the sprite. @@ -381,7 +392,7 @@ public: * @param[out] start The initial spin, in radians / s. * @param[out] end The final spin, in radians / s. **/ - void getSpin(float *start, float *end) const; + void getSpin(float &start, float &end) const; /** * Sets the variation of the start spin (0 being no variation and 1 being a random spin between start and end). @@ -534,6 +545,8 @@ protected: float radialAcceleration; float tangentialAcceleration; + float linearDamping; + float size; float sizeOffset; float sizeIntervalSize; @@ -623,6 +636,9 @@ protected: float tangentialAccelerationMin; float tangentialAccelerationMax; + float linearDampingMin; + float linearDampingMax; + // Size. std::vector sizes; float sizeVariation; diff --git a/jni/love/src/modules/graphics/opengl/Polyline.cpp b/jni/love/src/modules/graphics/opengl/Polyline.cpp index 2e91cbe1..98a079b5 100644 --- a/jni/love/src/modules/graphics/opengl/Polyline.cpp +++ b/jni/love/src/modules/graphics/opengl/Polyline.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/Polyline.h b/jni/love/src/modules/graphics/opengl/Polyline.h index a3875458..f2b7959a 100644 --- a/jni/love/src/modules/graphics/opengl/Polyline.h +++ b/jni/love/src/modules/graphics/opengl/Polyline.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/Shader.cpp b/jni/love/src/modules/graphics/opengl/Shader.cpp index d8fdc148..8b96b77b 100644 --- a/jni/love/src/modules/graphics/opengl/Shader.cpp +++ b/jni/love/src/modules/graphics/opengl/Shader.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -64,20 +64,20 @@ namespace Shader *Shader::current = nullptr; Shader *Shader::defaultShader = nullptr; -Shader::ShaderSources Shader::defaultCode[Graphics::RENDERER_MAX_ENUM]; +Shader::ShaderSource Shader::defaultCode[Graphics::RENDERER_MAX_ENUM]; GLint Shader::maxTexUnits = 0; std::vector Shader::textureCounters; -Shader::Shader(const ShaderSources &sources) - : shaderSources(sources) +Shader::Shader(const ShaderSource &source) + : shaderSource(source) , program(0) , builtinUniforms() - , vertexAttributes() + , builtinAttributes() , lastCanvas((Canvas *) -1) , lastViewport() { - if (shaderSources.empty()) + if (source.vertex.empty() && source.pixel.empty()) throw love::Exception("Cannot create shader: no source code!"); if (maxTexUnits <= 0) @@ -108,21 +108,21 @@ Shader::~Shader() unloadVolatile(); } -GLuint Shader::compileCode(ShaderType type, const std::string &code) +GLuint Shader::compileCode(ShaderStage stage, const std::string &code) { - GLenum glshadertype; + GLenum glstage; const char *typestr; - if (!typeNames.find(type, typestr)) + if (!stageNames.find(stage, typestr)) typestr = ""; - switch (type) + switch (stage) { - case TYPE_VERTEX: - glshadertype = GL_VERTEX_SHADER; + case STAGE_VERTEX: + glstage = GL_VERTEX_SHADER; break; - case TYPE_PIXEL: - glshadertype = GL_FRAGMENT_SHADER; + case STAGE_PIXEL: + glstage = GL_FRAGMENT_SHADER; break; default: throw love::Exception("Cannot create shader object: unknown shader type."); @@ -132,125 +132,75 @@ GLuint Shader::compileCode(ShaderType type, const std::string &code) // clear existing errors while (glGetError() != GL_NO_ERROR); - GLuint shaderid = glCreateShader(glshadertype); + GLuint shaderid = glCreateShader(glstage); - if (shaderid == 0) // oh no! + if (shaderid == 0) { - GLenum err = glGetError(); - - if (err == GL_INVALID_ENUM) + if (glGetError() == GL_INVALID_ENUM) throw love::Exception("Cannot create %s shader object: %s shaders not supported.", typestr, typestr); else throw love::Exception("Cannot create %s shader object.", typestr); } const char *src = code.c_str(); - size_t srclen = code.length(); - glShaderSource(shaderid, 1, (const GLchar **)&src, (GLint *)&srclen); + GLint srclen = (GLint) code.length(); + glShaderSource(shaderid, 1, (const GLchar **)&src, &srclen); glCompileShader(shaderid); - // Get any warnings the shader compiler may have produced. GLint infologlen; glGetShaderiv(shaderid, GL_INFO_LOG_LENGTH, &infologlen); - GLchar *infolog = new GLchar[infologlen + 1]; - glGetShaderInfoLog(shaderid, infologlen, nullptr, infolog); - - // Save any warnings for later querying. + // Get any warnings the shader compiler may have produced. if (infologlen > 0) - shaderWarnings[type] = infolog; + { + GLchar *infolog = new GLchar[infologlen]; + glGetShaderInfoLog(shaderid, infologlen, nullptr, infolog); - delete[] infolog; + // Save any warnings for later querying. + shaderWarnings[stage] = infolog; + + delete[] infolog; + } GLint status; glGetShaderiv(shaderid, GL_COMPILE_STATUS, &status); if (status == GL_FALSE) { + glDeleteShader(shaderid); throw love::Exception("Cannot compile %s shader code:\n%s", - typestr, shaderWarnings[type].c_str()); + typestr, shaderWarnings[stage].c_str()); } return shaderid; } -void Shader::createProgram(const std::vector &shaderids) -{ - program = glCreateProgram(); - if (program == 0) - throw love::Exception("Cannot create shader program object."); - - for (GLuint id : shaderids) - glAttachShader(program, id); - - // Bind generic vertex attribute indices to names in the shader. - for (int i = 0; i < int(OpenGL::ATTRIB_MAX_ENUM); i++) - { - // Desktop OpenGL should ignore some of these. - if (!GLAD_ES_VERSION_2_0 && i <= int(OpenGL::ATTRIB_COLOR)) - continue; - - OpenGL::VertexAttrib attrib = (OpenGL::VertexAttrib) i; - - // FIXME: We skip this both because pseudo-instancing is temporarily - // disabled (see graphics.lua), and because binding a non-existant - // attribute name to a location causes a shader linker warning. - if (attrib == OpenGL::ATTRIB_PSEUDO_INSTANCE_ID) - continue; - - const char *name = nullptr; - if (attribNames.find(attrib, name)) - glBindAttribLocation(program, i, (const GLchar *) name); - } - - glLinkProgram(program); - - // flag shaders for auto-deletion when the program object is deleted. - for (GLuint id : shaderids) - glDeleteShader(id); - - GLint status; - glGetProgramiv(program, GL_LINK_STATUS, &status); - - if (status == GL_FALSE) - { - std::string warnings = getProgramWarnings(); - glDeleteProgram(program); - program = 0; - - throw love::Exception("Cannot link shader program object:\n%s", warnings.c_str()); - } -} - void Shader::mapActiveUniforms() { + // Built-in uniform locations default to -1 (nonexistant.) + for (int i = 0; i < int(BUILTIN_MAX_ENUM); i++) + builtinUniforms[i] = -1; + uniforms.clear(); GLint numuniforms; glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &numuniforms); - GLsizei bufsize; - glGetProgramiv(program, GL_ACTIVE_UNIFORM_MAX_LENGTH, (GLint *) &bufsize); - - if (bufsize <= 0) - return; + GLchar cname[256]; + const GLint bufsize = (GLint) (sizeof(cname) / sizeof(GLchar)); for (int i = 0; i < numuniforms; i++) { - GLchar *cname = new GLchar[bufsize]; - GLsizei namelength; + GLsizei namelen = 0; + Uniform u = {}; - Uniform u; + glGetActiveUniform(program, (GLuint) i, bufsize, &namelen, &u.count, &u.type, cname); - glGetActiveUniform(program, (GLuint) i, bufsize, &namelength, &u.count, &u.type, cname); - - u.name = std::string(cname, (size_t) namelength); + u.name = std::string(cname, (size_t) namelen); u.location = glGetUniformLocation(program, u.name.c_str()); u.baseType = getUniformBaseType(u.type); - delete[] cname; - // glGetActiveUniform appends "[0]" to the end of array uniform names... if (u.name.length() > 3) { @@ -279,36 +229,81 @@ bool Shader::loadVolatile() activeTexUnits.clear(); activeTexUnits.insert(activeTexUnits.begin(), maxTexUnits, 0); - // Built-in uniform locations default to -1 (nonexistant.) - for (int i = 0; i < int(BUILTIN_MAX_ENUM); i++) - builtinUniforms[i] = -1; - std::vector shaderids; - for (const auto &source : shaderSources) + try { - GLuint shaderid = compileCode(source.first, source.second); - shaderids.push_back(shaderid); + // All shader programs in ES2 must have a vertex and pixel shader. + const ShaderSource &defaultESCode = defaultCode[Graphics::RENDERER_OPENGLES]; + + if (!shaderSource.vertex.empty()) + shaderids.push_back(compileCode(STAGE_VERTEX, shaderSource.vertex)); + else if (GLAD_ES_VERSION_2_0) + shaderids.push_back(compileCode(STAGE_VERTEX, defaultESCode.vertex)); + + if (!shaderSource.pixel.empty()) + shaderids.push_back(compileCode(STAGE_PIXEL, shaderSource.pixel)); + else if (GLAD_ES_VERSION_2_0) + shaderids.push_back(compileCode(STAGE_PIXEL, defaultESCode.pixel)); } - - // All shader programs in ES2 must have a vertex and pixel shader. - if (GLAD_ES_VERSION_2_0) + catch (love::Exception &) { - ShaderSources &defaults = defaultCode[Graphics::RENDERER_OPENGLES]; - - ShaderSources::const_iterator source = shaderSources.find(TYPE_VERTEX); - if (source == shaderSources.end()) - shaderids.push_back(compileCode(TYPE_VERTEX, defaults[TYPE_VERTEX])); - - source = shaderSources.find(TYPE_PIXEL); - if (source == shaderSources.end()) - shaderids.push_back(compileCode(TYPE_PIXEL, defaults[TYPE_PIXEL])); + for (GLuint id : shaderids) + glDeleteShader(id); + throw; } if (shaderids.empty()) throw love::Exception("Cannot create shader: no valid source code!"); - createProgram(shaderids); + program = glCreateProgram(); + + if (program == 0) + { + for (GLuint id : shaderids) + glDeleteShader(id); + throw love::Exception("Cannot create shader program object."); + } + + for (GLuint id : shaderids) + glAttachShader(program, id); + + // Bind generic vertex attribute indices to names in the shader. + for (int i = 0; i < int(OpenGL::ATTRIB_MAX_ENUM); i++) + { + // Desktop OpenGL should ignore some of these. + if (!GLAD_ES_VERSION_2_0 && i <= int(OpenGL::ATTRIB_COLOR)) + continue; + + OpenGL::VertexAttrib attrib = (OpenGL::VertexAttrib) i; + + // FIXME: We skip this both because pseudo-instancing is temporarily + // disabled (see graphics.lua), and because binding a non-existant + // attribute name to a location causes a shader linker warning. + if (attrib == OpenGL::ATTRIB_PSEUDO_INSTANCE_ID) + continue; + + const char *name = nullptr; + if (attribNames.find(attrib, name)) + glBindAttribLocation(program, i, (const GLchar *) name); + } + + glLinkProgram(program); + + // Flag shaders for auto-deletion when the program object is deleted. + for (GLuint id : shaderids) + glDeleteShader(id); + + GLint status; + glGetProgramiv(program, GL_LINK_STATUS, &status); + + if (status == GL_FALSE) + { + std::string warnings = getProgramWarnings(); + glDeleteProgram(program); + program = 0; + throw love::Exception("Cannot link shader program object:\n%s", warnings.c_str()); + } // Retrieve all active uniform variables in this shader from OpenGL. mapActiveUniforms(); @@ -317,9 +312,9 @@ bool Shader::loadVolatile() { const char *name = nullptr; if (attribNames.find(OpenGL::VertexAttrib(i), name)) - vertexAttributes[i] = glGetAttribLocation(program, name); + builtinAttributes[i] = glGetAttribLocation(program, name); else - vertexAttributes[i] = -1; + builtinAttributes[i] = -1; } if (current == this) @@ -367,13 +362,16 @@ void Shader::unloadVolatile() std::string Shader::getProgramWarnings() const { - GLint strlen, nullpos; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &strlen); + GLint strsize, nullpos; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &strsize); - char *tempstr = new char[strlen+1]; + if (strsize == 0) + return ""; + + char *tempstr = new char[strsize]; // be extra sure that the error string will be 0-terminated - memset(tempstr, '\0', strlen+1); - glGetProgramInfoLog(program, strlen, &nullpos, tempstr); + memset(tempstr, '\0', strsize); + glGetProgramInfoLog(program, strsize, &nullpos, tempstr); tempstr[nullpos] = '\0'; std::string warnings(tempstr); @@ -385,13 +383,13 @@ std::string Shader::getProgramWarnings() const std::string Shader::getWarnings() const { std::string warnings; - const char *typestr; + const char *stagestr; // Get the individual shader stage warnings for (const auto &warning : shaderWarnings) { - if (typeNames.find(warning.first, typestr)) - warnings += std::string(typestr) + std::string(" shader:\n") + warning.second; + if (stageNames.find(warning.first, stagestr)) + warnings += std::string(stagestr) + std::string(" shader:\n") + warning.second; } warnings += getProgramWarnings(); @@ -438,7 +436,6 @@ void Shader::detach() if (current != nullptr) { glUseProgram(0); - current->release(); current = nullptr; } } @@ -710,7 +707,7 @@ Shader::UniformType Shader::getExternVariable(const std::string &name, int &comp bool Shader::hasVertexAttrib(OpenGL::VertexAttrib attrib) const { - return vertexAttributes[int(attrib)] != -1; + return builtinAttributes[int(attrib)] != -1; } bool Shader::hasBuiltinUniform(BuiltinUniform builtin) const @@ -851,13 +848,13 @@ bool Shader::getConstant(UniformType in, const char *&out) return uniformTypes.find(in, out); } -StringMap::Entry Shader::typeNameEntries[] = +StringMap::Entry Shader::stageNameEntries[] = { - {"vertex", Shader::TYPE_VERTEX}, - {"pixel", Shader::TYPE_PIXEL}, + {"vertex", Shader::STAGE_VERTEX}, + {"pixel", Shader::STAGE_PIXEL}, }; -StringMap Shader::typeNames(Shader::typeNameEntries, sizeof(Shader::typeNameEntries)); +StringMap Shader::stageNames(Shader::stageNameEntries, sizeof(Shader::stageNameEntries)); StringMap::Entry Shader::uniformTypeEntries[] = { diff --git a/jni/love/src/modules/graphics/opengl/Shader.h b/jni/love/src/modules/graphics/opengl/Shader.h index 550b50a0..721bd0aa 100644 --- a/jni/love/src/modules/graphics/opengl/Shader.h +++ b/jni/love/src/modules/graphics/opengl/Shader.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -53,11 +53,11 @@ public: // Pointer to the current default Shader. static Shader *defaultShader; - enum ShaderType + enum ShaderStage { - TYPE_VERTEX, - TYPE_PIXEL, - TYPE_MAX_ENUM + STAGE_VERTEX, + STAGE_PIXEL, + STAGE_MAX_ENUM }; // Built-in uniform (extern) variables. @@ -82,14 +82,17 @@ public: UNIFORM_MAX_ENUM }; - // Type for a list of shader source codes in the form of sources[shadertype] = code - typedef std::map ShaderSources; + struct ShaderSource + { + std::string vertex; + std::string pixel; + }; /** * Creates a new Shader using a list of source codes. - * Sources must contain either vertex or pixel shader code, or both. + * Source must contain either vertex or pixel shader code, or both. **/ - Shader(const ShaderSources &sources); + Shader(const ShaderSource &source); virtual ~Shader(); @@ -182,7 +185,7 @@ public: static bool isSupported(); // Default code used when renderers require code for a shader stage. - static ShaderSources defaultCode[Graphics::RENDERER_MAX_ENUM]; + static ShaderSource defaultCode[Graphics::RENDERER_MAX_ENUM]; static bool getConstant(const char *in, UniformType &out); static bool getConstant(UniformType in, const char *&out); @@ -208,8 +211,7 @@ private: UniformType getUniformBaseType(GLenum type) const; void checkSetUniformError(const Uniform &u, int size, int count, UniformType sendtype) const; - GLuint compileCode(ShaderType type, const std::string &code); - void createProgram(const std::vector &shaderids); + GLuint compileCode(ShaderStage stage, const std::string &code); int getTextureUnit(const std::string &name); @@ -218,12 +220,11 @@ private: // Get any warnings or errors generated only by the shader program object. std::string getProgramWarnings() const; - - // List of all shader code attached to this Shader - ShaderSources shaderSources; + // Source code used for this Shader. + ShaderSource shaderSource; // Shader compiler warning strings for individual shader stages. - std::map shaderWarnings; + std::map shaderWarnings; // volatile GLuint program; @@ -232,7 +233,7 @@ private: GLint builtinUniforms[BUILTIN_MAX_ENUM]; // Location values for any generic vertex attribute variables. - GLint vertexAttributes[OpenGL::ATTRIB_MAX_ENUM]; + GLint builtinAttributes[OpenGL::ATTRIB_MAX_ENUM]; // Uniform location buffer map std::map uniforms; @@ -254,9 +255,8 @@ private: // Counts total number of textures bound to each texture unit in all shaders static std::vector textureCounters; - - static StringMap::Entry typeNameEntries[]; - static StringMap typeNames; + static StringMap::Entry stageNameEntries[]; + static StringMap stageNames; static StringMap::Entry uniformTypeEntries[]; static StringMap uniformTypes; diff --git a/jni/love/src/modules/graphics/opengl/SpriteBatch.cpp b/jni/love/src/modules/graphics/opengl/SpriteBatch.cpp index 1cdcca70..c7495766 100644 --- a/jni/love/src/modules/graphics/opengl/SpriteBatch.cpp +++ b/jni/love/src/modules/graphics/opengl/SpriteBatch.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -47,7 +47,7 @@ SpriteBatch::SpriteBatch(Texture *texture, int size, int usage) , next(0) , color(0) , array_buf(nullptr) - , element_buf(nullptr) + , element_buf(size) , buffer_used_offset(0) , buffer_used_size(0) { @@ -74,18 +74,15 @@ SpriteBatch::SpriteBatch(Texture *texture, int size, int usage) try { array_buf = VertexBuffer::Create(vertex_size, GL_ARRAY_BUFFER, gl_usage); - element_buf = new VertexIndex(size); } catch (love::Exception &) { delete array_buf; - delete element_buf; throw; } catch (std::bad_alloc &) { delete array_buf; - delete element_buf; throw love::Exception("Out of memory."); } } @@ -94,7 +91,6 @@ SpriteBatch::~SpriteBatch() { delete color; delete array_buf; - delete element_buf; } int SpriteBatch::add(float x, float y, float a, float sx, float sy, float ox, float oy, float kx, float ky, int index /*= -1*/) @@ -103,20 +99,9 @@ int SpriteBatch::add(float x, float y, float a, float sx, float sy, float ox, fl if ((index == -1 && next >= size) || index < -1 || index >= size) return -1; - Vertex sprite[4]; + Matrix t(x, y, a, sx, sy, ox, oy, kx, ky); - // Needed for colors. - memcpy(sprite, texture->getVertices(), sizeof(Vertex) * 4); - - // Transform. - Matrix t; - t.setTransformation(x, y, a, sx, sy, ox, oy, kx, ky); - t.transform(sprite, sprite, 4); - - if (color) - setColorv(sprite, *color); - - addv(sprite, (index == -1) ? next : index); + addv(texture->getVertices(), t, (index == -1) ? next : index); // Increment counter. if (index == -1) @@ -131,19 +116,9 @@ int SpriteBatch::addq(Quad *quad, float x, float y, float a, float sx, float sy, if ((index == -1 && next >= size) || index < -1 || index >= next) return -1; - Vertex sprite[4]; + Matrix t(x, y, a, sx, sy, ox, oy, kx, ky); - // Needed for colors. - memcpy(sprite, quad->getVertices(), sizeof(Vertex) * 4); - - Matrix t; - t.setTransformation(x, y, a, sx, sy, ox, oy, kx, ky); - t.transform(sprite, sprite, 4); - - if (color) - setColorv(sprite, *color); - - addv(sprite, (index == -1) ? next : index); + addv(quad->getVertices(), t, (index == -1) ? next : index); // Increment counter. if (index == -1) @@ -171,7 +146,7 @@ void SpriteBatch::setTexture(Texture *newtexture) texture.set(newtexture); } -Texture *SpriteBatch::getTexture() +Texture *SpriteBatch::getTexture() const { return texture.get(); } @@ -216,37 +191,32 @@ void SpriteBatch::setBufferSize(int newsize) } size_t vertex_size = sizeof(Vertex) * 4 * newsize; - VertexBuffer *new_array_buf = nullptr; - VertexIndex *new_element_buf = nullptr; try { new_array_buf = VertexBuffer::Create(vertex_size, array_buf->getTarget(), array_buf->getUsage()); - new_element_buf = new VertexIndex(newsize); + + // Copy as much of the old data into the new VertexBuffer as can fit. + VertexBuffer::Bind bind(*new_array_buf); + void *new_data = new_array_buf->map(); + memcpy(new_data, old_data, sizeof(Vertex) * 4 * std::min(newsize, size)); + + element_buf = VertexIndex(newsize); } catch (love::Exception &) { delete new_array_buf; - delete new_element_buf; throw; } - // Copy as much of the old data into the new VertexBuffer as can fit. - new_array_buf->fill(0, sizeof(Vertex) * 4 * std::min(newsize, size), old_data); - // We don't need to unmap the old VertexBuffer since we're deleting it. delete array_buf; - delete element_buf; array_buf = new_array_buf; - element_buf = new_element_buf; size = newsize; next = std::min(next, newsize); - - // The new VertexBuffer isn't mapped, so we should reset these variables. - buffer_used_offset = buffer_used_size = 0; } int SpriteBatch::getBufferSize() const @@ -263,8 +233,7 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float if (next == 0) return; - static Matrix t; - t.setTransformation(x, y, angle, sx, sy, ox, oy, kx, ky); + Matrix t(x, y, angle, sx, sy, ox, oy, kx, ky); OpenGL::TempTransform transform(gl); transform.get() *= t; @@ -272,7 +241,7 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float texture->predraw(); VertexBuffer::Bind array_bind(*array_buf); - VertexBuffer::Bind element_bind(*element_buf->getVertexBuffer()); + VertexBuffer::Bind element_bind(*element_buf.getVertexBuffer()); // 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); @@ -294,7 +263,7 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float gl.setVertexAttribArray(OpenGL::ATTRIB_TEXCOORD, 2, GL_FLOAT, sizeof(Vertex), array_buf->getPointer(texel_offset)); gl.prepareDraw(); - gl.drawElements(GL_TRIANGLES, element_buf->getIndexCount(next), element_buf->getType(), element_buf->getPointer(0)); + gl.drawElements(GL_TRIANGLES, element_buf.getIndexCount(next), element_buf.getType(), element_buf.getPointer(0)); gl.disableVertexAttribArray(OpenGL::ATTRIB_POS); gl.disableVertexAttribArray(OpenGL::ATTRIB_TEXCOORD); @@ -308,9 +277,16 @@ void SpriteBatch::draw(float x, float y, float angle, float sx, float sy, float texture->postdraw(); } -void SpriteBatch::addv(const Vertex *v, int index) +void SpriteBatch::addv(const Vertex *v, const Matrix &m, int index) { - static const size_t sprite_size = 4 * sizeof(Vertex); // bytecount + // Needed for colors. + Vertex sprite[4] = {v[0], v[1], v[2], v[3]}; + const size_t sprite_size = 4 * sizeof(Vertex); // bytecount + + m.transform(sprite, sprite, 4); + + if (color) + setColorv(sprite, *color); VertexBuffer::Bind bind(*array_buf); @@ -318,7 +294,7 @@ void SpriteBatch::addv(const Vertex *v, int index) // on draw.) array_buf->map(); - array_buf->fill(index * sprite_size, sprite_size, v); + array_buf->fill(index * sprite_size, sprite_size, sprite); buffer_used_offset = std::min(buffer_used_offset, index * sprite_size); buffer_used_size = std::max(buffer_used_size, (index + 1) * sprite_size - buffer_used_offset); diff --git a/jni/love/src/modules/graphics/opengl/SpriteBatch.h b/jni/love/src/modules/graphics/opengl/SpriteBatch.h index 55a73692..89e7f75c 100644 --- a/jni/love/src/modules/graphics/opengl/SpriteBatch.h +++ b/jni/love/src/modules/graphics/opengl/SpriteBatch.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -26,13 +26,13 @@ // LOVE #include "common/math.h" -#include "common/Object.h" #include "common/Matrix.h" #include "common/StringMap.h" #include "graphics/Drawable.h" #include "graphics/Volatile.h" #include "graphics/Color.h" #include "graphics/Quad.h" +#include "VertexBuffer.h" namespace love { @@ -43,8 +43,6 @@ namespace opengl // Forward declarations. class Texture; -class VertexBuffer; -class VertexIndex; class SpriteBatch : public Drawable { @@ -68,7 +66,7 @@ public: void flush(); void setTexture(Texture *newtexture); - Texture *getTexture(); + Texture *getTexture() const; /** * Set the current color for this SpriteBatch. The sprites added @@ -115,7 +113,7 @@ public: private: - void addv(const Vertex *v, int index); + void addv(const Vertex *v, const Matrix &m, int index); /** * Set the color for vertices. @@ -139,7 +137,7 @@ private: Color *color; VertexBuffer *array_buf; - VertexIndex *element_buf; + VertexIndex element_buf; // The portion of the vertex buffer that's been modified while mapped. size_t buffer_used_offset; diff --git a/jni/love/src/modules/graphics/opengl/Texture.h b/jni/love/src/modules/graphics/opengl/Texture.h index 1015f503..eea72f57 100644 --- a/jni/love/src/modules/graphics/opengl/Texture.h +++ b/jni/love/src/modules/graphics/opengl/Texture.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/VertexBuffer.cpp b/jni/love/src/modules/graphics/opengl/VertexBuffer.cpp index ed65dee6..5b45aea2 100644 --- a/jni/love/src/modules/graphics/opengl/VertexBuffer.cpp +++ b/jni/love/src/modules/graphics/opengl/VertexBuffer.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -328,6 +328,20 @@ VertexIndex::VertexIndex(size_t size) addSize(size); } +VertexIndex::VertexIndex(const VertexIndex &other) + : size(other.size) +{ + addSize(size); +} + +VertexIndex &VertexIndex::operator = (const VertexIndex &other) +{ + addSize(other.size); + removeSize(size); + size = other.size; + return *this; +} + VertexIndex::~VertexIndex() { removeSize(size); diff --git a/jni/love/src/modules/graphics/opengl/VertexBuffer.h b/jni/love/src/modules/graphics/opengl/VertexBuffer.h index dc207e77..de90f823 100644 --- a/jni/love/src/modules/graphics/opengl/VertexBuffer.h +++ b/jni/love/src/modules/graphics/opengl/VertexBuffer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -412,6 +412,9 @@ public: */ VertexIndex(size_t size); + VertexIndex(const VertexIndex &other); + VertexIndex &operator = (const VertexIndex &other); + /** * Removes an entry from the list of sizes and resizes the VertexBuffer * if needed. diff --git a/jni/love/src/modules/graphics/opengl/wrap_Canvas.cpp b/jni/love/src/modules/graphics/opengl/wrap_Canvas.cpp index 4777f850..bb6838f6 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Canvas.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_Canvas.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Canvas.h b/jni/love/src/modules/graphics/opengl/wrap_Canvas.h index 2b775f93..1093f980 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Canvas.h +++ b/jni/love/src/modules/graphics/opengl/wrap_Canvas.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Font.cpp b/jni/love/src/modules/graphics/opengl/wrap_Font.cpp index 379a5245..34203f07 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Font.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_Font.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Font.h b/jni/love/src/modules/graphics/opengl/wrap_Font.h index 067e222f..c38d2c22 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Font.h +++ b/jni/love/src/modules/graphics/opengl/wrap_Font.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Graphics.cpp b/jni/love/src/modules/graphics/opengl/wrap_Graphics.cpp index 60d3c6f5..331a0c29 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Graphics.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_Graphics.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,7 @@ #include "scripts/graphics.lua.h" #include +#include namespace love { @@ -409,6 +410,19 @@ int w_newShader(lua_State *L) lua_call(L, 1, 1); lua_replace(L, i); } + else + { + // Check if the argument looks like a filepath - we want a nicer + // error for misspelled filepath arguments. + size_t slen = 0; + const char *str = lua_tolstring(L, i, &slen); + if (slen > 0 && slen < 256 && !strchr(str, '\n')) + { + const char *ext = strchr(str, '.'); + if (ext != nullptr && !strchr(ext, ';') && !strchr(ext, ' ')) + return luaL_error(L, "Could not open file %s. Does not exist.", str); + } + } } bool has_arg1 = lua_isstring(L, 1); @@ -428,27 +442,21 @@ int w_newShader(lua_State *L) if (lua_pcall(L, 2, 2, 0) != 0) return luaL_error(L, "%s", lua_tostring(L, -1)); - Shader::ShaderSources sources; + Shader::ShaderSource source; // vertex shader code if (lua_isstring(L, -2)) - { - std::string vertexcode(luaL_checkstring(L, -2)); - sources[Shader::TYPE_VERTEX] = vertexcode; - } + source.vertex = luax_checkstring(L, -2); else if (has_arg1 && has_arg2) return luaL_error(L, "Could not parse vertex shader code (missing 'position' function?)"); // pixel shader code if (lua_isstring(L, -1)) - { - std::string pixelcode(luaL_checkstring(L, -1)); - sources[Shader::TYPE_PIXEL] = pixelcode; - } + source.pixel = luax_checkstring(L, -1); else if (has_arg1 && has_arg2) return luaL_error(L, "Could not parse pixel shader code (missing 'effect' function?)"); - if (sources.empty()) + if (source.vertex.empty() && source.pixel.empty()) { // Original args had source code, but effectCodeToGLSL couldn't translate it for (int i = 1; i <= 2; i++) @@ -461,7 +469,7 @@ int w_newShader(lua_State *L) bool should_error = false; try { - Shader *shader = instance()->newShader(sources); + Shader *shader = instance()->newShader(source); luax_pushtype(L, "Shader", GRAPHICS_SHADER_T, shader); shader->release(); } @@ -993,9 +1001,9 @@ int w_setDefaultShaderCode(lua_State *L) lua_rawgeti(L, -1, 1); lua_rawgeti(L, -2, 2); - Shader::ShaderSources openglcode; - openglcode[Shader::TYPE_VERTEX] = luax_checkstring(L, -2); - openglcode[Shader::TYPE_PIXEL] = luax_checkstring(L, -1); + Shader::ShaderSource openglcode; + openglcode.vertex = luax_checkstring(L, -2); + openglcode.pixel = luax_checkstring(L, -1); lua_pop(L, 3); @@ -1003,9 +1011,9 @@ int w_setDefaultShaderCode(lua_State *L) lua_rawgeti(L, -1, 1); lua_rawgeti(L, -2, 2); - Shader::ShaderSources openglescode; - openglescode[Shader::TYPE_VERTEX] = luax_checkstring(L, -2); - openglescode[Shader::TYPE_PIXEL] = luax_checkstring(L, -1); + Shader::ShaderSource openglescode; + openglescode.vertex = luax_checkstring(L, -2); + openglescode.pixel = luax_checkstring(L, -1); lua_pop(L, 3); diff --git a/jni/love/src/modules/graphics/opengl/wrap_Graphics.h b/jni/love/src/modules/graphics/opengl/wrap_Graphics.h index b14e2403..ca047bd3 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Graphics.h +++ b/jni/love/src/modules/graphics/opengl/wrap_Graphics.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Image.cpp b/jni/love/src/modules/graphics/opengl/wrap_Image.cpp index c2ee5a6f..9e2dac9f 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Image.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_Image.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Image.h b/jni/love/src/modules/graphics/opengl/wrap_Image.h index 13764d8c..d91d81b2 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Image.h +++ b/jni/love/src/modules/graphics/opengl/wrap_Image.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Mesh.cpp b/jni/love/src/modules/graphics/opengl/wrap_Mesh.cpp index d26486b7..20c33c94 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Mesh.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_Mesh.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Mesh.h b/jni/love/src/modules/graphics/opengl/wrap_Mesh.h index 60b07b85..477927d3 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Mesh.h +++ b/jni/love/src/modules/graphics/opengl/wrap_Mesh.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_ParticleSystem.cpp b/jni/love/src/modules/graphics/opengl/wrap_ParticleSystem.cpp index 62ad1a1c..970f2c3d 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_ParticleSystem.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_ParticleSystem.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -164,7 +164,7 @@ int w_ParticleSystem_getParticleLifetime(lua_State *L) { ParticleSystem *t = luax_checkparticlesystem(L, 1); float min, max; - t->getParticleLifetime(&min, &max); + t->getParticleLifetime(min, max); lua_pushnumber(L, min); lua_pushnumber(L, max); return 2; @@ -278,7 +278,7 @@ int w_ParticleSystem_getSpeed(lua_State *L) { ParticleSystem *t = luax_checkparticlesystem(L, 1); float min, max; - t->getSpeed(&min, &max); + t->getSpeed(min, max); lua_pushnumber(L, min); lua_pushnumber(L, max); return 2; @@ -299,7 +299,7 @@ int w_ParticleSystem_getLinearAcceleration(lua_State *L) { ParticleSystem *t = luax_checkparticlesystem(L, 1); love::Vector min, max; - t->getLinearAcceleration(&min, &max); + t->getLinearAcceleration(min, max); lua_pushnumber(L, min.x); lua_pushnumber(L, min.y); lua_pushnumber(L, max.x); @@ -320,7 +320,7 @@ int w_ParticleSystem_getRadialAcceleration(lua_State *L) { ParticleSystem *t = luax_checkparticlesystem(L, 1); float min, max; - t->getRadialAcceleration(&min, &max); + t->getRadialAcceleration(min, max); lua_pushnumber(L, min); lua_pushnumber(L, max); return 2; @@ -339,7 +339,26 @@ int w_ParticleSystem_getTangentialAcceleration(lua_State *L) { ParticleSystem *t = luax_checkparticlesystem(L, 1); float min, max; - t->getTangentialAcceleration(&min, &max); + t->getTangentialAcceleration(min, max); + lua_pushnumber(L, min); + lua_pushnumber(L, max); + return 2; +} + +int w_ParticleSystem_setLinearDamping(lua_State *L) +{ + ParticleSystem *t = luax_checkparticlesystem(L, 1); + float arg1 = (float)luaL_checknumber(L, 2); + float arg2 = (float)luaL_optnumber(L, 3, arg1); + t->setLinearDamping(arg1, arg2); + return 0; +} + +int w_ParticleSystem_getLinearDamping(lua_State *L) +{ + ParticleSystem *t = luax_checkparticlesystem(L, 1); + float min, max; + t->getLinearDamping(min, max); lua_pushnumber(L, min); lua_pushnumber(L, max); return 2; @@ -411,7 +430,7 @@ int w_ParticleSystem_getRotation(lua_State *L) { ParticleSystem *t = luax_checkparticlesystem(L, 1); float min, max; - t->getRotation(&min, &max); + t->getRotation(min, max); lua_pushnumber(L, min); lua_pushnumber(L, max); return 2; @@ -430,7 +449,7 @@ int w_ParticleSystem_getSpin(lua_State *L) { ParticleSystem *t = luax_checkparticlesystem(L, 1); float start, end; - t->getSpin(&start, &end); + t->getSpin(start, end); lua_pushnumber(L, start); lua_pushnumber(L, end); return 2; @@ -730,6 +749,8 @@ static const luaL_Reg functions[] = { "getRadialAcceleration", w_ParticleSystem_getRadialAcceleration }, { "setTangentialAcceleration", w_ParticleSystem_setTangentialAcceleration }, { "getTangentialAcceleration", w_ParticleSystem_getTangentialAcceleration }, + { "setLinearDamping", w_ParticleSystem_setLinearDamping }, + { "getLinearDamping", w_ParticleSystem_getLinearDamping }, { "setSizes", w_ParticleSystem_setSizes }, { "getSizes", w_ParticleSystem_getSizes }, { "setSizeVariation", w_ParticleSystem_setSizeVariation }, diff --git a/jni/love/src/modules/graphics/opengl/wrap_ParticleSystem.h b/jni/love/src/modules/graphics/opengl/wrap_ParticleSystem.h index f1f78838..ff7b9091 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_ParticleSystem.h +++ b/jni/love/src/modules/graphics/opengl/wrap_ParticleSystem.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -63,6 +63,8 @@ int w_ParticleSystem_setRadialAcceleration(lua_State *L); int w_ParticleSystem_getRadialAcceleration(lua_State *L); int w_ParticleSystem_setTangentialAcceleration(lua_State *L); int w_ParticleSystem_getTangentialAcceleration(lua_State *L); +int w_ParticleSystem_setLinearDamping(lua_State *L); +int w_ParticleSystem_getLinearDamping(lua_State *L); int w_ParticleSystem_setSizes(lua_State *L); int w_ParticleSystem_getSizes(lua_State *L); int w_ParticleSystem_setSizeVariation(lua_State *L); diff --git a/jni/love/src/modules/graphics/opengl/wrap_Quad.cpp b/jni/love/src/modules/graphics/opengl/wrap_Quad.cpp index 1713ff3d..77a2dbeb 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Quad.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_Quad.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Quad.h b/jni/love/src/modules/graphics/opengl/wrap_Quad.h index 3c27cf7d..a766ecb8 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Quad.h +++ b/jni/love/src/modules/graphics/opengl/wrap_Quad.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Shader.cpp b/jni/love/src/modules/graphics/opengl/wrap_Shader.cpp index e862d02d..555cee43 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Shader.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_Shader.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Shader.h b/jni/love/src/modules/graphics/opengl/wrap_Shader.h index f8929539..7b31c3d0 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Shader.h +++ b/jni/love/src/modules/graphics/opengl/wrap_Shader.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_SpriteBatch.cpp b/jni/love/src/modules/graphics/opengl/wrap_SpriteBatch.cpp index fb62b830..5b891348 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_SpriteBatch.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_SpriteBatch.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_SpriteBatch.h b/jni/love/src/modules/graphics/opengl/wrap_SpriteBatch.h index f40d588e..b4095971 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_SpriteBatch.h +++ b/jni/love/src/modules/graphics/opengl/wrap_SpriteBatch.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Texture.cpp b/jni/love/src/modules/graphics/opengl/wrap_Texture.cpp index 90bc1be4..a318a3b1 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Texture.cpp +++ b/jni/love/src/modules/graphics/opengl/wrap_Texture.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/graphics/opengl/wrap_Texture.h b/jni/love/src/modules/graphics/opengl/wrap_Texture.h index 0ba502a6..bb9c54a0 100644 --- a/jni/love/src/modules/graphics/opengl/wrap_Texture.h +++ b/jni/love/src/modules/graphics/opengl/wrap_Texture.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/CompressedData.cpp b/jni/love/src/modules/image/CompressedData.cpp index 6c437826..f90bb2c7 100644 --- a/jni/love/src/modules/image/CompressedData.cpp +++ b/jni/love/src/modules/image/CompressedData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -110,6 +110,10 @@ StringMap::Entry Compre {"bc4s", CompressedData::FORMAT_BC4s}, {"bc5", CompressedData::FORMAT_BC5}, {"bc5s", CompressedData::FORMAT_BC5s}, + {"bc6h", CompressedData::FORMAT_BC6H}, + {"bc6hs", CompressedData::FORMAT_BC6Hs}, + {"bc7", CompressedData::FORMAT_BC7}, + {"bc7srgb", CompressedData::FORMAT_BC7SRGB}, {"etc1", CompressedData::FORMAT_ETC1}, {"pvr1rgb2", CompressedData::FORMAT_PVR1_RGB2}, {"pvr1rgb4", CompressedData::FORMAT_PVR1_RGB4}, diff --git a/jni/love/src/modules/image/CompressedData.h b/jni/love/src/modules/image/CompressedData.h index fb7ca41f..41196fac 100644 --- a/jni/love/src/modules/image/CompressedData.h +++ b/jni/love/src/modules/image/CompressedData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -54,6 +54,10 @@ public: FORMAT_BC4s, FORMAT_BC5, FORMAT_BC5s, + FORMAT_BC6H, + FORMAT_BC6Hs, + FORMAT_BC7, + FORMAT_BC7SRGB, FORMAT_ETC1, FORMAT_PVR1_RGB2, FORMAT_PVR1_RGB4, diff --git a/jni/love/src/modules/image/Image.h b/jni/love/src/modules/image/Image.h index bc2f8564..3558f6d6 100644 --- a/jni/love/src/modules/image/Image.h +++ b/jni/love/src/modules/image/Image.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/ImageData.cpp b/jni/love/src/modules/image/ImageData.cpp index 4264555d..212432fa 100644 --- a/jni/love/src/modules/image/ImageData.cpp +++ b/jni/love/src/modules/image/ImageData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/ImageData.h b/jni/love/src/modules/image/ImageData.h index 8a0230c2..bbf63417 100644 --- a/jni/love/src/modules/image/ImageData.h +++ b/jni/love/src/modules/image/ImageData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/CompressedData.cpp b/jni/love/src/modules/image/magpie/CompressedData.cpp index 4879d84d..3620cdfd 100644 --- a/jni/love/src/modules/image/magpie/CompressedData.cpp +++ b/jni/love/src/modules/image/magpie/CompressedData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/CompressedData.h b/jni/love/src/modules/image/magpie/CompressedData.h index 79727b91..9d70b764 100644 --- a/jni/love/src/modules/image/magpie/CompressedData.h +++ b/jni/love/src/modules/image/magpie/CompressedData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/CompressedFormatHandler.h b/jni/love/src/modules/image/magpie/CompressedFormatHandler.h index 490da2c0..e04d3344 100644 --- a/jni/love/src/modules/image/magpie/CompressedFormatHandler.h +++ b/jni/love/src/modules/image/magpie/CompressedFormatHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/DevilHandler.cpp b/jni/love/src/modules/image/magpie/DevilHandler.cpp index c9cef1ad..6bb10816 100644 --- a/jni/love/src/modules/image/magpie/DevilHandler.cpp +++ b/jni/love/src/modules/image/magpie/DevilHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/DevilHandler.h b/jni/love/src/modules/image/magpie/DevilHandler.h index a65233f0..a5244597 100644 --- a/jni/love/src/modules/image/magpie/DevilHandler.h +++ b/jni/love/src/modules/image/magpie/DevilHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/FormatHandler.cpp b/jni/love/src/modules/image/magpie/FormatHandler.cpp index 0a9dfc61..55781fec 100644 --- a/jni/love/src/modules/image/magpie/FormatHandler.cpp +++ b/jni/love/src/modules/image/magpie/FormatHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/FormatHandler.h b/jni/love/src/modules/image/magpie/FormatHandler.h index 5ee9435d..15cd0e8c 100644 --- a/jni/love/src/modules/image/magpie/FormatHandler.h +++ b/jni/love/src/modules/image/magpie/FormatHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/Image.cpp b/jni/love/src/modules/image/magpie/Image.cpp index 47676ec3..166f8271 100644 --- a/jni/love/src/modules/image/magpie/Image.cpp +++ b/jni/love/src/modules/image/magpie/Image.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/Image.h b/jni/love/src/modules/image/magpie/Image.h index df4b8a61..4597e46b 100644 --- a/jni/love/src/modules/image/magpie/Image.h +++ b/jni/love/src/modules/image/magpie/Image.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/ImageData.cpp b/jni/love/src/modules/image/magpie/ImageData.cpp index 617595ea..4a3c0548 100644 --- a/jni/love/src/modules/image/magpie/ImageData.cpp +++ b/jni/love/src/modules/image/magpie/ImageData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/ImageData.h b/jni/love/src/modules/image/magpie/ImageData.h index c2bfe006..c8dbc945 100644 --- a/jni/love/src/modules/image/magpie/ImageData.h +++ b/jni/love/src/modules/image/magpie/ImageData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/JPEGHandler.cpp b/jni/love/src/modules/image/magpie/JPEGHandler.cpp index 5af1200c..f4c4512f 100644 --- a/jni/love/src/modules/image/magpie/JPEGHandler.cpp +++ b/jni/love/src/modules/image/magpie/JPEGHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/JPEGHandler.h b/jni/love/src/modules/image/magpie/JPEGHandler.h index 5ea1c0c9..9c25e3a1 100644 --- a/jni/love/src/modules/image/magpie/JPEGHandler.h +++ b/jni/love/src/modules/image/magpie/JPEGHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/KTXHandler.cpp b/jni/love/src/modules/image/magpie/KTXHandler.cpp index fcaf61e6..bd7397de 100644 --- a/jni/love/src/modules/image/magpie/KTXHandler.cpp +++ b/jni/love/src/modules/image/magpie/KTXHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/KTXHandler.h b/jni/love/src/modules/image/magpie/KTXHandler.h index 4ac823e7..06b701f5 100644 --- a/jni/love/src/modules/image/magpie/KTXHandler.h +++ b/jni/love/src/modules/image/magpie/KTXHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/PKMHandler.cpp b/jni/love/src/modules/image/magpie/PKMHandler.cpp index 26ae1972..0662c5da 100644 --- a/jni/love/src/modules/image/magpie/PKMHandler.cpp +++ b/jni/love/src/modules/image/magpie/PKMHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/PKMHandler.h b/jni/love/src/modules/image/magpie/PKMHandler.h index 1df3ffda..0978f769 100644 --- a/jni/love/src/modules/image/magpie/PKMHandler.h +++ b/jni/love/src/modules/image/magpie/PKMHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/PNGHandler.cpp b/jni/love/src/modules/image/magpie/PNGHandler.cpp index 5f57c34e..ae72c020 100644 --- a/jni/love/src/modules/image/magpie/PNGHandler.cpp +++ b/jni/love/src/modules/image/magpie/PNGHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/PNGHandler.h b/jni/love/src/modules/image/magpie/PNGHandler.h index 74f7f475..0b6d1a77 100644 --- a/jni/love/src/modules/image/magpie/PNGHandler.h +++ b/jni/love/src/modules/image/magpie/PNGHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/PVRHandler.cpp b/jni/love/src/modules/image/magpie/PVRHandler.cpp index 2e12c350..3ccd7aa9 100644 --- a/jni/love/src/modules/image/magpie/PVRHandler.cpp +++ b/jni/love/src/modules/image/magpie/PVRHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/PVRHandler.h b/jni/love/src/modules/image/magpie/PVRHandler.h index f35cc9ae..6272692e 100644 --- a/jni/love/src/modules/image/magpie/PVRHandler.h +++ b/jni/love/src/modules/image/magpie/PVRHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/STBHandler.cpp b/jni/love/src/modules/image/magpie/STBHandler.cpp index f7b1b66a..5c30d43b 100644 --- a/jni/love/src/modules/image/magpie/STBHandler.cpp +++ b/jni/love/src/modules/image/magpie/STBHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/STBHandler.h b/jni/love/src/modules/image/magpie/STBHandler.h index 0c51e4d4..2636fd65 100644 --- a/jni/love/src/modules/image/magpie/STBHandler.h +++ b/jni/love/src/modules/image/magpie/STBHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/magpie/ddsHandler.cpp b/jni/love/src/modules/image/magpie/ddsHandler.cpp index 008a1bb8..30d3b9a9 100644 --- a/jni/love/src/modules/image/magpie/ddsHandler.cpp +++ b/jni/love/src/modules/image/magpie/ddsHandler.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -118,6 +118,14 @@ CompressedData::Format DDSHandler::convertFormat(dds::Format ddsformat) return CompressedData::FORMAT_BC5; case dds::FORMAT_BC5s: return CompressedData::FORMAT_BC5s; + case dds::FORMAT_BC6H: + return CompressedData::FORMAT_BC6H; + case dds::FORMAT_BC6Hs: + return CompressedData::FORMAT_BC6Hs; + case dds::FORMAT_BC7: + return CompressedData::FORMAT_BC7; + case dds::FORMAT_BC7srgb: + return CompressedData::FORMAT_BC7SRGB; default: return CompressedData::FORMAT_UNKNOWN; } diff --git a/jni/love/src/modules/image/magpie/ddsHandler.h b/jni/love/src/modules/image/magpie/ddsHandler.h index 196a1f13..9f4869ed 100644 --- a/jni/love/src/modules/image/magpie/ddsHandler.h +++ b/jni/love/src/modules/image/magpie/ddsHandler.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/wrap_CompressedData.cpp b/jni/love/src/modules/image/wrap_CompressedData.cpp index 3b0fd65c..884d042a 100644 --- a/jni/love/src/modules/image/wrap_CompressedData.cpp +++ b/jni/love/src/modules/image/wrap_CompressedData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/wrap_CompressedData.h b/jni/love/src/modules/image/wrap_CompressedData.h index d55ec6da..fe9d4e38 100644 --- a/jni/love/src/modules/image/wrap_CompressedData.h +++ b/jni/love/src/modules/image/wrap_CompressedData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/wrap_Image.cpp b/jni/love/src/modules/image/wrap_Image.cpp index ffbccd10..9af04127 100644 --- a/jni/love/src/modules/image/wrap_Image.cpp +++ b/jni/love/src/modules/image/wrap_Image.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/wrap_Image.h b/jni/love/src/modules/image/wrap_Image.h index d1d20199..0b529ce5 100644 --- a/jni/love/src/modules/image/wrap_Image.h +++ b/jni/love/src/modules/image/wrap_Image.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/wrap_ImageData.cpp b/jni/love/src/modules/image/wrap_ImageData.cpp index cb3c941a..b4918fe4 100644 --- a/jni/love/src/modules/image/wrap_ImageData.cpp +++ b/jni/love/src/modules/image/wrap_ImageData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/image/wrap_ImageData.h b/jni/love/src/modules/image/wrap_ImageData.h index a8bbd51b..a3865b66 100644 --- a/jni/love/src/modules/image/wrap_ImageData.h +++ b/jni/love/src/modules/image/wrap_ImageData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/Joystick.cpp b/jni/love/src/modules/joystick/Joystick.cpp index fb0b7242..e0f8017e 100644 --- a/jni/love/src/modules/joystick/Joystick.cpp +++ b/jni/love/src/modules/joystick/Joystick.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/Joystick.h b/jni/love/src/modules/joystick/Joystick.h index 7f76c3a9..b2716ab3 100644 --- a/jni/love/src/modules/joystick/Joystick.h +++ b/jni/love/src/modules/joystick/Joystick.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/JoystickModule.h b/jni/love/src/modules/joystick/JoystickModule.h index 8c4ca63b..cc3fc140 100644 --- a/jni/love/src/modules/joystick/JoystickModule.h +++ b/jni/love/src/modules/joystick/JoystickModule.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/sdl/Joystick.cpp b/jni/love/src/modules/joystick/sdl/Joystick.cpp index 3ae2a03d..2cef123b 100644 --- a/jni/love/src/modules/joystick/sdl/Joystick.cpp +++ b/jni/love/src/modules/joystick/sdl/Joystick.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/sdl/Joystick.h b/jni/love/src/modules/joystick/sdl/Joystick.h index 6d9cdaba..e4521a8f 100644 --- a/jni/love/src/modules/joystick/sdl/Joystick.h +++ b/jni/love/src/modules/joystick/sdl/Joystick.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/sdl/JoystickModule.cpp b/jni/love/src/modules/joystick/sdl/JoystickModule.cpp index a6af7870..de8fbe35 100644 --- a/jni/love/src/modules/joystick/sdl/JoystickModule.cpp +++ b/jni/love/src/modules/joystick/sdl/JoystickModule.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -489,6 +489,10 @@ void JoystickModule::loadGamepadMappings(const std::string &mappings) if (mapping.empty()) continue; + // Lines starting with "#" are comments. + if (mapping[0] == '#') + continue; + // Strip out and compare any "platform:XYZ," in the mapping. size_t pstartpos = mapping.find("platform:"); if (pstartpos != std::string::npos) @@ -499,7 +503,11 @@ void JoystickModule::loadGamepadMappings(const std::string &mappings) std::string platform = mapping.substr(pstartpos, pendpos - pstartpos); if (platform.compare(SDL_GetPlatform()) != 0) + { + // Ignore the mapping but still acknowledge that it is one. + success = true; continue; + } pstartpos -= strlen("platform:"); mapping.erase(pstartpos, pendpos - pstartpos + 1); diff --git a/jni/love/src/modules/joystick/sdl/JoystickModule.h b/jni/love/src/modules/joystick/sdl/JoystickModule.h index 047fedf6..af61cb79 100644 --- a/jni/love/src/modules/joystick/sdl/JoystickModule.h +++ b/jni/love/src/modules/joystick/sdl/JoystickModule.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/wrap_Joystick.cpp b/jni/love/src/modules/joystick/wrap_Joystick.cpp index 02e6484f..40a67edc 100644 --- a/jni/love/src/modules/joystick/wrap_Joystick.cpp +++ b/jni/love/src/modules/joystick/wrap_Joystick.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/wrap_Joystick.h b/jni/love/src/modules/joystick/wrap_Joystick.h index 2b920595..824de6d5 100644 --- a/jni/love/src/modules/joystick/wrap_Joystick.h +++ b/jni/love/src/modules/joystick/wrap_Joystick.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/joystick/wrap_JoystickModule.cpp b/jni/love/src/modules/joystick/wrap_JoystickModule.cpp index f70c291c..8fd3ec9b 100644 --- a/jni/love/src/modules/joystick/wrap_JoystickModule.cpp +++ b/jni/love/src/modules/joystick/wrap_JoystickModule.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -179,13 +179,17 @@ int w_getGamepadMapping(lua_State *L) int w_loadGamepadMappings(lua_State *L) { - lua_pushvalue(L, 1); - luax_convobj(L, -1, "filesystem", "isFile"); - bool isfile = luax_toboolean(L, -1); - lua_pop(L, 1); - + bool isfile = true; std::string mappings; + if (lua_isstring(L, 1)) + { + lua_pushvalue(L, 1); + luax_convobj(L, -1, "filesystem", "isFile"); + isfile = luax_toboolean(L, -1); + lua_pop(L, 1); + } + if (isfile) { love::filesystem::FileData *fd = love::filesystem::luax_getfiledata(L, 1); diff --git a/jni/love/src/modules/joystick/wrap_JoystickModule.h b/jni/love/src/modules/joystick/wrap_JoystickModule.h index 5d9223e7..3bbd97fd 100644 --- a/jni/love/src/modules/joystick/wrap_JoystickModule.h +++ b/jni/love/src/modules/joystick/wrap_JoystickModule.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/keyboard/Keyboard.cpp b/jni/love/src/modules/keyboard/Keyboard.cpp index 9d0d7011..f8d4ef2e 100644 --- a/jni/love/src/modules/keyboard/Keyboard.cpp +++ b/jni/love/src/modules/keyboard/Keyboard.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/keyboard/Keyboard.h b/jni/love/src/modules/keyboard/Keyboard.h index 8fccd74a..91f08c1e 100644 --- a/jni/love/src/modules/keyboard/Keyboard.h +++ b/jni/love/src/modules/keyboard/Keyboard.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -242,7 +242,7 @@ public: KEY_EJECT, KEY_SLEEP, - KEY_MAX_ENUM = 512 + KEY_MAX_ENUM }; virtual ~Keyboard() {} diff --git a/jni/love/src/modules/keyboard/sdl/Keyboard.cpp b/jni/love/src/modules/keyboard/sdl/Keyboard.cpp index d736ab53..b0de8fc5 100644 --- a/jni/love/src/modules/keyboard/sdl/Keyboard.cpp +++ b/jni/love/src/modules/keyboard/sdl/Keyboard.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -18,8 +18,6 @@ * 3. This notice may not be removed or altered from any source distribution. **/ -#include "common/config.h" - #include "Keyboard.h" namespace love @@ -55,8 +53,8 @@ bool Keyboard::isDown(Key *keylist) const for (Key key = *keylist; key != KEY_MAX_ENUM; key = *(++keylist)) { - auto it = keys.find(key); - if (it != keys.end() && keystate[SDL_GetScancodeFromKey(it->second)]) + SDL_Scancode scancode = SDL_GetScancodeFromKey(keymap[key]); + if (keystate[scancode]) return true; } @@ -73,10 +71,10 @@ void Keyboard::setTextInput(bool enable) void Keyboard::setTextInput(bool enable, int x, int y, int w, int h) { - setTextInput(enable); - SDL_Rect textrect = {x, y, w, h}; SDL_SetTextInputRect(&textrect); + + setTextInput(enable); } bool Keyboard::hasTextInput() const @@ -89,9 +87,10 @@ bool Keyboard::hasScreenKeyboard() const return SDL_HasScreenKeyboardSupport(); } -std::map Keyboard::createKeyMap() +const SDL_Keycode *Keyboard::createKeyMap() { - std::map k; + // Array must be static so its lifetime continues once the function returns. + static SDL_Keycode k[Keyboard::KEY_MAX_ENUM] = {SDLK_UNKNOWN}; k[Keyboard::KEY_UNKNOWN] = SDLK_UNKNOWN; @@ -301,7 +300,7 @@ std::map Keyboard::createKeyMap() return k; } -std::map Keyboard::keys = Keyboard::createKeyMap(); +const SDL_Keycode *Keyboard::keymap = Keyboard::createKeyMap(); } // sdl } // keyboard diff --git a/jni/love/src/modules/keyboard/sdl/Keyboard.h b/jni/love/src/modules/keyboard/sdl/Keyboard.h index 5cab6502..f7b86c7f 100644 --- a/jni/love/src/modules/keyboard/sdl/Keyboard.h +++ b/jni/love/src/modules/keyboard/sdl/Keyboard.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -26,10 +26,7 @@ #include "common/EnumMap.h" // SDL -#include - -// STL -#include +#include namespace love { @@ -62,8 +59,8 @@ private: // The real implementation is in love::event::sdl::Event::Convert. bool key_repeat; - static std::map createKeyMap(); - static std::map keys; + static const SDL_Keycode *createKeyMap(); + static const SDL_Keycode *keymap; }; // Keyboard diff --git a/jni/love/src/modules/keyboard/wrap_Keyboard.cpp b/jni/love/src/modules/keyboard/wrap_Keyboard.cpp index 0cd52da4..0430d91a 100644 --- a/jni/love/src/modules/keyboard/wrap_Keyboard.cpp +++ b/jni/love/src/modules/keyboard/wrap_Keyboard.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/keyboard/wrap_Keyboard.h b/jni/love/src/modules/keyboard/wrap_Keyboard.h index e69f0dbf..fe3afc01 100644 --- a/jni/love/src/modules/keyboard/wrap_Keyboard.h +++ b/jni/love/src/modules/keyboard/wrap_Keyboard.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/love/love.cpp b/jni/love/src/modules/love/love.cpp index fd268f96..cd6b2ffc 100644 --- a/jni/love/src/modules/love/love.cpp +++ b/jni/love/src/modules/love/love.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/love/love.h b/jni/love/src/modules/love/love.h index c6ab3975..a3d5f389 100644 --- a/jni/love/src/modules/love/love.h +++ b/jni/love/src/modules/love/love.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/BezierCurve.cpp b/jni/love/src/modules/math/BezierCurve.cpp index 33c96c56..3c1f7685 100644 --- a/jni/love/src/modules/math/BezierCurve.cpp +++ b/jni/love/src/modules/math/BezierCurve.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/BezierCurve.h b/jni/love/src/modules/math/BezierCurve.h index 9370dc52..7c06bf6e 100644 --- a/jni/love/src/modules/math/BezierCurve.h +++ b/jni/love/src/modules/math/BezierCurve.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/MathModule.cpp b/jni/love/src/modules/math/MathModule.cpp index 2f92bf07..c9d78eb7 100644 --- a/jni/love/src/modules/math/MathModule.cpp +++ b/jni/love/src/modules/math/MathModule.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/MathModule.h b/jni/love/src/modules/math/MathModule.h index 69c80492..d3e1e8cb 100644 --- a/jni/love/src/modules/math/MathModule.h +++ b/jni/love/src/modules/math/MathModule.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/RandomGenerator.cpp b/jni/love/src/modules/math/RandomGenerator.cpp index 6b14390f..5bc86d04 100644 --- a/jni/love/src/modules/math/RandomGenerator.cpp +++ b/jni/love/src/modules/math/RandomGenerator.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -81,11 +81,6 @@ void RandomGenerator::setSeed(RandomGenerator::Seed newseed) seed = newseed; rng_state = seed; - - // Xorshift's first couple results after seeding will be similar to results - // from very similar seeds, so we immediately discard them here. - for (int i = 0; i < 2; i++) - rand(); } RandomGenerator::Seed RandomGenerator::getSeed() const diff --git a/jni/love/src/modules/math/RandomGenerator.h b/jni/love/src/modules/math/RandomGenerator.h index aab0f927..080df0c5 100644 --- a/jni/love/src/modules/math/RandomGenerator.h +++ b/jni/love/src/modules/math/RandomGenerator.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/wrap_BezierCurve.cpp b/jni/love/src/modules/math/wrap_BezierCurve.cpp index 659c0bd7..0104d831 100644 --- a/jni/love/src/modules/math/wrap_BezierCurve.cpp +++ b/jni/love/src/modules/math/wrap_BezierCurve.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/wrap_BezierCurve.h b/jni/love/src/modules/math/wrap_BezierCurve.h index ad0558e9..9fd0fbd1 100644 --- a/jni/love/src/modules/math/wrap_BezierCurve.h +++ b/jni/love/src/modules/math/wrap_BezierCurve.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/wrap_Math.cpp b/jni/love/src/modules/math/wrap_Math.cpp index 6e7c0195..1e766d62 100644 --- a/jni/love/src/modules/math/wrap_Math.cpp +++ b/jni/love/src/modules/math/wrap_Math.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/wrap_Math.h b/jni/love/src/modules/math/wrap_Math.h index d75afe4a..275e2497 100644 --- a/jni/love/src/modules/math/wrap_Math.h +++ b/jni/love/src/modules/math/wrap_Math.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/wrap_RandomGenerator.cpp b/jni/love/src/modules/math/wrap_RandomGenerator.cpp index 6935d859..4b1ef586 100644 --- a/jni/love/src/modules/math/wrap_RandomGenerator.cpp +++ b/jni/love/src/modules/math/wrap_RandomGenerator.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/math/wrap_RandomGenerator.h b/jni/love/src/modules/math/wrap_RandomGenerator.h index ad5201d1..3f84825a 100644 --- a/jni/love/src/modules/math/wrap_RandomGenerator.h +++ b/jni/love/src/modules/math/wrap_RandomGenerator.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/Cursor.cpp b/jni/love/src/modules/mouse/Cursor.cpp index e1a0d717..15e61dd5 100644 --- a/jni/love/src/modules/mouse/Cursor.cpp +++ b/jni/love/src/modules/mouse/Cursor.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/Cursor.h b/jni/love/src/modules/mouse/Cursor.h index 08f2f17f..44f932da 100644 --- a/jni/love/src/modules/mouse/Cursor.h +++ b/jni/love/src/modules/mouse/Cursor.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/Mouse.cpp b/jni/love/src/modules/mouse/Mouse.cpp index 10db0ecd..9f745354 100644 --- a/jni/love/src/modules/mouse/Mouse.cpp +++ b/jni/love/src/modules/mouse/Mouse.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/Mouse.h b/jni/love/src/modules/mouse/Mouse.h index 16c199ec..0fd2da33 100644 --- a/jni/love/src/modules/mouse/Mouse.h +++ b/jni/love/src/modules/mouse/Mouse.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/sdl/Cursor.cpp b/jni/love/src/modules/mouse/sdl/Cursor.cpp index 809cd6a4..8c4511ea 100644 --- a/jni/love/src/modules/mouse/sdl/Cursor.cpp +++ b/jni/love/src/modules/mouse/sdl/Cursor.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/sdl/Cursor.h b/jni/love/src/modules/mouse/sdl/Cursor.h index de2d89da..91c04111 100644 --- a/jni/love/src/modules/mouse/sdl/Cursor.h +++ b/jni/love/src/modules/mouse/sdl/Cursor.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/sdl/Mouse.cpp b/jni/love/src/modules/mouse/sdl/Mouse.cpp index 710dae37..000c5ecd 100644 --- a/jni/love/src/modules/mouse/sdl/Mouse.cpp +++ b/jni/love/src/modules/mouse/sdl/Mouse.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -37,17 +37,12 @@ namespace sdl static void windowToPixelCoords(int *x, int *y) { #ifndef LOVE_ANDROID - double scale = 1.0; + window::Window *window = Module::getInstance(Module::M_WINDOW); - love::window::Window *window = love::window::sdl::Window::getSingleton(); - if (window != nullptr) - scale = window->getPixelScale(); - - if (x != nullptr) - *x = int(double(*x) * scale); - - if (y != nullptr) - *y = int(double(*y) * scale); + if (window && x) + *x = (int) window->toPixels(*x); + if (window && y) + *y = (int) window->toPixels(*y); #endif } @@ -55,17 +50,12 @@ static void windowToPixelCoords(int *x, int *y) static void pixelToWindowCoords(int *x, int *y) { #ifndef LOVE_ANDROID - double scale = 1.0; + window::Window *window = Module::getInstance(Module::M_WINDOW); - love::window::Window *window = love::window::sdl::Window::getSingleton(); - if (window != nullptr) - scale = window->getPixelScale(); - - if (x != nullptr) - *x = int(double(*x) / scale); - - if (y != nullptr) - *y = int(double(*y) / scale); + if (window && x) + *x = (int) window->fromPixels(*x); + if (window && y) + *y = (int) window->fromPixels(*y); #endif } @@ -131,10 +121,18 @@ bool Mouse::hasCursor() const return SDL_GetDefaultCursor() != nullptr; } +static Uint32 GetSDLMouseState(int *x, int *y) +{ + // SDL's Linux and Windows video backends don't update the internal mouse + // state until the next PumpEvents, if SDL_WarpMouse was called previously. + SDL_PumpEvents(); + return SDL_GetMouseState(x, y); +} + int Mouse::getX() const { int x; - SDL_GetMouseState(&x, nullptr); + GetSDLMouseState(&x, nullptr); windowToPixelCoords(&x, nullptr); return x; @@ -143,7 +141,7 @@ int Mouse::getX() const int Mouse::getY() const { int y; - SDL_GetMouseState(nullptr, &y); + GetSDLMouseState(nullptr, &y); windowToPixelCoords(nullptr, &y); return y; @@ -152,7 +150,7 @@ int Mouse::getY() const void Mouse::getPosition(int &x, int &y) const { int mx, my; - SDL_GetMouseState(&mx, &my); + GetSDLMouseState(&mx, &my); windowToPixelCoords(&mx, &my); x = mx; diff --git a/jni/love/src/modules/mouse/sdl/Mouse.h b/jni/love/src/modules/mouse/sdl/Mouse.h index 41deba8f..170aea14 100644 --- a/jni/love/src/modules/mouse/sdl/Mouse.h +++ b/jni/love/src/modules/mouse/sdl/Mouse.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/wrap_Cursor.cpp b/jni/love/src/modules/mouse/wrap_Cursor.cpp index 240aedb5..2bb93cfc 100644 --- a/jni/love/src/modules/mouse/wrap_Cursor.cpp +++ b/jni/love/src/modules/mouse/wrap_Cursor.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/wrap_Cursor.h b/jni/love/src/modules/mouse/wrap_Cursor.h index a1cfaa0f..f189dce7 100644 --- a/jni/love/src/modules/mouse/wrap_Cursor.h +++ b/jni/love/src/modules/mouse/wrap_Cursor.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/wrap_Mouse.cpp b/jni/love/src/modules/mouse/wrap_Mouse.cpp index 9358a1a1..6c026a4e 100644 --- a/jni/love/src/modules/mouse/wrap_Mouse.cpp +++ b/jni/love/src/modules/mouse/wrap_Mouse.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/mouse/wrap_Mouse.h b/jni/love/src/modules/mouse/wrap_Mouse.h index e3779d7e..70d92edf 100644 --- a/jni/love/src/modules/mouse/wrap_Mouse.h +++ b/jni/love/src/modules/mouse/wrap_Mouse.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/Body.cpp b/jni/love/src/modules/physics/Body.cpp index 22bbb5d2..2bfde52f 100644 --- a/jni/love/src/modules/physics/Body.cpp +++ b/jni/love/src/modules/physics/Body.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/Body.h b/jni/love/src/modules/physics/Body.h index 1f5a4c7d..df0f2e7a 100644 --- a/jni/love/src/modules/physics/Body.h +++ b/jni/love/src/modules/physics/Body.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/Joint.cpp b/jni/love/src/modules/physics/Joint.cpp index e04eff11..d9cf1804 100644 --- a/jni/love/src/modules/physics/Joint.cpp +++ b/jni/love/src/modules/physics/Joint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/Joint.h b/jni/love/src/modules/physics/Joint.h index 9ab80c21..2e552b18 100644 --- a/jni/love/src/modules/physics/Joint.h +++ b/jni/love/src/modules/physics/Joint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/Shape.cpp b/jni/love/src/modules/physics/Shape.cpp index bbb81b37..5368bad2 100644 --- a/jni/love/src/modules/physics/Shape.cpp +++ b/jni/love/src/modules/physics/Shape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/Shape.h b/jni/love/src/modules/physics/Shape.h index 5eb3e42e..988592ec 100644 --- a/jni/love/src/modules/physics/Shape.h +++ b/jni/love/src/modules/physics/Shape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/Body.cpp b/jni/love/src/modules/physics/box2d/Body.cpp index e28d1f02..e6232ef9 100644 --- a/jni/love/src/modules/physics/box2d/Body.cpp +++ b/jni/love/src/modules/physics/box2d/Body.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -28,6 +28,9 @@ #include "World.h" #include "Physics.h" +// Needed for luax_pushjoint. +#include "wrap_Joint.h" + namespace love { namespace physics @@ -440,6 +443,30 @@ int Body::getFixtureList(lua_State *L) const return 1; } +int Body::getJointList(lua_State *L) const +{ + lua_newtable(L); + const b2JointEdge *je = body->GetJointList(); + int i = 1; + + do + { + if (!je) + break; + + Joint *joint = (Joint *) Memoizer::find(je->joint); + if (!joint) + throw love::Exception("A joint has escaped Memoizer!"); + + luax_pushjoint(L, joint); + lua_rawseti(L, -2, i); + i++; + } + while ((je = je->next)); + + return 1; +} + int Body::getContactList(lua_State *L) const { lua_newtable(L); diff --git a/jni/love/src/modules/physics/box2d/Body.h b/jni/love/src/modules/physics/box2d/Body.h index e951d242..a27c1e9f 100644 --- a/jni/love/src/modules/physics/box2d/Body.h +++ b/jni/love/src/modules/physics/box2d/Body.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -393,6 +393,11 @@ public: **/ int getFixtureList(lua_State *L) const; + /** + * Get an array of all Joints attached to this Body. + **/ + int getJointList(lua_State *L) const; + /** * Get an array of all active Contacts attached to this Body. * This list changes during World:update and you may miss some collisions diff --git a/jni/love/src/modules/physics/box2d/ChainShape.cpp b/jni/love/src/modules/physics/box2d/ChainShape.cpp index 0ea60d03..4c778a3d 100644 --- a/jni/love/src/modules/physics/box2d/ChainShape.cpp +++ b/jni/love/src/modules/physics/box2d/ChainShape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/ChainShape.h b/jni/love/src/modules/physics/box2d/ChainShape.h index 52bb6673..f2defdf0 100644 --- a/jni/love/src/modules/physics/box2d/ChainShape.h +++ b/jni/love/src/modules/physics/box2d/ChainShape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/CircleShape.cpp b/jni/love/src/modules/physics/box2d/CircleShape.cpp index 97d4c5e5..1b1e6a43 100644 --- a/jni/love/src/modules/physics/box2d/CircleShape.cpp +++ b/jni/love/src/modules/physics/box2d/CircleShape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/CircleShape.h b/jni/love/src/modules/physics/box2d/CircleShape.h index 68bf70d8..015e60a2 100644 --- a/jni/love/src/modules/physics/box2d/CircleShape.h +++ b/jni/love/src/modules/physics/box2d/CircleShape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/Contact.cpp b/jni/love/src/modules/physics/box2d/Contact.cpp index b3a48002..dc4638b5 100644 --- a/jni/love/src/modules/physics/box2d/Contact.cpp +++ b/jni/love/src/modules/physics/box2d/Contact.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/Contact.h b/jni/love/src/modules/physics/box2d/Contact.h index 6068d3e6..3a0dac0a 100644 --- a/jni/love/src/modules/physics/box2d/Contact.h +++ b/jni/love/src/modules/physics/box2d/Contact.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/DistanceJoint.cpp b/jni/love/src/modules/physics/box2d/DistanceJoint.cpp index 0f6d6262..66882c97 100644 --- a/jni/love/src/modules/physics/box2d/DistanceJoint.cpp +++ b/jni/love/src/modules/physics/box2d/DistanceJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/DistanceJoint.h b/jni/love/src/modules/physics/box2d/DistanceJoint.h index c87ef982..a36bf995 100644 --- a/jni/love/src/modules/physics/box2d/DistanceJoint.h +++ b/jni/love/src/modules/physics/box2d/DistanceJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/EdgeShape.cpp b/jni/love/src/modules/physics/box2d/EdgeShape.cpp index 9272042a..61439292 100644 --- a/jni/love/src/modules/physics/box2d/EdgeShape.cpp +++ b/jni/love/src/modules/physics/box2d/EdgeShape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/EdgeShape.h b/jni/love/src/modules/physics/box2d/EdgeShape.h index a006a4e4..6980e43d 100644 --- a/jni/love/src/modules/physics/box2d/EdgeShape.h +++ b/jni/love/src/modules/physics/box2d/EdgeShape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/Fixture.cpp b/jni/love/src/modules/physics/box2d/Fixture.cpp index 9d5b8f6f..92dda491 100644 --- a/jni/love/src/modules/physics/box2d/Fixture.cpp +++ b/jni/love/src/modules/physics/box2d/Fixture.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/Fixture.h b/jni/love/src/modules/physics/box2d/Fixture.h index 5564406d..f942592c 100644 --- a/jni/love/src/modules/physics/box2d/Fixture.h +++ b/jni/love/src/modules/physics/box2d/Fixture.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/FrictionJoint.cpp b/jni/love/src/modules/physics/box2d/FrictionJoint.cpp index 7edc0432..2e29c641 100644 --- a/jni/love/src/modules/physics/box2d/FrictionJoint.cpp +++ b/jni/love/src/modules/physics/box2d/FrictionJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/FrictionJoint.h b/jni/love/src/modules/physics/box2d/FrictionJoint.h index b2cde0de..fd85bb7e 100644 --- a/jni/love/src/modules/physics/box2d/FrictionJoint.h +++ b/jni/love/src/modules/physics/box2d/FrictionJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/GearJoint.cpp b/jni/love/src/modules/physics/box2d/GearJoint.cpp index c2ea845d..4c2e8942 100644 --- a/jni/love/src/modules/physics/box2d/GearJoint.cpp +++ b/jni/love/src/modules/physics/box2d/GearJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -23,6 +23,7 @@ // Module #include "Body.h" #include "World.h" +#include "common/Memoizer.h" namespace love { @@ -60,6 +61,32 @@ float GearJoint::getRatio() const return joint->GetRatio(); } +Joint *GearJoint::getJointA() const +{ + b2Joint *b2joint = joint->GetJoint1(); + if (b2joint == nullptr) + return nullptr; + + Joint *j = (Joint *) Memoizer::find(b2joint); + if (j == nullptr) + throw love::Exception("A joint has escaped Memoizer!"); + + return j; +} + +Joint *GearJoint::getJointB() const +{ + b2Joint *b2joint = joint->GetJoint2(); + if (b2joint == nullptr) + return nullptr; + + Joint *j = (Joint *) Memoizer::find(b2joint); + if (j == nullptr) + throw love::Exception("A joint has escaped Memoizer!"); + + return j; +} + } // box2d } // physics } // love diff --git a/jni/love/src/modules/physics/box2d/GearJoint.h b/jni/love/src/modules/physics/box2d/GearJoint.h index c36cbffb..39f00c09 100644 --- a/jni/love/src/modules/physics/box2d/GearJoint.h +++ b/jni/love/src/modules/physics/box2d/GearJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -64,6 +64,9 @@ public: **/ float getRatio() const; + Joint *getJointA() const; + Joint *getJointB() const; + private: // The Box2D GearJoint object. b2GearJoint *joint; diff --git a/jni/love/src/modules/physics/box2d/Joint.cpp b/jni/love/src/modules/physics/box2d/Joint.cpp index ee48d202..61aca42c 100644 --- a/jni/love/src/modules/physics/box2d/Joint.cpp +++ b/jni/love/src/modules/physics/box2d/Joint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -90,11 +90,39 @@ Joint::Type Joint::getType() const return JOINT_WHEEL; case e_ropeJoint: return JOINT_ROPE; + case e_motorJoint: + return JOINT_MOTOR; default: return JOINT_INVALID; } } +Body *Joint::getBodyA() const +{ + b2Body *b2body = joint->GetBodyA(); + if (b2body == nullptr) + return nullptr; + + Body *body = (Body *) Memoizer::find(b2body); + if (body == nullptr) + throw love::Exception("A body has escaped Memoizer!"); + + return body; +} + +Body *Joint::getBodyB() const +{ + b2Body *b2body = joint->GetBodyB(); + if (b2body == nullptr) + return nullptr; + + Body *body = (Body *) Memoizer::find(b2body); + if (body == nullptr) + throw love::Exception("A body has escaped Memoizer!"); + + return body; +} + bool Joint::isValid() const { return joint != 0; diff --git a/jni/love/src/modules/physics/box2d/Joint.h b/jni/love/src/modules/physics/box2d/Joint.h index ba266808..d20bb385 100644 --- a/jni/love/src/modules/physics/box2d/Joint.h +++ b/jni/love/src/modules/physics/box2d/Joint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -79,12 +79,14 @@ public: **/ bool isValid() const; - /** * Gets the type of joint. **/ Type getType() const; + Body *getBodyA() const; + Body *getBodyB() const; + /** * Gets the anchor positions of the Joint in world * coordinates. This is useful for debugdrawing the joint. diff --git a/jni/love/src/modules/physics/box2d/MotorJoint.cpp b/jni/love/src/modules/physics/box2d/MotorJoint.cpp index 74d4006e..5e8f2a74 100644 --- a/jni/love/src/modules/physics/box2d/MotorJoint.cpp +++ b/jni/love/src/modules/physics/box2d/MotorJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/MotorJoint.h b/jni/love/src/modules/physics/box2d/MotorJoint.h index b40626dd..e677ca64 100644 --- a/jni/love/src/modules/physics/box2d/MotorJoint.h +++ b/jni/love/src/modules/physics/box2d/MotorJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/MouseJoint.cpp b/jni/love/src/modules/physics/box2d/MouseJoint.cpp index bd8c1ad5..19a15a81 100644 --- a/jni/love/src/modules/physics/box2d/MouseJoint.cpp +++ b/jni/love/src/modules/physics/box2d/MouseJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/MouseJoint.h b/jni/love/src/modules/physics/box2d/MouseJoint.h index f8cdef67..d7ef7238 100644 --- a/jni/love/src/modules/physics/box2d/MouseJoint.h +++ b/jni/love/src/modules/physics/box2d/MouseJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/Physics.cpp b/jni/love/src/modules/physics/box2d/Physics.cpp index b62c17ef..7e404496 100644 --- a/jni/love/src/modules/physics/box2d/Physics.cpp +++ b/jni/love/src/modules/physics/box2d/Physics.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -93,6 +93,12 @@ EdgeShape *Physics::newEdgeShape(float x1, float y1, float x2, float y2) int Physics::newPolygonShape(lua_State *L) { int argc = lua_gettop(L); + + bool istable = lua_istable(L, 1); + + if (istable) + argc = lua_objlen(L, 1); + if (argc % 2 != 0) return luaL_error(L, "Number of vertex components must be a multiple of two."); @@ -103,16 +109,31 @@ int Physics::newPolygonShape(lua_State *L) else if (vcount > b2_maxPolygonVertices) return luaL_error(L, "Expected a maximum of %d vertices, got %d.", b2_maxPolygonVertices, vcount); - b2PolygonShape *s = new b2PolygonShape(); - b2Vec2 vecs[b2_maxPolygonVertices]; - for (int i = 0; i < vcount; i++) + if (istable) { - float x = (float)luaL_checknumber(L, 1 + i * 2); - float y = (float)luaL_checknumber(L, 2 + i * 2); - vecs[i] = Physics::scaleDown(b2Vec2(x, y)); + for (int i = 0; i < vcount; i++) + { + lua_rawgeti(L, 1, 1 + i * 2); + lua_rawgeti(L, 1, 2 + i * 2); + float x = (float)luaL_checknumber(L, -2); + float y = (float)luaL_checknumber(L, -1); + vecs[i] = Physics::scaleDown(b2Vec2(x, y)); + lua_pop(L, 2); + } } + else + { + for (int i = 0; i < vcount; i++) + { + float x = (float)luaL_checknumber(L, 1 + i * 2); + float y = (float)luaL_checknumber(L, 2 + i * 2); + vecs[i] = Physics::scaleDown(b2Vec2(x, y)); + } + } + + b2PolygonShape *s = new b2PolygonShape(); try { @@ -133,22 +154,42 @@ int Physics::newPolygonShape(lua_State *L) int Physics::newChainShape(lua_State *L) { int argc = lua_gettop(L)-1; // first argument is looping + + bool istable = lua_istable(L, 2); + + if (istable) + argc = lua_objlen(L, 2); + if (argc % 2 != 0) return luaL_error(L, "Number of vertex components must be a multiple of two."); int vcount = (int)argc/2; - b2ChainShape *s = new b2ChainShape(); bool loop = luax_toboolean(L, 1); b2Vec2 *vecs = new b2Vec2[vcount]; - for (int i = 0; igetJointList(L); }); + return n; +} + int w_Body_getContactList(lua_State *L) { Body *t = luax_checkbody(L, 1); @@ -555,6 +564,13 @@ int w_Body_destroy(lua_State *L) return 0; } +int w_Body_isDestroyed(lua_State *L) +{ + Body *b = luax_checktype(L, 1, "Body", PHYSICS_BODY_T); + luax_pushboolean(L, b->body == nullptr); + return 1; +} + int w_Body_setUserData(lua_State *L) { Body *t = luax_checkbody(L, 1); @@ -623,8 +639,10 @@ static const luaL_Reg functions[] = { "isFixedRotation", w_Body_isFixedRotation }, { "getWorld", w_Body_getWorld }, { "getFixtureList", w_Body_getFixtureList }, + { "getJointList", w_Body_getJointList }, { "getContactList", w_Body_getContactList }, { "destroy", w_Body_destroy }, + { "isDestroyed", w_Body_isDestroyed }, { "setUserData", w_Body_setUserData }, { "getUserData", w_Body_getUserData }, { 0, 0 } diff --git a/jni/love/src/modules/physics/box2d/wrap_Body.h b/jni/love/src/modules/physics/box2d/wrap_Body.h index f6e65f25..fb28a3dc 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Body.h +++ b/jni/love/src/modules/physics/box2d/wrap_Body.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -85,8 +85,10 @@ int w_Body_setFixedRotation(lua_State *L); int w_Body_isFixedRotation(lua_State *L); int w_Body_getWorld(lua_State *L); int w_Body_getFixtureList(lua_State *L); +int w_Body_getJointList(lua_State *L); int w_Body_getContactList(lua_State *L); int w_Body_destroy(lua_State *L); +int w_Body_isDestroyed(lua_State *L); int w_Body_setUserData(lua_State *L); int w_Body_getUserData(lua_State *L); extern "C" int luaopen_body(lua_State *L); diff --git a/jni/love/src/modules/physics/box2d/wrap_ChainShape.cpp b/jni/love/src/modules/physics/box2d/wrap_ChainShape.cpp index 5e20279c..0f7b7b5a 100644 --- a/jni/love/src/modules/physics/box2d/wrap_ChainShape.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_ChainShape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_ChainShape.h b/jni/love/src/modules/physics/box2d/wrap_ChainShape.h index 81a6877d..2a2f878f 100644 --- a/jni/love/src/modules/physics/box2d/wrap_ChainShape.h +++ b/jni/love/src/modules/physics/box2d/wrap_ChainShape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_CircleShape.cpp b/jni/love/src/modules/physics/box2d/wrap_CircleShape.cpp index fad234c9..85610b86 100644 --- a/jni/love/src/modules/physics/box2d/wrap_CircleShape.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_CircleShape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_CircleShape.h b/jni/love/src/modules/physics/box2d/wrap_CircleShape.h index 0a37fe9d..61817332 100644 --- a/jni/love/src/modules/physics/box2d/wrap_CircleShape.h +++ b/jni/love/src/modules/physics/box2d/wrap_CircleShape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_Contact.cpp b/jni/love/src/modules/physics/box2d/wrap_Contact.cpp index e51786eb..bb02f60c 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Contact.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_Contact.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -151,6 +151,13 @@ int w_Contact_getFixtures(lua_State *L) return 2; } +int w_Contact_isDestroyed(lua_State *L) +{ + Contact *c = luax_checktype(L, 1, "Contact", PHYSICS_CONTACT_T); + luax_pushboolean(L, !c->isValid()); + return 1; +} + extern "C" int luaopen_contact(lua_State *L) { static const luaL_Reg functions[] = @@ -170,6 +177,7 @@ extern "C" int luaopen_contact(lua_State *L) { "getTangentSpeed", w_Contact_getTangentSpeed }, { "getChildren", w_Contact_getChildren }, { "getFixtures", w_Contact_getFixtures }, + { "isDestroyed", w_Contact_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_Contact.h b/jni/love/src/modules/physics/box2d/wrap_Contact.h index fd325c38..602d57bc 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Contact.h +++ b/jni/love/src/modules/physics/box2d/wrap_Contact.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -48,6 +48,7 @@ int w_Contact_setTangentSpeed(lua_State *L); int w_Contact_getTangentSpeed(lua_State *L); int w_Contact_getChildren(lua_State *L); int w_Contact_getFixtures(lua_State *L); +int w_Contact_isDestroyed(lua_State *L); extern "C" int luaopen_contact(lua_State *L); } // box2d diff --git a/jni/love/src/modules/physics/box2d/wrap_DistanceJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_DistanceJoint.cpp index 219196b0..1d16d967 100644 --- a/jni/love/src/modules/physics/box2d/wrap_DistanceJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_DistanceJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -90,6 +90,7 @@ static const luaL_Reg functions[] = { "getDampingRatio", w_DistanceJoint_getDampingRatio }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -97,6 +98,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_DistanceJoint.h b/jni/love/src/modules/physics/box2d/wrap_DistanceJoint.h index ae2a880d..5b107faa 100644 --- a/jni/love/src/modules/physics/box2d/wrap_DistanceJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_DistanceJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_EdgeShape.cpp b/jni/love/src/modules/physics/box2d/wrap_EdgeShape.cpp index 8784ccde..fb106486 100644 --- a/jni/love/src/modules/physics/box2d/wrap_EdgeShape.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_EdgeShape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_EdgeShape.h b/jni/love/src/modules/physics/box2d/wrap_EdgeShape.h index 3a1ad4b6..b77dd9bd 100644 --- a/jni/love/src/modules/physics/box2d/wrap_EdgeShape.h +++ b/jni/love/src/modules/physics/box2d/wrap_EdgeShape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_Fixture.cpp b/jni/love/src/modules/physics/box2d/wrap_Fixture.cpp index 23678bc9..907cf14b 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Fixture.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_Fixture.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -262,6 +262,13 @@ int w_Fixture_destroy(lua_State *L) return 0; } +int w_Fixture_isDestroyed(lua_State *L) +{ + Fixture *f = luax_checktype(L, 1, "Fixture", PHYSICS_FIXTURE_T); + luax_pushboolean(L, !f->isValid()); + return 1; +} + static const luaL_Reg functions[] = { { "getType", w_Fixture_getType }, @@ -290,6 +297,7 @@ static const luaL_Reg functions[] = { "getGroupIndex", w_Fixture_getGroupIndex }, { "setGroupIndex", w_Fixture_setGroupIndex }, { "destroy", w_Fixture_destroy }, + { "isDestroyed", w_Fixture_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_Fixture.h b/jni/love/src/modules/physics/box2d/wrap_Fixture.h index 4bce8e90..7c6f9a0f 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Fixture.h +++ b/jni/love/src/modules/physics/box2d/wrap_Fixture.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -60,6 +60,7 @@ int w_Fixture_getMassData(lua_State *L); int w_Fixture_getGroupIndex(lua_State *L); int w_Fixture_setGroupIndex(lua_State *L); int w_Fixture_destroy(lua_State *L); +int w_Fixture_isDestroyed(lua_State *L); extern "C" int luaopen_fixture(lua_State *L); } // box2d diff --git a/jni/love/src/modules/physics/box2d/wrap_FrictionJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_FrictionJoint.cpp index cc202e3b..94de9bb1 100644 --- a/jni/love/src/modules/physics/box2d/wrap_FrictionJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_FrictionJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -74,6 +74,7 @@ static const luaL_Reg functions[] = { "getMaxTorque", w_FrictionJoint_getMaxTorque }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -81,6 +82,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_FrictionJoint.h b/jni/love/src/modules/physics/box2d/wrap_FrictionJoint.h index 9b16193d..3d8184f1 100644 --- a/jni/love/src/modules/physics/box2d/wrap_FrictionJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_FrictionJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_GearJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_GearJoint.cpp index 114045e1..11733198 100644 --- a/jni/love/src/modules/physics/box2d/wrap_GearJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_GearJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -51,12 +51,30 @@ int w_GearJoint_getRatio(lua_State *L) return 1; } +int w_GearJoint_getJoints(lua_State *L) +{ + GearJoint *t = luax_checkgearjoint(L, 1); + Joint *j1 = nullptr; + Joint *j2 = nullptr; + + luax_catchexcept(L, [&]() { + j1 = t->getJointA(); + j2 = t->getJointB(); + }); + + luax_pushjoint(L, j1); + luax_pushjoint(L, j2); + return 2; +} + static const luaL_Reg functions[] = { { "setRatio", w_GearJoint_setRatio }, { "getRatio", w_GearJoint_getRatio }, + { "getJoints", w_GearJoint_getJoints }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -64,6 +82,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_GearJoint.h b/jni/love/src/modules/physics/box2d/wrap_GearJoint.h index c97c26b5..cf7ea97a 100644 --- a/jni/love/src/modules/physics/box2d/wrap_GearJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_GearJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -36,6 +36,7 @@ namespace box2d GearJoint *luax_checkgearjoint(lua_State *L, int idx); int w_GearJoint_setRatio(lua_State *L); int w_GearJoint_getRatio(lua_State *L); +int w_GearJoint_getJoints(lua_State *L); extern "C" int luaopen_gearjoint(lua_State *L); } // box2d diff --git a/jni/love/src/modules/physics/box2d/wrap_Joint.cpp b/jni/love/src/modules/physics/box2d/wrap_Joint.cpp index 4e2727e7..2f7026bd 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Joint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_Joint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -21,6 +21,7 @@ // LOVE #include "wrap_Joint.h" #include "common/StringMap.h" +#include "Body.h" namespace love { @@ -29,6 +30,40 @@ namespace physics namespace box2d { +void luax_pushjoint(lua_State *L, Joint *j) +{ + if (j == nullptr) + return lua_pushnil(L); + + switch (j->getType()) + { + case Joint::JOINT_DISTANCE: + return luax_pushtype(L, "DistanceJoint", PHYSICS_DISTANCE_JOINT_T, j); + case Joint::JOINT_REVOLUTE: + return luax_pushtype(L, "RevoluteJoint", PHYSICS_REVOLUTE_JOINT_T, j); + case Joint::JOINT_PRISMATIC: + return luax_pushtype(L, "PrismaticJoint", PHYSICS_PRISMATIC_JOINT_T, j); + case Joint::JOINT_MOUSE: + return luax_pushtype(L, "MouseJoint", PHYSICS_MOUSE_JOINT_T, j); + case Joint::JOINT_PULLEY: + return luax_pushtype(L, "PulleyJoint", PHYSICS_PULLEY_JOINT_T, j); + case Joint::JOINT_GEAR: + return luax_pushtype(L, "GearJoint", PHYSICS_GEAR_JOINT_T, j); + case Joint::JOINT_FRICTION: + return luax_pushtype(L, "FrictionJoint", PHYSICS_FRICTION_JOINT_T, j); + case Joint::JOINT_WELD: + return luax_pushtype(L, "WeldJoint", PHYSICS_WELD_JOINT_T, j); + case Joint::JOINT_WHEEL: + return luax_pushtype(L, "WheelJoint", PHYSICS_WHEEL_JOINT_T, j); + case Joint::JOINT_ROPE: + return luax_pushtype(L, "RopeJoint", PHYSICS_ROPE_JOINT_T, j); + case Joint::JOINT_MOTOR: + return luax_pushtype(L, "MotorJoint", PHYSICS_MOTOR_JOINT_T, j); + default: + return lua_pushnil(L); + } +} + Joint *luax_checkjoint(lua_State *L, int idx) { Joint *t = luax_checktype(L, idx, "Joint", PHYSICS_JOINT_T); @@ -46,6 +81,22 @@ int w_Joint_getType(lua_State *L) return 1; } +int w_Joint_getBodies(lua_State *L) +{ + Joint *t = luax_checkjoint(L, 1); + Body *b1 = nullptr; + Body *b2 = nullptr; + + luax_catchexcept(L, [&]() { + b1 = t->getBodyA(); + b2 = t->getBodyB(); + }); + + luax_pushtype(L, "Body", PHYSICS_BODY_T, b1); + luax_pushtype(L, "Body", PHYSICS_BODY_T, b2); + return 2; +} + int w_Joint_getAnchors(lua_State *L) { Joint *t = luax_checkjoint(L, 1); @@ -96,9 +147,17 @@ int w_Joint_destroy(lua_State *L) return 0; } +int w_Joint_isDestroyed(lua_State *L) +{ + Joint *t = luax_checktype(L, 1, "Joint", PHYSICS_JOINT_T); + luax_pushboolean(L, !t->isValid()); + return 1; +} + static const luaL_Reg functions[] = { { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -106,6 +165,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_Joint.h b/jni/love/src/modules/physics/box2d/wrap_Joint.h index 63d4537e..4bdb4444 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Joint.h +++ b/jni/love/src/modules/physics/box2d/wrap_Joint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -32,8 +32,10 @@ namespace physics namespace box2d { +void luax_pushjoint(lua_State *L, Joint *j); Joint *luax_checkjoint(lua_State *L, int idx); int w_Joint_getType(lua_State *L); +int w_Joint_getBodies(lua_State *L); int w_Joint_getAnchors(lua_State *L); int w_Joint_getReactionForce(lua_State *L); int w_Joint_getReactionTorque(lua_State *L); @@ -41,6 +43,7 @@ int w_Joint_getCollideConnected(lua_State *L); int w_Joint_setUserData(lua_State *L); int w_Joint_getUserData(lua_State *L); int w_Joint_destroy(lua_State *L); +int w_Joint_isDestroyed(lua_State *L); extern "C" int luaopen_joint(lua_State *L); } // box2d diff --git a/jni/love/src/modules/physics/box2d/wrap_MotorJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_MotorJoint.cpp index 17d1501a..e9ad2bc0 100644 --- a/jni/love/src/modules/physics/box2d/wrap_MotorJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_MotorJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -124,6 +124,7 @@ static const luaL_Reg functions[] = { "getCorrectionFactor", w_MotorJoint_getCorrectionFactor }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -131,6 +132,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_MotorJoint.h b/jni/love/src/modules/physics/box2d/wrap_MotorJoint.h index 59cd31fe..c99df557 100644 --- a/jni/love/src/modules/physics/box2d/wrap_MotorJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_MotorJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_MouseJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_MouseJoint.cpp index 38cf46b2..5caa42db 100644 --- a/jni/love/src/modules/physics/box2d/wrap_MouseJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_MouseJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -108,6 +108,7 @@ static const luaL_Reg functions[] = { "getDampingRatio", w_MouseJoint_getDampingRatio }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -115,6 +116,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_MouseJoint.h b/jni/love/src/modules/physics/box2d/wrap_MouseJoint.h index f0004980..ca010df0 100644 --- a/jni/love/src/modules/physics/box2d/wrap_MouseJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_MouseJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_Physics.cpp b/jni/love/src/modules/physics/box2d/wrap_Physics.cpp index e14ea807..31edec83 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Physics.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_Physics.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_Physics.h b/jni/love/src/modules/physics/box2d/wrap_Physics.h index 52a6bb97..8718131e 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Physics.h +++ b/jni/love/src/modules/physics/box2d/wrap_Physics.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_PolygonShape.cpp b/jni/love/src/modules/physics/box2d/wrap_PolygonShape.cpp index 2d371016..336703f3 100644 --- a/jni/love/src/modules/physics/box2d/wrap_PolygonShape.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_PolygonShape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_PolygonShape.h b/jni/love/src/modules/physics/box2d/wrap_PolygonShape.h index 45a0ef01..b3f1739f 100644 --- a/jni/love/src/modules/physics/box2d/wrap_PolygonShape.h +++ b/jni/love/src/modules/physics/box2d/wrap_PolygonShape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_PrismaticJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_PrismaticJoint.cpp index e820d38d..04f3c6e4 100644 --- a/jni/love/src/modules/physics/box2d/wrap_PrismaticJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_PrismaticJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -185,6 +185,7 @@ static const luaL_Reg functions[] = { "getLimits", w_PrismaticJoint_getLimits }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -192,6 +193,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_PrismaticJoint.h b/jni/love/src/modules/physics/box2d/wrap_PrismaticJoint.h index 8d9c90fd..2a24969c 100644 --- a/jni/love/src/modules/physics/box2d/wrap_PrismaticJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_PrismaticJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_PulleyJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_PulleyJoint.cpp index 25c41758..18a7bb88 100644 --- a/jni/love/src/modules/physics/box2d/wrap_PulleyJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_PulleyJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -71,6 +71,7 @@ static const luaL_Reg functions[] = { "getRatio", w_PulleyJoint_getRatio }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -78,6 +79,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_PulleyJoint.h b/jni/love/src/modules/physics/box2d/wrap_PulleyJoint.h index 47dbe4d1..cc997d7a 100644 --- a/jni/love/src/modules/physics/box2d/wrap_PulleyJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_PulleyJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_RevoluteJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_RevoluteJoint.cpp index 13d3468f..f61a991f 100644 --- a/jni/love/src/modules/physics/box2d/wrap_RevoluteJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_RevoluteJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -185,6 +185,7 @@ static const luaL_Reg functions[] = { "getLimits", w_RevoluteJoint_getLimits }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -192,6 +193,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_RevoluteJoint.h b/jni/love/src/modules/physics/box2d/wrap_RevoluteJoint.h index a6b97571..efbd26fe 100644 --- a/jni/love/src/modules/physics/box2d/wrap_RevoluteJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_RevoluteJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_RopeJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_RopeJoint.cpp index 45fecce2..76635873 100644 --- a/jni/love/src/modules/physics/box2d/wrap_RopeJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_RopeJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -47,6 +47,7 @@ static const luaL_Reg functions[] = { "getMaxLength", w_RopeJoint_getMaxLength }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -54,6 +55,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_RopeJoint.h b/jni/love/src/modules/physics/box2d/wrap_RopeJoint.h index bf6c093c..f77b6c4f 100644 --- a/jni/love/src/modules/physics/box2d/wrap_RopeJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_RopeJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_Shape.cpp b/jni/love/src/modules/physics/box2d/wrap_Shape.cpp index c4d7679b..da58bd13 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Shape.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_Shape.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_Shape.h b/jni/love/src/modules/physics/box2d/wrap_Shape.h index bc992f46..62cbc078 100644 --- a/jni/love/src/modules/physics/box2d/wrap_Shape.h +++ b/jni/love/src/modules/physics/box2d/wrap_Shape.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_WeldJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_WeldJoint.cpp index 0937c044..5c4a2a6d 100644 --- a/jni/love/src/modules/physics/box2d/wrap_WeldJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_WeldJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -73,6 +73,7 @@ static const luaL_Reg functions[] = { "getDampingRatio", w_WeldJoint_getDampingRatio }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -80,6 +81,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_WeldJoint.h b/jni/love/src/modules/physics/box2d/wrap_WeldJoint.h index 52fedab9..85588812 100644 --- a/jni/love/src/modules/physics/box2d/wrap_WeldJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_WeldJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_WheelJoint.cpp b/jni/love/src/modules/physics/box2d/wrap_WheelJoint.cpp index 31b1c5b8..8ccea3a1 100644 --- a/jni/love/src/modules/physics/box2d/wrap_WheelJoint.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_WheelJoint.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -149,6 +149,7 @@ static const luaL_Reg functions[] = { "getSpringDampingRatio", w_WheelJoint_getSpringDampingRatio }, // From Joint. { "getType", w_Joint_getType }, + { "getBodies", w_Joint_getBodies }, { "getAnchors", w_Joint_getAnchors }, { "getReactionForce", w_Joint_getReactionForce }, { "getReactionTorque", w_Joint_getReactionTorque }, @@ -156,6 +157,7 @@ static const luaL_Reg functions[] = { "setUserData", w_Joint_setUserData }, { "getUserData", w_Joint_getUserData }, { "destroy", w_Joint_destroy }, + { "isDestroyed", w_Joint_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_WheelJoint.h b/jni/love/src/modules/physics/box2d/wrap_WheelJoint.h index 0cd8c68f..4a3fe60c 100644 --- a/jni/love/src/modules/physics/box2d/wrap_WheelJoint.h +++ b/jni/love/src/modules/physics/box2d/wrap_WheelJoint.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/physics/box2d/wrap_World.cpp b/jni/love/src/modules/physics/box2d/wrap_World.cpp index 775f6ecf..7b433425 100644 --- a/jni/love/src/modules/physics/box2d/wrap_World.cpp +++ b/jni/love/src/modules/physics/box2d/wrap_World.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -189,6 +189,13 @@ int w_World_destroy(lua_State *L) return 0; } +int w_World_isDestroyed(lua_State *L) +{ + World *w = luax_checktype(L, 1, "World", PHYSICS_WORLD_T); + luax_pushboolean(L, !w->isValid()); + return 1; +} + static const luaL_Reg functions[] = { @@ -212,6 +219,7 @@ static const luaL_Reg functions[] = { "queryBoundingBox", w_World_queryBoundingBox }, { "rayCast", w_World_rayCast }, { "destroy", w_World_destroy }, + { "isDestroyed", w_World_isDestroyed }, { 0, 0 } }; diff --git a/jni/love/src/modules/physics/box2d/wrap_World.h b/jni/love/src/modules/physics/box2d/wrap_World.h index 1a5d15c2..c09dff7a 100644 --- a/jni/love/src/modules/physics/box2d/wrap_World.h +++ b/jni/love/src/modules/physics/box2d/wrap_World.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -55,6 +55,7 @@ int w_World_getContactList(lua_State *L); int w_World_queryBoundingBox(lua_State *L); int w_World_rayCast(lua_State *L); int w_World_destroy(lua_State *L); +int w_World_isDestroyed(lua_State *L); extern "C" int luaopen_world(lua_State *L); } // box2d diff --git a/jni/love/src/modules/sound/Decoder.h b/jni/love/src/modules/sound/Decoder.h index 50c522c1..0c5de315 100644 --- a/jni/love/src/modules/sound/Decoder.h +++ b/jni/love/src/modules/sound/Decoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -40,7 +40,7 @@ public: * Indicates how many bytes of raw data should be generated at each * call to Decode. **/ - static const int DEFAULT_BUFFER_SIZE = 2048; + static const int DEFAULT_BUFFER_SIZE = 16384; /** * Indicates the quality of the sound. diff --git a/jni/love/src/modules/sound/Sound.cpp b/jni/love/src/modules/sound/Sound.cpp index afe4199d..3e61dd90 100644 --- a/jni/love/src/modules/sound/Sound.cpp +++ b/jni/love/src/modules/sound/Sound.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/Sound.h b/jni/love/src/modules/sound/Sound.h index b6b093f1..baa85a76 100644 --- a/jni/love/src/modules/sound/Sound.h +++ b/jni/love/src/modules/sound/Sound.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/SoundData.cpp b/jni/love/src/modules/sound/SoundData.cpp index 81b5f5f5..91aedb79 100644 --- a/jni/love/src/modules/sound/SoundData.cpp +++ b/jni/love/src/modules/sound/SoundData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/SoundData.h b/jni/love/src/modules/sound/SoundData.h index 1a06e696..21c770aa 100644 --- a/jni/love/src/modules/sound/SoundData.h +++ b/jni/love/src/modules/sound/SoundData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/Decoder.cpp b/jni/love/src/modules/sound/lullaby/Decoder.cpp index 62fc4578..fcbe4de5 100644 --- a/jni/love/src/modules/sound/lullaby/Decoder.cpp +++ b/jni/love/src/modules/sound/lullaby/Decoder.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/Decoder.h b/jni/love/src/modules/sound/lullaby/Decoder.h index ae957150..70a34303 100644 --- a/jni/love/src/modules/sound/lullaby/Decoder.h +++ b/jni/love/src/modules/sound/lullaby/Decoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/FLACDecoder.cpp b/jni/love/src/modules/sound/lullaby/FLACDecoder.cpp index aa6bcd8b..6504c9b4 100644 --- a/jni/love/src/modules/sound/lullaby/FLACDecoder.cpp +++ b/jni/love/src/modules/sound/lullaby/FLACDecoder.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/FLACDecoder.h b/jni/love/src/modules/sound/lullaby/FLACDecoder.h index 61ed5405..eaf61b60 100644 --- a/jni/love/src/modules/sound/lullaby/FLACDecoder.h +++ b/jni/love/src/modules/sound/lullaby/FLACDecoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/GmeDecoder.cpp b/jni/love/src/modules/sound/lullaby/GmeDecoder.cpp index a3131570..d7bd8b2d 100644 --- a/jni/love/src/modules/sound/lullaby/GmeDecoder.cpp +++ b/jni/love/src/modules/sound/lullaby/GmeDecoder.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/GmeDecoder.h b/jni/love/src/modules/sound/lullaby/GmeDecoder.h index d5c94941..422d0f31 100644 --- a/jni/love/src/modules/sound/lullaby/GmeDecoder.h +++ b/jni/love/src/modules/sound/lullaby/GmeDecoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/ModPlugDecoder.cpp b/jni/love/src/modules/sound/lullaby/ModPlugDecoder.cpp index ce62b4ac..1ccf74c7 100644 --- a/jni/love/src/modules/sound/lullaby/ModPlugDecoder.cpp +++ b/jni/love/src/modules/sound/lullaby/ModPlugDecoder.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/ModPlugDecoder.h b/jni/love/src/modules/sound/lullaby/ModPlugDecoder.h index 178dc2e5..9535737b 100644 --- a/jni/love/src/modules/sound/lullaby/ModPlugDecoder.h +++ b/jni/love/src/modules/sound/lullaby/ModPlugDecoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/Mpg123Decoder.cpp b/jni/love/src/modules/sound/lullaby/Mpg123Decoder.cpp index 1f4a58f0..a0913efc 100644 --- a/jni/love/src/modules/sound/lullaby/Mpg123Decoder.cpp +++ b/jni/love/src/modules/sound/lullaby/Mpg123Decoder.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/Mpg123Decoder.h b/jni/love/src/modules/sound/lullaby/Mpg123Decoder.h index 049380fd..d5d0f77d 100644 --- a/jni/love/src/modules/sound/lullaby/Mpg123Decoder.h +++ b/jni/love/src/modules/sound/lullaby/Mpg123Decoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/Sound.cpp b/jni/love/src/modules/sound/lullaby/Sound.cpp index 99360200..54a0a61f 100644 --- a/jni/love/src/modules/sound/lullaby/Sound.cpp +++ b/jni/love/src/modules/sound/lullaby/Sound.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/Sound.h b/jni/love/src/modules/sound/lullaby/Sound.h index 15e38a45..329a586f 100644 --- a/jni/love/src/modules/sound/lullaby/Sound.h +++ b/jni/love/src/modules/sound/lullaby/Sound.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/VorbisDecoder.cpp b/jni/love/src/modules/sound/lullaby/VorbisDecoder.cpp index 05251920..20f32c3c 100644 --- a/jni/love/src/modules/sound/lullaby/VorbisDecoder.cpp +++ b/jni/love/src/modules/sound/lullaby/VorbisDecoder.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/VorbisDecoder.h b/jni/love/src/modules/sound/lullaby/VorbisDecoder.h index d5297992..ea6f2697 100644 --- a/jni/love/src/modules/sound/lullaby/VorbisDecoder.h +++ b/jni/love/src/modules/sound/lullaby/VorbisDecoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/WaveDecoder.cpp b/jni/love/src/modules/sound/lullaby/WaveDecoder.cpp index 5dce78e9..b04ec12b 100644 --- a/jni/love/src/modules/sound/lullaby/WaveDecoder.cpp +++ b/jni/love/src/modules/sound/lullaby/WaveDecoder.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/lullaby/WaveDecoder.h b/jni/love/src/modules/sound/lullaby/WaveDecoder.h index d94157f3..1f0d9d56 100644 --- a/jni/love/src/modules/sound/lullaby/WaveDecoder.h +++ b/jni/love/src/modules/sound/lullaby/WaveDecoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/wrap_Decoder.cpp b/jni/love/src/modules/sound/wrap_Decoder.cpp index 63f61d6e..616afb0f 100644 --- a/jni/love/src/modules/sound/wrap_Decoder.cpp +++ b/jni/love/src/modules/sound/wrap_Decoder.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/wrap_Decoder.h b/jni/love/src/modules/sound/wrap_Decoder.h index 1c1cd4c7..7ae77e2b 100644 --- a/jni/love/src/modules/sound/wrap_Decoder.h +++ b/jni/love/src/modules/sound/wrap_Decoder.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/wrap_Sound.cpp b/jni/love/src/modules/sound/wrap_Sound.cpp index d1efeb1e..08d8549e 100644 --- a/jni/love/src/modules/sound/wrap_Sound.cpp +++ b/jni/love/src/modules/sound/wrap_Sound.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/wrap_Sound.h b/jni/love/src/modules/sound/wrap_Sound.h index 2c4edb35..39efb500 100644 --- a/jni/love/src/modules/sound/wrap_Sound.h +++ b/jni/love/src/modules/sound/wrap_Sound.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/wrap_SoundData.cpp b/jni/love/src/modules/sound/wrap_SoundData.cpp index dee6db00..951ab58c 100644 --- a/jni/love/src/modules/sound/wrap_SoundData.cpp +++ b/jni/love/src/modules/sound/wrap_SoundData.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/sound/wrap_SoundData.h b/jni/love/src/modules/sound/wrap_SoundData.h index 8fdf30e0..c22ac0b3 100644 --- a/jni/love/src/modules/sound/wrap_SoundData.h +++ b/jni/love/src/modules/sound/wrap_SoundData.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/system/System.cpp b/jni/love/src/modules/system/System.cpp index 9459eacd..c43b9db7 100755 --- a/jni/love/src/modules/system/System.cpp +++ b/jni/love/src/modules/system/System.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/system/System.h b/jni/love/src/modules/system/System.h index b4236dec..92ed8725 100644 --- a/jni/love/src/modules/system/System.h +++ b/jni/love/src/modules/system/System.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/system/sdl/System.cpp b/jni/love/src/modules/system/sdl/System.cpp index 639d7821..9b0562e8 100644 --- a/jni/love/src/modules/system/sdl/System.cpp +++ b/jni/love/src/modules/system/sdl/System.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/system/sdl/System.h b/jni/love/src/modules/system/sdl/System.h index 78e87a36..cd35cea5 100644 --- a/jni/love/src/modules/system/sdl/System.h +++ b/jni/love/src/modules/system/sdl/System.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/system/wrap_System.cpp b/jni/love/src/modules/system/wrap_System.cpp index 0f004162..1a937b46 100644 --- a/jni/love/src/modules/system/wrap_System.cpp +++ b/jni/love/src/modules/system/wrap_System.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/system/wrap_System.h b/jni/love/src/modules/system/wrap_System.h index 3ae73e0b..2fe6438f 100644 --- a/jni/love/src/modules/system/wrap_System.h +++ b/jni/love/src/modules/system/wrap_System.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/Channel.cpp b/jni/love/src/modules/thread/Channel.cpp index 1e8532b3..18fd5f19 100644 --- a/jni/love/src/modules/thread/Channel.cpp +++ b/jni/love/src/modules/thread/Channel.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/Channel.h b/jni/love/src/modules/thread/Channel.h index 3e9781d1..f1174e01 100644 --- a/jni/love/src/modules/thread/Channel.h +++ b/jni/love/src/modules/thread/Channel.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/LuaThread.cpp b/jni/love/src/modules/thread/LuaThread.cpp index f4771a1a..95507241 100644 --- a/jni/love/src/modules/thread/LuaThread.cpp +++ b/jni/love/src/modules/thread/LuaThread.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/LuaThread.h b/jni/love/src/modules/thread/LuaThread.h index 122c2cc1..375f9c5c 100644 --- a/jni/love/src/modules/thread/LuaThread.h +++ b/jni/love/src/modules/thread/LuaThread.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/Thread.h b/jni/love/src/modules/thread/Thread.h index 7adaeda9..37cf3790 100644 --- a/jni/love/src/modules/thread/Thread.h +++ b/jni/love/src/modules/thread/Thread.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/ThreadModule.cpp b/jni/love/src/modules/thread/ThreadModule.cpp index 6e433bcb..aec250da 100644 --- a/jni/love/src/modules/thread/ThreadModule.cpp +++ b/jni/love/src/modules/thread/ThreadModule.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/ThreadModule.h b/jni/love/src/modules/thread/ThreadModule.h index 9fe0bcaa..91f56dd8 100644 --- a/jni/love/src/modules/thread/ThreadModule.h +++ b/jni/love/src/modules/thread/ThreadModule.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/sdl/Thread.cpp b/jni/love/src/modules/thread/sdl/Thread.cpp index c6a6dc61..e7fdf8b7 100644 --- a/jni/love/src/modules/thread/sdl/Thread.cpp +++ b/jni/love/src/modules/thread/sdl/Thread.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/sdl/Thread.h b/jni/love/src/modules/thread/sdl/Thread.h index ea1f48de..caf09d83 100644 --- a/jni/love/src/modules/thread/sdl/Thread.h +++ b/jni/love/src/modules/thread/sdl/Thread.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/sdl/threads.cpp b/jni/love/src/modules/thread/sdl/threads.cpp index f40cc265..64ffd3cd 100644 --- a/jni/love/src/modules/thread/sdl/threads.cpp +++ b/jni/love/src/modules/thread/sdl/threads.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/sdl/threads.h b/jni/love/src/modules/thread/sdl/threads.h index 9916784d..d2459f97 100644 --- a/jni/love/src/modules/thread/sdl/threads.h +++ b/jni/love/src/modules/thread/sdl/threads.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/threads.cpp b/jni/love/src/modules/thread/threads.cpp index 9abeb589..86bd1fcf 100644 --- a/jni/love/src/modules/thread/threads.cpp +++ b/jni/love/src/modules/thread/threads.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/threads.h b/jni/love/src/modules/thread/threads.h index 516abae9..87f434d5 100644 --- a/jni/love/src/modules/thread/threads.h +++ b/jni/love/src/modules/thread/threads.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/wrap_Channel.h b/jni/love/src/modules/thread/wrap_Channel.h index 14473ea6..9df12351 100644 --- a/jni/love/src/modules/thread/wrap_Channel.h +++ b/jni/love/src/modules/thread/wrap_Channel.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/wrap_LuaThread.h b/jni/love/src/modules/thread/wrap_LuaThread.h index 6be1be72..09474c54 100644 --- a/jni/love/src/modules/thread/wrap_LuaThread.h +++ b/jni/love/src/modules/thread/wrap_LuaThread.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/thread/wrap_ThreadModule.cpp b/jni/love/src/modules/thread/wrap_ThreadModule.cpp index 769867b4..d0123d65 100644 --- a/jni/love/src/modules/thread/wrap_ThreadModule.cpp +++ b/jni/love/src/modules/thread/wrap_ThreadModule.cpp @@ -27,6 +27,9 @@ #include "filesystem/File.h" #include "filesystem/FileData.h" +// C +#include + namespace love { namespace thread @@ -37,9 +40,28 @@ namespace thread int w_newThread(lua_State *L) { std::string name = "Thread code"; - love::Data *data = 0; + love::Data *data = nullptr; - if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_T)) + if (lua_isstring(L, 1)) + { + size_t slen = 0; + const char *str = lua_tolstring(L, 1, &slen); + + // Treat the string as Lua code if it's long or has a newline. + if (slen >= 1024 || memchr(str, '\n', slen)) + { + // Construct a FileData from the string. + lua_pushvalue(L, 1); + lua_pushstring(L, "string"); + int idxs[] = {lua_gettop(L) - 1, lua_gettop(L)}; + luax_convobj(L, idxs, 2, "filesystem", "newFileData"); + lua_pop(L, 1); + lua_replace(L, 1); + } + else + luax_convobj(L, 1, "filesystem", "newFileData"); + } + else if (luax_istype(L, 1, FILESYSTEM_FILE_T)) luax_convobj(L, 1, "filesystem", "newFileData"); if (luax_istype(L, 1, FILESYSTEM_FILE_DATA_T)) diff --git a/jni/love/src/modules/thread/wrap_ThreadModule.h b/jni/love/src/modules/thread/wrap_ThreadModule.h index 750b9fca..f2298ba8 100644 --- a/jni/love/src/modules/thread/wrap_ThreadModule.h +++ b/jni/love/src/modules/thread/wrap_ThreadModule.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/timer/Timer.h b/jni/love/src/modules/timer/Timer.h index 9290f7ba..85322060 100644 --- a/jni/love/src/modules/timer/Timer.h +++ b/jni/love/src/modules/timer/Timer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/timer/sdl/Timer.cpp b/jni/love/src/modules/timer/sdl/Timer.cpp index 1a25983e..d710cb16 100644 --- a/jni/love/src/modules/timer/sdl/Timer.cpp +++ b/jni/love/src/modules/timer/sdl/Timer.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/timer/sdl/Timer.h b/jni/love/src/modules/timer/sdl/Timer.h index 3805899a..e4b13fef 100644 --- a/jni/love/src/modules/timer/sdl/Timer.h +++ b/jni/love/src/modules/timer/sdl/Timer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/timer/wrap_Timer.cpp b/jni/love/src/modules/timer/wrap_Timer.cpp index c34c82d5..4fdb06f0 100644 --- a/jni/love/src/modules/timer/wrap_Timer.cpp +++ b/jni/love/src/modules/timer/wrap_Timer.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/timer/wrap_Timer.h b/jni/love/src/modules/timer/wrap_Timer.h index 698d3864..a3ef0164 100644 --- a/jni/love/src/modules/timer/wrap_Timer.h +++ b/jni/love/src/modules/timer/wrap_Timer.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/touch/Touch.h b/jni/love/src/modules/touch/Touch.h index dcbdf073..448018d1 100644 --- a/jni/love/src/modules/touch/Touch.h +++ b/jni/love/src/modules/touch/Touch.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/touch/sdl/Touch.cpp b/jni/love/src/modules/touch/sdl/Touch.cpp index 4dda8d34..8c54f19e 100644 --- a/jni/love/src/modules/touch/sdl/Touch.cpp +++ b/jni/love/src/modules/touch/sdl/Touch.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/touch/sdl/Touch.h b/jni/love/src/modules/touch/sdl/Touch.h index ec730458..db5a2f83 100644 --- a/jni/love/src/modules/touch/sdl/Touch.h +++ b/jni/love/src/modules/touch/sdl/Touch.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/touch/wrap_Touch.cpp b/jni/love/src/modules/touch/wrap_Touch.cpp index e1d8e8ba..4943311f 100644 --- a/jni/love/src/modules/touch/wrap_Touch.cpp +++ b/jni/love/src/modules/touch/wrap_Touch.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/touch/wrap_Touch.h b/jni/love/src/modules/touch/wrap_Touch.h index d01674f8..89d376c5 100644 --- a/jni/love/src/modules/touch/wrap_Touch.h +++ b/jni/love/src/modules/touch/wrap_Touch.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/modules/window/Window.cpp b/jni/love/src/modules/window/Window.cpp index 5ad2480e..476bddc0 100644 --- a/jni/love/src/modules/window/Window.cpp +++ b/jni/love/src/modules/window/Window.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -52,6 +52,9 @@ WindowSettings::WindowSettings() , highdpi(false) , sRGB(false) , refreshrate(0.0) + , useposition(false) + , x(0) + , y(0) { } @@ -101,6 +104,8 @@ StringMap::Entry Window::settingEntri {"highdpi", SETTING_HIGHDPI}, {"srgb", SETTING_SRGB}, {"refreshrate", SETTING_REFRESHRATE}, + {"x", SETTING_X}, + {"y", SETTING_Y}, }; StringMap Window::settings(Window::settingEntries, sizeof(Window::settingEntries)); diff --git a/jni/love/src/modules/window/Window.h b/jni/love/src/modules/window/Window.h index 05d73533..9520589c 100644 --- a/jni/love/src/modules/window/Window.h +++ b/jni/love/src/modules/window/Window.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -60,6 +60,8 @@ public: SETTING_HIGHDPI, SETTING_SRGB, SETTING_REFRESHRATE, + SETTING_X, + SETTING_Y, SETTING_MAX_ENUM }; @@ -82,6 +84,11 @@ public: { int width; int height; + + bool operator == (const WindowSize &w) const + { + return w.width == width && w.height == height; + } }; struct MessageBoxData @@ -122,6 +129,9 @@ public: virtual void getDesktopDimensions(int displayindex, int &width, int &height) const = 0; + virtual void setPosition(int x, int y, int displayindex) = 0; + virtual void getPosition(int &x, int &y, int &displayindex) = 0; + virtual bool isCreated() const = 0; virtual void setWindowTitle(const std::string &title) = 0; @@ -131,6 +141,7 @@ public: virtual love::image::ImageData *getIcon() = 0; virtual void minimize() = 0; + virtual void maximize() = 0; // default no-op implementation virtual void swapBuffers(); @@ -150,9 +161,14 @@ public: virtual bool isTouchScreen(int displayindex) const = 0; + virtual double toPixels(double x) const = 0; + virtual void toPixels(double wx, double wy, double &px, double &py) const = 0; + virtual double fromPixels(double x) const = 0; + virtual void fromPixels(double px, double py, double &wx, double &wy) const = 0; + virtual const void *getHandle() const = 0; - virtual bool showMessageBox(MessageBoxType type, const std::string &title, const std::string &message, bool attachtowindow) = 0; + virtual bool showMessageBox(const std::string &title, const std::string &message, MessageBoxType type, bool attachtowindow) = 0; virtual int showMessageBox(const MessageBoxData &data) = 0; //virtual static Window *createSingleton() = 0; @@ -202,6 +218,9 @@ struct WindowSettings bool highdpi; // false bool sRGB; // false double refreshrate; // 0.0 + bool useposition; // false + int x; // 0 + int y; // 0 }; // WindowSettings diff --git a/jni/love/src/modules/window/sdl/Window.cpp b/jni/love/src/modules/window/sdl/Window.cpp index 5e607992..0f40b1c3 100644 --- a/jni/love/src/modules/window/sdl/Window.cpp +++ b/jni/love/src/modules/window/sdl/Window.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -131,6 +131,25 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) sdlflags |= SDL_WINDOW_ALLOW_HIGHDPI; #endif + int x = f.x; + int y = f.y; + + if (f.useposition && !f.fullscreen) + { + // The position needs to be in the global coordinate space. + SDL_Rect displaybounds = {}; + SDL_GetDisplayBounds(f.display, &displaybounds); + x += displaybounds.x; + y += displaybounds.y; + } + else + { + if (f.centered) + x = y = SDL_WINDOWPOS_CENTERED_DISPLAY(f.display); + else + x = y = SDL_WINDOWPOS_UNDEFINED_DISPLAY(f.display); + } + graphics::Graphics *gfx = Module::getInstance(Module::M_GRAPHICS); if (gfx != nullptr) gfx->unSetMode(); @@ -163,9 +182,6 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) } } - int centeredpos = SDL_WINDOWPOS_CENTERED_DISPLAY(f.display); - int uncenteredpos = SDL_WINDOWPOS_UNDEFINED_DISPLAY(f.display); - if (!window) { created = false; @@ -174,9 +190,8 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) setWindowGLAttributes(f.msaa, f.sRGB); const char *title = windowTitle.c_str(); - int pos = f.centered ? centeredpos : uncenteredpos; - window = SDL_CreateWindow(title, pos, pos, width, height, sdlflags); + window = SDL_CreateWindow(title, x, y, width, height, sdlflags); if (!window && f.msaa > 0) { @@ -184,7 +199,7 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES, 0); SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS, 0); - window = SDL_CreateWindow(title, pos, pos, width, height, sdlflags); + window = SDL_CreateWindow(title, x, y, width, height, sdlflags); f.msaa = 0; } @@ -195,15 +210,15 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) if (!window) { - showMessageBox(MESSAGEBOX_ERROR, "Could not create window", SDL_GetError(), false); + showMessageBox("Could not create window", SDL_GetError(), MESSAGEBOX_ERROR, false); return false; } // Enforce minimum window dimensions. SDL_SetWindowMinimumSize(window, f.minwidth, f.minheight); - if (f.centered && !f.fullscreen) - SDL_SetWindowPosition(window, centeredpos, centeredpos); + if ((f.useposition || f.centered) && !f.fullscreen) + SDL_SetWindowPosition(window, x, y); SDL_RaiseWindow(window); @@ -228,7 +243,7 @@ bool Window::setWindow(int width, int height, WindowSettings *settings) #endif if (!gfx->setMode(width, height, curMode.settings.sRGB)) - showMessageBox(MESSAGEBOX_ERROR, "Could not set graphics mode", "Unsupported OpenGL version?", true); + showMessageBox("Could not set graphics mode", "Unsupported OpenGL version?", MESSAGEBOX_ERROR, true); } // Make sure the mouse keeps its previous grab setting. @@ -289,7 +304,7 @@ bool Window::setContext(int msaa, bool vsync, bool sRGB) if (!context) { - showMessageBox(MESSAGEBOX_ERROR, "Could not create OpenGL context", SDL_GetError(), true); + showMessageBox("Could not create OpenGL context", SDL_GetError(), MESSAGEBOX_ERROR, true); return false; } @@ -424,7 +439,8 @@ void Window::updateSettings(const WindowSettings &newsettings) curMode.settings.resizable = (wflags & SDL_WINDOW_RESIZABLE) != 0; curMode.settings.borderless = (wflags & SDL_WINDOW_BORDERLESS) != 0; curMode.settings.centered = newsettings.centered; - curMode.settings.display = std::max(SDL_GetWindowDisplayIndex(window), 0); + + getPosition(curMode.settings.x, curMode.settings.y, curMode.settings.display); #if SDL_VERSION_ATLEAST(2,0,1) curMode.settings.highdpi = (wflags & SDL_WINDOW_ALLOW_HIGHDPI) != 0; @@ -539,29 +555,17 @@ std::vector Window::getFullscreenSizes(int displayindex) const { std::vector sizes; - SDL_DisplayMode mode = {}; - std::vector::const_iterator it; for (int i = 0; i < SDL_GetNumDisplayModes(displayindex); i++) { + SDL_DisplayMode mode = {}; SDL_GetDisplayMode(displayindex, i, &mode); + WindowSize w = {mode.w, mode.h}; + // SDL2's display mode list has multiple entries for modes of the same // size with different bits per pixel, so we need to filter those out. - bool alreadyhassize = false; - for (it = sizes.begin(); it != sizes.end(); ++it) - { - if (it->width == mode.w && it->height == mode.h) - { - alreadyhassize = true; - break; - } - } - - if (!alreadyhassize) - { - WindowSize w = {mode.w, mode.h}; + if (std::find(sizes.begin(), sizes.end(), w) == sizes.end()) sizes.push_back(w); - } } return sizes; @@ -593,6 +597,50 @@ void Window::getDesktopDimensions(int displayindex, int &width, int &height) con } } +void Window::setPosition(int x, int y, int displayindex) +{ + if (!window) + return; + + displayindex = std::min(std::max(displayindex, 0), getDisplayCount() - 1); + + SDL_Rect displaybounds = {}; + SDL_GetDisplayBounds(displayindex, &displaybounds); + + // The position needs to be in the global coordinate space. + x += displaybounds.x; + y += displaybounds.y; + + SDL_SetWindowPosition(window, x, y); + + curMode.settings.useposition = true; +} + +void Window::getPosition(int &x, int &y, int &displayindex) +{ + if (!window) + { + x = y = 0; + displayindex = 0; + return; + } + + displayindex = std::max(SDL_GetWindowDisplayIndex(window), 0); + + SDL_GetWindowPosition(window, &x, &y); + + // SDL always reports 0, 0 for fullscreen windows. + if (!(SDL_GetWindowFlags(window) & SDL_WINDOW_FULLSCREEN)) + { + SDL_Rect displaybounds = {}; + SDL_GetDisplayBounds(displayindex, &displaybounds); + + // The position needs to be in the monitor's coordinate space. + x -= displaybounds.x; + y -= displaybounds.y; + } +} + bool Window::isCreated() const { return created; @@ -666,6 +714,12 @@ void Window::minimize() SDL_MinimizeWindow(window); } +void Window::maximize() +{ + if (window != nullptr) + SDL_MaximizeWindow(window); +} + void Window::swapBuffers() { SDL_GL_SwapWindow(window); @@ -746,6 +800,30 @@ bool Window::isTouchScreen(int displayindex) const #endif } +double Window::toPixels(double x) const +{ + return x * getPixelScale(); +} + +void Window::toPixels(double wx, double wy, double &px, double &py) const +{ + double scale = getPixelScale(); + px = wx * scale; + py = wy * scale; +} + +double Window::fromPixels(double x) const +{ + return x / getPixelScale(); +} + +void Window::fromPixels(double px, double py, double &wx, double &wy) const +{ + double scale = getPixelScale(); + wx = px / scale; + wy = py / scale; +} + const void *Window::getHandle() const { return window; @@ -765,7 +843,7 @@ SDL_MessageBoxFlags Window::convertMessageBoxType(MessageBoxType type) const } } -bool Window::showMessageBox(MessageBoxType type, const std::string &title, const std::string &message, bool attachtowindow) +bool Window::showMessageBox(const std::string &title, const std::string &message, MessageBoxType type, bool attachtowindow) { SDL_MessageBoxFlags flags = convertMessageBoxType(type); SDL_Window *sdlwindow = attachtowindow ? window : nullptr; diff --git a/jni/love/src/modules/window/sdl/Window.h b/jni/love/src/modules/window/sdl/Window.h index 39fd4aca..ef090c23 100644 --- a/jni/love/src/modules/window/sdl/Window.h +++ b/jni/love/src/modules/window/sdl/Window.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -60,6 +60,9 @@ public: void getDesktopDimensions(int displayindex, int &width, int &height) const; + void setPosition(int x, int y, int displayindex); + void getPosition(int &x, int &y, int &displayindex); + bool isCreated() const; void setWindowTitle(const std::string &title); @@ -69,6 +72,7 @@ public: love::image::ImageData *getIcon(); void minimize(); + void maximize(); void swapBuffers(); @@ -87,9 +91,14 @@ public: bool isTouchScreen(int displayindex) const; + double toPixels(double x) const; + void toPixels(double wx, double wy, double &px, double &py) const; + double fromPixels(double x) const; + void fromPixels(double px, double py, double &wx, double &wy) const; + const void *getHandle() const; - bool showMessageBox(MessageBoxType type, const std::string &title, const std::string &message, bool attachtowindow); + bool showMessageBox(const std::string &title, const std::string &message, MessageBoxType type, bool attachtowindow); int showMessageBox(const MessageBoxData &data); static love::window::Window *createSingleton(); diff --git a/jni/love/src/modules/window/wrap_Window.cpp b/jni/love/src/modules/window/wrap_Window.cpp index 2ec8cb6e..bfb61635 100644 --- a/jni/love/src/modules/window/wrap_Window.cpp +++ b/jni/love/src/modules/window/wrap_Window.cpp @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -109,6 +109,16 @@ int w_setMode(lua_State *L) settings.highdpi = luax_boolflag(L, 3, settingName(Window::SETTING_HIGHDPI), false); settings.sRGB = luax_boolflag(L, 3, settingName(Window::SETTING_SRGB), false); + lua_getfield(L, 3, settingName(Window::SETTING_X)); + lua_getfield(L, 3, settingName(Window::SETTING_Y)); + settings.useposition = !(lua_isnoneornil(L, -2) && lua_isnoneornil(L, -1)); + if (settings.useposition) + { + settings.x = luaL_optint(L, -2, 0); + settings.y = luaL_optint(L, -1, 0); + } + lua_pop(L, 2); + // We don't explicitly set the refresh rate, it's "read-only". // For backward-compatibility. TODO: remove! @@ -178,6 +188,12 @@ int w_getMode(lua_State *L) lua_pushnumber(L, settings.refreshrate); lua_setfield(L, -2, settingName(Window::SETTING_REFRESHRATE)); + lua_pushinteger(L, settings.x); + lua_setfield(L, -2, settingName(Window::SETTING_X)); + + lua_pushinteger(L, settings.y); + lua_setfield(L, -2, settingName(Window::SETTING_Y)); + return 3; } @@ -279,6 +295,27 @@ int w_getDesktopDimensions(lua_State *L) return 2; } +int w_setPosition(lua_State *L) +{ + int x = luaL_checkint(L, 1); + int y = luaL_checkint(L, 2); + int displayindex = luaL_optint(L, 3, 1) - 1; + instance()->setPosition(x, y, displayindex); + return 0; +} + +int w_getPosition(lua_State *L) +{ + int x = 0; + int y = 0; + int displayindex = 0; + instance()->getPosition(x, y, displayindex); + lua_pushinteger(L, x); + lua_pushinteger(L, y); + lua_pushinteger(L, displayindex + 1); + return 3; +} + int w_setIcon(lua_State *L) { image::ImageData *i = luax_checktype(L, 1, "ImageData", IMAGE_IMAGE_DATA_T); @@ -340,41 +377,86 @@ int w_isTouchScreen(lua_State *L) return 1; } +int w_toPixels(lua_State *L) +{ + double wx = luaL_checknumber(L, 1); + + if (lua_isnoneornil(L, 2)) + { + lua_pushnumber(L, instance()->toPixels(wx)); + return 1; + } + + double wy = luaL_checknumber(L, 2); + double px = 0.0, py = 0.0; + + instance()->toPixels(wx, wy, px, py); + + lua_pushnumber(L, px); + lua_pushnumber(L, py); + + return 2; +} + +int w_fromPixels(lua_State *L) +{ + double px = luaL_checknumber(L, 1); + + if (lua_isnoneornil(L, 2)) + { + lua_pushnumber(L, instance()->fromPixels(px)); + return 1; + } + + double py = luaL_checknumber(L, 2); + double wx = 0.0, wy = 0.0; + + instance()->fromPixels(px, py, wx, wy); + + lua_pushnumber(L, wx); + lua_pushnumber(L, wy); + + return 2; +} + int w_minimize(lua_State* /*L*/) { instance()->minimize(); return 0; } +int w_maximize(lua_State *) +{ + instance()->maximize(); + return 0; +} + int w_showMessageBox(lua_State *L) { Window::MessageBoxData data = {}; + data.type = Window::MESSAGEBOX_INFO; - const char *typestr = luaL_checkstring(L, 1); - if (!Window::getConstant(typestr, data.type)) - return luaL_error(L, "Invalid messagebox type: %s", typestr); - - data.title = luaL_checkstring(L, 2); - data.message = luaL_checkstring(L, 3); + data.title = luaL_checkstring(L, 1); + data.message = luaL_checkstring(L, 2); // If we have a table argument, we assume a list of button names, which // means we should use the more complex message box API. - if (lua_istable(L, 4)) + if (lua_istable(L, 3)) { - size_t numbuttons = lua_objlen(L, 4); + size_t numbuttons = lua_objlen(L, 3); if (numbuttons == 0) return luaL_error(L, "Must have at least one messagebox button."); // Array of button names. for (size_t i = 0; i < numbuttons; i++) { - lua_rawgeti(L, 4, i + 1); + lua_rawgeti(L, 3, i + 1); data.buttons.push_back(luax_checkstring(L, -1)); lua_pop(L, 1); } // Optional table entry specifying the button to use when enter is pressed. - lua_getfield(L, 4, "enterbutton"); + lua_getfield(L, 3, "enterbutton"); if (!lua_isnoneornil(L, -1)) data.enterButtonIndex = luaL_checkint(L, -1) - 1; else @@ -382,13 +464,17 @@ int w_showMessageBox(lua_State *L) lua_pop(L, 1); // Optional table entry specifying the button to use when esc is pressed. - lua_getfield(L, 4, "escapebutton"); + lua_getfield(L, 3, "escapebutton"); if (!lua_isnoneornil(L, -1)) data.escapeButtonIndex = luaL_checkint(L, -1) - 1; else data.escapeButtonIndex = (int) data.buttons.size() - 1; lua_pop(L, 1); + const char *typestr = lua_isnoneornil(L, 4) ? nullptr : luaL_checkstring(L, 4); + if (typestr && !Window::getConstant(typestr, data.type)) + return luaL_error(L, "Invalid messagebox type: %s", typestr); + data.attachToWindow = luax_optboolean(L, 5, true); int pressedbutton = instance()->showMessageBox(data); @@ -396,10 +482,14 @@ int w_showMessageBox(lua_State *L) } else { + const char *typestr = lua_isnoneornil(L, 3) ? nullptr : luaL_checkstring(L, 3); + if (typestr && !Window::getConstant(typestr, data.type)) + return luaL_error(L, "Invalid messagebox type: %s", typestr); + data.attachToWindow = luax_optboolean(L, 4, true); // Display a simple message box. - bool success = instance()->showMessageBox(data.type, data.title, data.message, data.attachToWindow); + bool success = instance()->showMessageBox(data.title, data.message, data.type, data.attachToWindow); luax_pushboolean(L, success); } @@ -420,6 +510,8 @@ static const luaL_Reg functions[] = { "getHeight", w_getHeight }, { "getDimensions", w_getDimensions }, { "getDesktopDimensions", w_getDesktopDimensions }, + { "setPosition", w_setPosition }, + { "getPosition", w_getPosition }, { "setIcon", w_setIcon }, { "getIcon", w_getIcon }, { "setTitle", w_setTitle }, @@ -429,6 +521,8 @@ static const luaL_Reg functions[] = { "isVisible", w_isVisible }, { "getPixelScale", w_getPixelScale }, { "isTouchScreen", w_isTouchScreen }, + { "toPixels", w_toPixels }, + { "fromPixels", w_fromPixels }, { "minimize", w_minimize }, { "showMessageBox", w_showMessageBox }, { 0, 0 } diff --git a/jni/love/src/modules/window/wrap_Window.h b/jni/love/src/modules/window/wrap_Window.h index 091799f8..d58936bb 100644 --- a/jni/love/src/modules/window/wrap_Window.h +++ b/jni/love/src/modules/window/wrap_Window.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -41,6 +41,8 @@ int w_getWidth(lua_State *L); int w_getHeight(lua_State *L); int w_getDimensions(lua_State *L); int w_getDesktopDimensions(lua_State *L); +int w_setPosition(lua_State *L); +int w_getPosition(lua_State *L); int w_setIcon(lua_State *L); int w_getIcon(lua_State *L); int w_setTitle(lua_State *L); @@ -50,7 +52,10 @@ int w_hasMouseFocus(lua_State *L); int w_isVisible(lua_State *L); int w_getPixelScale(lua_State *L); int w_isTouchScreen(lua_State *L); +int w_toPixels(lua_State *L); +int w_fromPixels(lua_State *L); int w_minimize(lua_State *L); +int w_maximize(lua_State *L); int w_showMessageBox(lua_State *L); extern "C" LOVE_EXPORT int luaopen_love_window(lua_State *L); diff --git a/jni/love/src/scripts/auto.lua b/jni/love/src/scripts/auto.lua index dbd8c6bd..6d096c47 100644 --- a/jni/love/src/scripts/auto.lua +++ b/jni/love/src/scripts/auto.lua @@ -7,7 +7,7 @@ local max_width = 18 local pattern = [[ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages diff --git a/jni/love/src/scripts/boot.lua b/jni/love/src/scripts/boot.lua index ef323d95..557101cf 100644 --- a/jni/love/src/scripts/boot.lua +++ b/jni/love/src/scripts/boot.lua @@ -1,5 +1,5 @@ --[[ -Copyright (c) 2006-2014 LOVE Development Team +Copyright (c) 2006-2015 LOVE Development Team This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -81,6 +81,8 @@ end -- Returns the leaf of a full path. function love.path.leaf(p) + p = love.path.normalslashes(p) + local a = 1 local last = p @@ -315,6 +317,8 @@ function love.init() window = { width = 800, height = 600, + x = nil, + y = nil, minwidth = 1, minheight = 1, fullscreen = false, @@ -360,12 +364,11 @@ function love.init() -- Yes, conf.lua might not exist, but there are other ways of making -- love.conf appear, so we should check for it anyway. + local confok, conferr if love.conf then - local ok, err = pcall(love.conf, c) - if not ok then - print(err) - -- continue - end + confok, conferr = pcall(love.conf, c) + -- If love.conf errors, we'll trigger the error after loading modules so + -- the error message can be displayed in the window. end if love.arg.options.console.set then @@ -410,6 +413,10 @@ function love.init() love.createhandlers() end + if not confok and conferr then + error(conferr) + end + -- Setup window here. if c.window and c.modules.window then assert(love.window.setMode(c.window.width, c.window.height, @@ -427,6 +434,8 @@ function love.init() display = c.window.display, highdpi = c.window.highdpi, srgb = c.window.srgb, + x = c.window.x, + y = c.window.y, }), "Could not set window mode") love.window.setTitle(c.window.title or c.title) if c.window.icon then @@ -494,10 +503,7 @@ function love.run() if love.math then love.math.setRandomSeed(os.time()) - end - - if love.event then - love.event.pump() + for i=1,3 do love.math.random() end end if love.load then love.load(arg) end @@ -1449,9 +1455,8 @@ function love.nogame() g_time = g_time + dt / 2 local int, frac = math.modf(g_time) update_rain(frac) - local scale = love.window.getPixelScale() - inspector.x = love.graphics.getWidth() * 0.45 / scale - inspector.y = love.graphics.getHeight() * 0.55 / scale + inspector.x = love.window.fromPixels(love.graphics.getWidth() * 0.45) + inspector.y = love.window.fromPixels(love.graphics.getHeight() * 0.55) end local function draw_grid() @@ -1587,10 +1592,10 @@ function love.errhand(msg) end if love.audio then love.audio.stop() end love.graphics.reset() - local font = love.graphics.setNewFont(math.floor(14 * love.window.getPixelScale())) + local font = love.graphics.setNewFont(math.floor(love.window.toPixels(14))) local sRGB = select(3, love.window.getMode()).srgb - if sRGB then + if sRGB and love.math then love.graphics.setBackgroundColor(love.math.gammaToLinear(89, 157, 220)) else love.graphics.setBackgroundColor(89, 157, 220) @@ -1621,7 +1626,7 @@ function love.errhand(msg) p = string.gsub(p, "%[string \"(.-)\"%]", "%1") local function draw() - local pos = 70 * love.window.getPixelScale() + local pos = love.window.toPixels(70) love.graphics.clear() love.graphics.printf(p, pos, pos, love.graphics.getWidth() - pos) love.graphics.present() diff --git a/jni/love/src/scripts/boot.lua.h b/jni/love/src/scripts/boot.lua.h index c93907ba..eba45093 100644 --- a/jni/love/src/scripts/boot.lua.h +++ b/jni/love/src/scripts/boot.lua.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -27,7 +27,7 @@ const unsigned char boot_lua[] = 0x2d, 0x2d, 0x5b, 0x5b, 0x0a, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x32, 0x30, 0x30, 0x36, - 0x2d, 0x32, 0x30, 0x31, 0x34, 0x20, 0x4c, 0x4f, 0x56, 0x45, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, + 0x2d, 0x32, 0x30, 0x31, 0x35, 0x20, 0x4c, 0x4f, 0x56, 0x45, 0x20, 0x44, 0x65, 0x76, 0x65, 0x6c, 0x6f, 0x70, 0x6d, 0x65, 0x6e, 0x74, 0x20, 0x54, 0x65, 0x61, 0x6d, 0x0a, 0x54, 0x68, 0x69, 0x73, 0x20, 0x73, 0x6f, 0x66, 0x74, 0x77, 0x61, 0x72, 0x65, 0x20, 0x69, 0x73, 0x20, 0x70, 0x72, 0x6f, 0x76, 0x69, 0x64, 0x65, 0x64, 0x20, 0x27, 0x61, 0x73, 0x2d, 0x69, 0x73, 0x27, 0x2c, 0x20, 0x77, @@ -168,6 +168,8 @@ const unsigned char boot_lua[] = 0x66, 0x20, 0x6f, 0x66, 0x20, 0x61, 0x20, 0x66, 0x75, 0x6c, 0x6c, 0x20, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x0a, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x6c, 0x65, 0x61, 0x66, 0x28, 0x70, 0x29, 0x0a, + 0x09, 0x70, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x70, 0x61, 0x74, 0x68, 0x2e, 0x6e, 0x6f, 0x72, + 0x6d, 0x61, 0x6c, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x65, 0x73, 0x28, 0x70, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x61, 0x20, 0x3d, 0x20, 0x31, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6c, 0x61, 0x73, 0x74, 0x20, 0x3d, 0x20, 0x70, 0x0a, 0x09, 0x77, 0x68, 0x69, 0x6c, 0x65, 0x20, 0x61, 0x20, 0x64, 0x6f, 0x0a, @@ -585,6 +587,8 @@ const unsigned char boot_lua[] = 0x09, 0x09, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x3d, 0x20, 0x7b, 0x0a, 0x09, 0x09, 0x09, 0x77, 0x69, 0x64, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x38, 0x30, 0x30, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x3d, 0x20, 0x36, 0x30, 0x30, 0x2c, 0x0a, + 0x09, 0x09, 0x09, 0x78, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x2c, 0x0a, + 0x09, 0x09, 0x09, 0x79, 0x20, 0x3d, 0x20, 0x6e, 0x69, 0x6c, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x6d, 0x69, 0x6e, 0x77, 0x69, 0x64, 0x74, 0x68, 0x20, 0x3d, 0x20, 0x31, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x6d, 0x69, 0x6e, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x20, 0x3d, 0x20, 0x31, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x66, 0x75, 0x6c, 0x6c, 0x73, 0x63, 0x72, 0x65, 0x65, 0x6e, 0x20, 0x3d, 0x20, 0x66, 0x61, @@ -660,14 +664,20 @@ const unsigned char boot_lua[] = 0x61, 0x72, 0x2c, 0x20, 0x73, 0x6f, 0x20, 0x77, 0x65, 0x20, 0x73, 0x68, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x63, 0x68, 0x65, 0x63, 0x6b, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x74, 0x20, 0x61, 0x6e, 0x79, 0x77, 0x61, 0x79, 0x2e, 0x0a, + 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x6b, 0x2c, 0x20, 0x63, 0x6f, 0x6e, + 0x66, 0x65, 0x72, 0x72, 0x0a, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, - 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x6f, 0x6b, 0x2c, 0x20, 0x65, 0x72, 0x72, 0x20, 0x3d, 0x20, - 0x70, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2c, 0x20, 0x63, - 0x29, 0x0a, - 0x09, 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x6f, 0x6b, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, - 0x09, 0x09, 0x09, 0x70, 0x72, 0x69, 0x6e, 0x74, 0x28, 0x65, 0x72, 0x72, 0x29, 0x0a, - 0x09, 0x09, 0x09, 0x2d, 0x2d, 0x20, 0x63, 0x6f, 0x6e, 0x74, 0x69, 0x6e, 0x75, 0x65, 0x0a, - 0x09, 0x09, 0x65, 0x6e, 0x64, 0x0a, + 0x09, 0x09, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x6b, 0x2c, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x20, + 0x3d, 0x20, 0x70, 0x63, 0x61, 0x6c, 0x6c, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x2c, + 0x20, 0x63, 0x29, 0x0a, + 0x09, 0x09, 0x2d, 0x2d, 0x20, 0x49, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x6f, 0x6e, 0x66, 0x20, + 0x65, 0x72, 0x72, 0x6f, 0x72, 0x73, 0x2c, 0x20, 0x77, 0x65, 0x27, 0x6c, 0x6c, 0x20, 0x74, 0x72, 0x69, 0x67, + 0x67, 0x65, 0x72, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x61, 0x66, 0x74, 0x65, + 0x72, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x73, 0x20, + 0x73, 0x6f, 0x0a, + 0x09, 0x09, 0x2d, 0x2d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x6d, 0x65, 0x73, + 0x73, 0x61, 0x67, 0x65, 0x20, 0x63, 0x61, 0x6e, 0x20, 0x62, 0x65, 0x20, 0x64, 0x69, 0x73, 0x70, 0x6c, 0x61, + 0x79, 0x65, 0x64, 0x20, 0x69, 0x6e, 0x20, 0x74, 0x68, 0x65, 0x20, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x61, 0x72, 0x67, 0x2e, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x63, 0x6f, 0x6e, 0x73, 0x6f, 0x6c, 0x65, 0x2e, 0x73, 0x65, 0x74, 0x20, 0x74, 0x68, 0x65, @@ -725,6 +735,10 @@ const unsigned char boot_lua[] = 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x68, 0x61, 0x6e, 0x64, 0x6c, 0x65, 0x72, 0x73, 0x28, 0x29, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, + 0x09, 0x69, 0x66, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x6f, 0x6b, 0x20, 0x61, 0x6e, 0x64, + 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, + 0x09, 0x09, 0x65, 0x72, 0x72, 0x6f, 0x72, 0x28, 0x63, 0x6f, 0x6e, 0x66, 0x65, 0x72, 0x72, 0x29, 0x0a, + 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x2d, 0x2d, 0x20, 0x53, 0x65, 0x74, 0x75, 0x70, 0x20, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x68, 0x65, 0x72, 0x65, 0x2e, 0x0a, 0x09, 0x69, 0x66, 0x20, 0x63, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x63, @@ -764,6 +778,8 @@ const unsigned char boot_lua[] = 0x64, 0x6f, 0x77, 0x2e, 0x68, 0x69, 0x67, 0x68, 0x64, 0x70, 0x69, 0x2c, 0x0a, 0x09, 0x09, 0x09, 0x73, 0x72, 0x67, 0x62, 0x20, 0x3d, 0x20, 0x63, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x73, 0x72, 0x67, 0x62, 0x2c, 0x0a, + 0x09, 0x09, 0x09, 0x78, 0x20, 0x3d, 0x20, 0x63, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x78, 0x2c, 0x0a, + 0x09, 0x09, 0x09, 0x79, 0x20, 0x3d, 0x20, 0x63, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x79, 0x2c, 0x0a, 0x09, 0x09, 0x7d, 0x29, 0x2c, 0x20, 0x22, 0x43, 0x6f, 0x75, 0x6c, 0x64, 0x20, 0x6e, 0x6f, 0x74, 0x20, 0x73, 0x65, 0x74, 0x20, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x20, 0x6d, 0x6f, 0x64, 0x65, 0x22, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x73, 0x65, 0x74, 0x54, @@ -902,11 +918,9 @@ const unsigned char boot_lua[] = 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x73, 0x65, 0x74, 0x52, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x53, 0x65, 0x65, 0x64, 0x28, 0x6f, 0x73, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x28, 0x29, 0x29, 0x0a, - 0x09, 0x65, 0x6e, 0x64, 0x0a, - 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x20, 0x74, 0x68, 0x65, - 0x6e, 0x0a, - 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x65, 0x76, 0x65, 0x6e, 0x74, 0x2e, 0x70, 0x75, 0x6d, 0x70, 0x28, - 0x29, 0x0a, + 0x09, 0x09, 0x66, 0x6f, 0x72, 0x20, 0x69, 0x3d, 0x31, 0x2c, 0x33, 0x20, 0x64, 0x6f, 0x20, 0x6c, 0x6f, 0x76, + 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x72, 0x61, 0x6e, 0x64, 0x6f, 0x6d, 0x28, 0x29, 0x20, 0x65, 0x6e, + 0x64, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x69, 0x66, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6c, 0x6f, 0x61, 0x64, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6c, 0x6f, 0x61, 0x64, 0x28, 0x61, 0x72, 0x67, 0x29, 0x20, 0x65, 0x6e, @@ -5076,17 +5090,14 @@ const unsigned char boot_lua[] = 0x29, 0x0a, 0x09, 0x09, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x72, 0x61, 0x69, 0x6e, 0x28, 0x66, 0x72, 0x61, 0x63, 0x29, 0x0a, - 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x63, 0x61, 0x6c, 0x65, 0x20, 0x3d, 0x20, 0x6c, 0x6f, - 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x50, 0x69, 0x78, 0x65, 0x6c, - 0x53, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x78, 0x20, 0x3d, 0x20, 0x6c, 0x6f, - 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x57, 0x69, 0x64, - 0x74, 0x68, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x20, 0x2f, 0x20, 0x73, 0x63, 0x61, 0x6c, - 0x65, 0x0a, + 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x66, 0x72, 0x6f, 0x6d, 0x50, 0x69, 0x78, 0x65, + 0x6c, 0x73, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, + 0x65, 0x74, 0x57, 0x69, 0x64, 0x74, 0x68, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x34, 0x35, 0x29, 0x0a, 0x09, 0x09, 0x69, 0x6e, 0x73, 0x70, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x2e, 0x79, 0x20, 0x3d, 0x20, 0x6c, 0x6f, - 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, 0x65, 0x74, 0x48, 0x65, 0x69, - 0x67, 0x68, 0x74, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x35, 0x20, 0x2f, 0x20, 0x73, 0x63, 0x61, - 0x6c, 0x65, 0x0a, + 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x66, 0x72, 0x6f, 0x6d, 0x50, 0x69, 0x78, 0x65, + 0x6c, 0x73, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x67, + 0x65, 0x74, 0x48, 0x65, 0x69, 0x67, 0x68, 0x74, 0x28, 0x29, 0x20, 0x2a, 0x20, 0x30, 0x2e, 0x35, 0x35, 0x29, 0x0a, 0x09, 0x65, 0x6e, 0x64, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x72, 0x61, 0x77, 0x5f, 0x67, 0x72, 0x69, 0x64, 0x28, 0x29, 0x0a, @@ -5342,13 +5353,14 @@ const unsigned char boot_lua[] = 0x65, 0x74, 0x28, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x6f, 0x6e, 0x74, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x4e, 0x65, 0x77, 0x46, 0x6f, - 0x6e, 0x74, 0x28, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x28, 0x31, 0x34, 0x20, 0x2a, - 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x50, 0x69, - 0x78, 0x65, 0x6c, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x29, 0x29, 0x29, 0x0a, + 0x6e, 0x74, 0x28, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x66, 0x6c, 0x6f, 0x6f, 0x72, 0x28, 0x6c, 0x6f, 0x76, 0x65, + 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x74, 0x6f, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x73, 0x28, 0x31, + 0x34, 0x29, 0x29, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x3d, 0x20, 0x73, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x28, 0x33, 0x2c, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x4d, 0x6f, 0x64, 0x65, 0x28, 0x29, 0x29, 0x2e, 0x73, 0x72, 0x67, 0x62, 0x0a, - 0x09, 0x69, 0x66, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, + 0x09, 0x69, 0x66, 0x20, 0x73, 0x52, 0x47, 0x42, 0x20, 0x61, 0x6e, 0x64, 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, + 0x6d, 0x61, 0x74, 0x68, 0x20, 0x74, 0x68, 0x65, 0x6e, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x73, 0x65, 0x74, 0x42, 0x61, 0x63, 0x6b, 0x67, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x28, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x6d, 0x61, 0x74, 0x68, 0x2e, 0x67, 0x61, 0x6d, 0x6d, 0x61, 0x54, 0x6f, 0x4c, 0x69, @@ -5396,9 +5408,9 @@ const unsigned char boot_lua[] = 0x5c, 0x22, 0x25, 0x5d, 0x22, 0x2c, 0x20, 0x22, 0x25, 0x31, 0x22, 0x29, 0x0a, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x66, 0x75, 0x6e, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x20, 0x64, 0x72, 0x61, 0x77, 0x28, 0x29, 0x0a, - 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x70, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x37, 0x30, 0x20, 0x2a, - 0x20, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x67, 0x65, 0x74, 0x50, 0x69, - 0x78, 0x65, 0x6c, 0x53, 0x63, 0x61, 0x6c, 0x65, 0x28, 0x29, 0x0a, + 0x09, 0x09, 0x6c, 0x6f, 0x63, 0x61, 0x6c, 0x20, 0x70, 0x6f, 0x73, 0x20, 0x3d, 0x20, 0x6c, 0x6f, 0x76, 0x65, + 0x2e, 0x77, 0x69, 0x6e, 0x64, 0x6f, 0x77, 0x2e, 0x74, 0x6f, 0x50, 0x69, 0x78, 0x65, 0x6c, 0x73, 0x28, 0x37, + 0x30, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x63, 0x6c, 0x65, 0x61, 0x72, 0x28, 0x29, 0x0a, 0x09, 0x09, 0x6c, 0x6f, 0x76, 0x65, 0x2e, 0x67, 0x72, 0x61, 0x70, 0x68, 0x69, 0x63, 0x73, 0x2e, 0x70, 0x72, diff --git a/jni/love/src/scripts/graphics.lua b/jni/love/src/scripts/graphics.lua index 97caa7f7..d671e60f 100644 --- a/jni/love/src/scripts/graphics.lua +++ b/jni/love/src/scripts/graphics.lua @@ -1,5 +1,5 @@ --[[ -Copyright (c) 2006-2014 LOVE Development Team +Copyright (c) 2006-2015 LOVE Development Team This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages @@ -1296,10 +1296,16 @@ do GLSLES.VERSION = "#version 100" GLSL.SYNTAX = [[ +#ifndef GL_ES +#define lowp +#define mediump +#define highp +#endif #define number float #define Image sampler2D #define extern uniform -#define Texel texture2D]] +#define Texel texture2D +#pragma optionNV(strict on)]] GLSLES.SYNTAX = GLSL.SYNTAX diff --git a/jni/love/src/scripts/graphics.lua.h b/jni/love/src/scripts/graphics.lua.h index db641dd6..d18c5fc0 100644 --- a/jni/love/src/scripts/graphics.lua.h +++ b/jni/love/src/scripts/graphics.lua.h @@ -1,5 +1,5 @@ /** - * Copyright (c) 2006-2014 LOVE Development Team + * Copyright (c) 2006-2015 LOVE Development Team * * This software is provided 'as-is', without any express or implied * warranty. In no event will the authors be held liable for any damages @@ -6271,6 +6271,11 @@ const unsigned char graphics_lua[] = 0x09, 0x47, 0x4c, 0x53, 0x4c, 0x45, 0x53, 0x2e, 0x56, 0x45, 0x52, 0x53, 0x49, 0x4f, 0x4e, 0x20, 0x3d, 0x20, 0x22, 0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x31, 0x30, 0x30, 0x22, 0x0a, 0x09, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x53, 0x59, 0x4e, 0x54, 0x41, 0x58, 0x20, 0x3d, 0x20, 0x5b, 0x5b, 0x0a, + 0x23, 0x69, 0x66, 0x6e, 0x64, 0x65, 0x66, 0x20, 0x47, 0x4c, 0x5f, 0x45, 0x53, 0x0a, + 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6c, 0x6f, 0x77, 0x70, 0x0a, + 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6d, 0x65, 0x64, 0x69, 0x75, 0x6d, 0x70, 0x0a, + 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x68, 0x69, 0x67, 0x68, 0x70, 0x0a, + 0x23, 0x65, 0x6e, 0x64, 0x69, 0x66, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x49, 0x6d, 0x61, 0x67, 0x65, 0x20, 0x73, 0x61, 0x6d, 0x70, @@ -6278,7 +6283,9 @@ const unsigned char graphics_lua[] = 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x65, 0x78, 0x74, 0x65, 0x72, 0x6e, 0x20, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x0a, 0x23, 0x64, 0x65, 0x66, 0x69, 0x6e, 0x65, 0x20, 0x54, 0x65, 0x78, 0x65, 0x6c, 0x20, 0x74, 0x65, 0x78, 0x74, - 0x75, 0x72, 0x65, 0x32, 0x44, 0x5d, 0x5d, 0x0a, + 0x75, 0x72, 0x65, 0x32, 0x44, 0x0a, + 0x23, 0x70, 0x72, 0x61, 0x67, 0x6d, 0x61, 0x20, 0x6f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x4e, 0x56, 0x28, 0x73, + 0x74, 0x72, 0x69, 0x63, 0x74, 0x20, 0x6f, 0x6e, 0x29, 0x5d, 0x5d, 0x0a, 0x09, 0x47, 0x4c, 0x53, 0x4c, 0x45, 0x53, 0x2e, 0x53, 0x59, 0x4e, 0x54, 0x41, 0x58, 0x20, 0x3d, 0x20, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x53, 0x59, 0x4e, 0x54, 0x41, 0x58, 0x0a, 0x09, 0x47, 0x4c, 0x53, 0x4c, 0x2e, 0x55, 0x4e, 0x49, 0x46, 0x4f, 0x52, 0x4d, 0x53, 0x20, 0x3d, 0x20, 0x5b,