Browse Source

Merged default into minor

--HG--
branch : minor
Alex Szpakowski 11 years ago
parent
commit
a691b7efb9
100 changed files with 4315 additions and 1656 deletions
  1. 1 0
      .hgignore
  2. 1 0
      .hgtags
  3. 1284 0
      CMakeLists.txt
  4. 241 35
      changes.txt
  5. 2 5
      license.txt
  6. 2 2
      platform/macosx/Info-Framework.plist
  7. 47 0
      platform/macosx/OSX.h
  8. 75 0
      platform/macosx/OSX.mm
  9. 0 12
      platform/macosx/SDLMain.h
  10. 0 437
      platform/macosx/SDLMain.m
  11. 0 53
      platform/macosx/autobuild
  12. 6 6
      platform/macosx/love-Info.plist
  13. 449 85
      platform/macosx/love-framework.xcodeproj/project.pbxproj
  14. 40 49
      platform/macosx/love.xcodeproj/project.pbxproj
  15. 0 8
      platform/macosx/loveProj.xcconfig
  16. 0 7
      platform/macosx/loveTarget.xcconfig
  17. 0 7
      platform/macosx/love_Prefix.pch
  18. 0 28
      platform/macosx/script.sh
  19. 136 33
      platform/msvc2010/liblove.vcxproj
  20. 411 63
      platform/msvc2010/liblove.vcxproj.filters
  21. BIN
      platform/msvc2010/love.rc
  22. 28 28
      platform/msvc2010/love.sln
  23. 18 11
      platform/msvc2010/love.vcxproj
  24. 22 1
      platform/unix/Makefile.am
  25. 0 0
      platform/unix/application-x-love-game.svg
  26. 0 135
      platform/unix/autobuild
  27. 35 12
      platform/unix/automagic
  28. 120 61
      platform/unix/configure.ac
  29. 0 11
      platform/unix/debian
  30. 5 0
      platform/unix/debian/changelog.in
  31. 1 0
      platform/unix/debian/compat
  32. 59 0
      platform/unix/debian/control.in
  33. 20 0
      platform/unix/debian/copyright
  34. 2 0
      platform/unix/debian/docs
  35. 1 0
      platform/unix/debian/liblove-unstable.install
  36. 1 0
      platform/unix/debian/liblove.install
  37. 1 0
      platform/unix/debian/love-unstable.install
  38. 1 0
      platform/unix/debian/love.install
  39. 1 0
      platform/unix/debian/love.manpages
  40. 16 0
      platform/unix/debian/rules.in
  41. 1 0
      platform/unix/debian/source/format
  42. 2 21
      platform/unix/exclude
  43. 20 10
      platform/unix/gen-makefile
  44. 168 0
      platform/unix/genmodules
  45. 0 7
      platform/unix/get-libs
  46. 26 0
      platform/unix/love.1
  47. 2 3
      platform/unix/love.desktop.in
  48. 0 0
      platform/unix/love.svg
  49. 0 65
      platform/unix/make-package
  50. 13 9
      readme.md
  51. 1 1
      src/common/Data.h
  52. 1 1
      src/common/EnumMap.h
  53. 1 3
      src/common/Exception.cpp
  54. 1 1
      src/common/Exception.h
  55. 4 4
      src/common/Matrix.cpp
  56. 2 2
      src/common/Matrix.h
  57. 1 1
      src/common/Memoizer.cpp
  58. 1 1
      src/common/Memoizer.h
  59. 80 21
      src/common/Module.cpp
  60. 13 5
      src/common/Module.h
  61. 1 1
      src/common/Object.cpp
  62. 28 1
      src/common/Object.h
  63. 5 3
      src/common/Reference.cpp
  64. 1 1
      src/common/Reference.h
  65. 2 2
      src/common/StringMap.h
  66. 91 11
      src/common/Variant.cpp
  67. 10 3
      src/common/Variant.h
  68. 1 1
      src/common/Vector.cpp
  69. 27 13
      src/common/Vector.h
  70. 3 3
      src/common/b64.cpp
  71. 1 1
      src/common/b64.h
  72. 44 5
      src/common/config.h
  73. 3 2
      src/common/delay.cpp
  74. 2 2
      src/common/delay.h
  75. 1 1
      src/common/int.h
  76. 0 33
      src/common/math.cpp
  77. 11 39
      src/common/math.h
  78. 274 30
      src/common/runtime.cpp
  79. 150 53
      src/common/runtime.h
  80. 33 7
      src/common/types.h
  81. 1 1
      src/common/utf8.cpp
  82. 1 1
      src/common/utf8.h
  83. 4 4
      src/common/version.h
  84. 10 2
      src/common/wrap_Data.cpp
  85. 2 1
      src/common/wrap_Data.h
  86. 2 1
      src/libraries/Box2D/Box2D.h
  87. 21 2
      src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp
  88. 2 2
      src/libraries/Box2D/Collision/Shapes/b2ChainShape.h
  89. 0 1
      src/libraries/Box2D/Collision/Shapes/b2CircleShape.cpp
  90. 2 3
      src/libraries/Box2D/Collision/Shapes/b2EdgeShape.cpp
  91. 139 41
      src/libraries/Box2D/Collision/Shapes/b2PolygonShape.cpp
  92. 14 8
      src/libraries/Box2D/Collision/Shapes/b2PolygonShape.h
  93. 1 3
      src/libraries/Box2D/Collision/b2BroadPhase.cpp
  94. 10 1
      src/libraries/Box2D/Collision/b2BroadPhase.h
  95. 1 1
      src/libraries/Box2D/Collision/b2CollideCircle.cpp
  96. 6 6
      src/libraries/Box2D/Collision/b2CollideEdge.cpp
  97. 32 110
      src/libraries/Box2D/Collision/b2CollidePolygon.cpp
  98. 4 1
      src/libraries/Box2D/Collision/b2Collision.cpp
  99. 4 3
      src/libraries/Box2D/Collision/b2Collision.h
  100. 8 8
      src/libraries/Box2D/Collision/b2Distance.cpp

+ 1 - 0
.hgignore

@@ -23,6 +23,7 @@ glob:*.ncb
 glob:*.exe
 glob:*.exe
 glob:*.bat
 glob:*.bat
 glob:platform/macosx/build
 glob:platform/macosx/build
+glob:platform/macosx/Build
 glob:platform/macosx/DerivedData
 glob:platform/macosx/DerivedData
 glob:platform/macosx/*.xcodeproj/bill*
 glob:platform/macosx/*.xcodeproj/bill*
 glob:platform/macosx/*.xcodeproj/xcuserdata
 glob:platform/macosx/*.xcodeproj/xcuserdata

+ 1 - 0
.hgtags

@@ -5,3 +5,4 @@ db7cd0682883ed357adef013a326bbb26de28c98 0.6.2
 18d79c306466d188919c238d23e50ea705b07c03 0.7.1
 18d79c306466d188919c238d23e50ea705b07c03 0.7.1
 bcca82b60d0f5cd724edbe4ed65db18ab95d4691 0.7.2
 bcca82b60d0f5cd724edbe4ed65db18ab95d4691 0.7.2
 e0f98d53debb62347c6433ca0534a0f77f15f76f 0.8.0
 e0f98d53debb62347c6433ca0534a0f77f15f76f 0.8.0
+38c00c788bcb03bda2ad40efebcdfe7a6be85b4a 0.9.0

+ 1284 - 0
CMakeLists.txt

@@ -0,0 +1,1284 @@
+#
+# Copyright (c) 2006-2014 LOVE Development Team
+#
+# This software is provided 'as-is', without any express or implied
+# warranty.  In no event will the authors be held liable for any damages
+# arising from the use of this software.
+#
+# Permission is granted to anyone to use this software for any purpose,
+# including commercial applications, and to alter it and redistribute it
+# freely, subject to the following restrictions:
+#
+# 1. The origin of this software must not be misrepresented; you must not
+#    claim that you wrote the original software. If you use this software
+#    in a product, an acknowledgment in the product documentation would be
+#    appreciated but is not required.
+# 2. Altered source versions must be plainly marked as such, and must not be
+#    misrepresented as being the original software.
+# 3. This notice may not be removed or altered from any source distribution.
+#
+
+if(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
+	# Protip: run cmake like this: cmake -G "<generator>" -H. -Bbuild
+	message(FATAL_ERROR "Prevented in-tree build.")
+endif()
+
+cmake_minimum_required(VERSION 2.8)
+
+project(love)
+
+if(NOT MEGA)
+	message(FATAL_ERROR "
+It is currently only possible to build with megasource on Windows.
+Please see http://bitbucket.org/rude/megasource
+")
+endif()
+
+set(LOVE_EXE_NAME love)
+set(LOVE_LIB_NAME liblove)
+
+if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+	set(LOVE_X64 TRUE)
+	set(LOVE_TARGET_PLATFORM x64)
+else()
+	set(LOVE_X86 TRUE)
+	set(LOVE_TARGET_PLATFORM x86)
+endif()
+
+option(LOVE_JIT "Use LuaJIT" TRUE)
+
+if(LOVE_JIT)
+	message(STATUS "LuaJIT: Enabled")
+else()
+	message(STATUS "LuaJIT: Disabled")
+endif()
+
+message(STATUS "Target platform: ${LOVE_TARGET_PLATFORM}")
+
+find_package(OpenGL)
+
+if(${LOVE_JIT})
+	set(MEGA_LUA ${MEGA_LUAJIT_LIB})
+	set(MEGA_EXTRA_INCLUDE ${MEGA_LUAJIT_INCLUDE})
+	set(MEGA_EXTRA_DLLS ${MEGA_LUAJIT_DLL})
+	set(MEGA_EXTRA_DEPENDECIES luajit)
+else()
+	set(MEGA_LUA ${MEGA_LUA51})
+	# MEGA_LUA51 is a CMake target, so includes are handled
+	# automatically.
+endif()
+
+#
+# common
+#
+
+set(LOVE_SRC_COMMON
+	src/common/b64.cpp
+	src/common/b64.h
+	src/common/config.h
+	src/common/Data.h
+	src/common/delay.cpp
+	src/common/delay.h
+	src/common/EnumMap.h
+	src/common/Exception.cpp
+	src/common/Exception.h
+	src/common/int.h
+	src/common/math.h
+	src/common/Matrix.cpp
+	src/common/Matrix.h
+	src/common/Memoizer.cpp
+	src/common/Memoizer.h
+	src/common/Module.cpp
+	src/common/Module.h
+	src/common/Object.cpp
+	src/common/Object.h
+	src/common/Reference.cpp
+	src/common/Reference.h
+	src/common/runtime.cpp
+	src/common/runtime.h
+	src/common/StringMap.h
+	src/common/types.h
+	src/common/utf8.cpp
+	src/common/utf8.h
+	src/common/Variant.cpp
+	src/common/Variant.h
+	#src/common/Vector.cpp # Vector.cpp is empty.
+	src/common/Vector.h
+	src/common/version.h
+	src/common/wrap_Data.cpp
+	src/common/wrap_Data.h
+)
+
+source_group("common" FILES ${LOVE_SRC_COMMON})
+
+#
+# love.audio
+#
+
+set(LOVE_SRC_MODULE_AUDIO_ROOT
+	src/modules/audio/Audio.cpp
+	src/modules/audio/Audio.h
+	src/modules/audio/Source.cpp
+	src/modules/audio/Source.h
+	src/modules/audio/wrap_Audio.cpp
+	src/modules/audio/wrap_Audio.h
+	src/modules/audio/wrap_Source.cpp
+	src/modules/audio/wrap_Source.h
+)
+
+set(LOVE_SRC_MODULE_AUDIO_NULL
+	src/modules/audio/null/Audio.cpp
+	src/modules/audio/null/Audio.h
+	src/modules/audio/null/Source.cpp
+	src/modules/audio/null/Source.h
+)
+
+set(LOVE_SRC_MODULE_AUDIO_OPENAL
+	src/modules/audio/openal/Audio.cpp
+	src/modules/audio/openal/Audio.h
+	src/modules/audio/openal/Pool.cpp
+	src/modules/audio/openal/Pool.h
+	src/modules/audio/openal/Source.cpp
+	src/modules/audio/openal/Source.h
+)
+
+set(LOVE_SRC_MODULE_AUDIO
+	${LOVE_SRC_MODULE_AUDIO_ROOT}
+	${LOVE_SRC_MODULE_AUDIO_NULL}
+	${LOVE_SRC_MODULE_AUDIO_OPENAL}
+)
+
+source_group("modules\\audio" FILES ${LOVE_SRC_MODULE_AUDIO_ROOT})
+source_group("modules\\audio\\null" FILES ${LOVE_SRC_MODULE_AUDIO_NULL})
+source_group("modules\\audio\\openal" FILES ${LOVE_SRC_MODULE_AUDIO_OPENAL})
+
+#
+# love.event
+#
+
+set(LOVE_SRC_MODULE_EVENT_ROOT
+	src/modules/event/Event.cpp
+	src/modules/event/Event.h
+)
+
+set(LOVE_SRC_MODULE_EVENT_SDL
+	src/modules/event/sdl/Event.cpp
+	src/modules/event/sdl/Event.h
+	src/modules/event/sdl/wrap_Event.cpp
+	src/modules/event/sdl/wrap_Event.h
+)
+
+set(LOVE_SRC_MODULE_EVENT
+	${LOVE_SRC_MODULE_EVENT_ROOT}
+	${LOVE_SRC_MODULE_EVENT_SDL}
+)
+
+source_group("modules\\event" FILES ${LOVE_SRC_MODULE_EVENT_ROOT})
+source_group("modules\\event\\sdl" FILES ${LOVE_SRC_MODULE_EVENT_SDL})
+
+#
+# love.filesystem
+#
+
+set(LOVE_SRC_MODULE_FILESYSTEM_ROOT
+	src/modules/filesystem/File.cpp
+	src/modules/filesystem/File.h
+	src/modules/filesystem/FileData.cpp
+	src/modules/filesystem/FileData.h
+)
+
+set(LOVE_SRC_MODULE_FILESYSTEM_PHYSFS
+	src/modules/filesystem/physfs/File.cpp
+	src/modules/filesystem/physfs/File.h
+	src/modules/filesystem/physfs/Filesystem.cpp
+	src/modules/filesystem/physfs/Filesystem.h
+	src/modules/filesystem/physfs/wrap_File.cpp
+	src/modules/filesystem/physfs/wrap_File.h
+	src/modules/filesystem/physfs/wrap_FileData.cpp
+	src/modules/filesystem/physfs/wrap_FileData.h
+	src/modules/filesystem/physfs/wrap_Filesystem.cpp
+	src/modules/filesystem/physfs/wrap_Filesystem.h
+)
+
+set(LOVE_SRC_MODULE_FILESYSTEM
+	${LOVE_SRC_MODULE_FILESYSTEM_ROOT}
+	${LOVE_SRC_MODULE_FILESYSTEM_PHYSFS}
+)
+
+source_group("modules\\filesystem" FILES ${LOVE_SRC_MODULE_FILESYSTEM_ROOT})
+source_group("modules\\filesystem\\physfs" FILES ${LOVE_SRC_MODULE_FILESYSTEM_PHYSFS})
+
+#
+# love.font
+#
+
+set(LOVE_SRC_MODULE_FONT_ROOT
+	src/modules/font/Font.h
+	src/modules/font/GlyphData.cpp
+	src/modules/font/GlyphData.h
+	src/modules/font/ImageRasterizer.cpp
+	src/modules/font/ImageRasterizer.h
+	src/modules/font/Rasterizer.cpp
+	src/modules/font/Rasterizer.h
+	src/modules/font/wrap_GlyphData.cpp
+	src/modules/font/wrap_GlyphData.h
+	src/modules/font/wrap_Rasterizer.cpp
+	src/modules/font/wrap_Rasterizer.h
+)
+
+set(LOVE_SRC_MODULE_FONT_FREETYPE
+	src/modules/font/freetype/Font.cpp
+	src/modules/font/freetype/Font.h
+	src/modules/font/freetype/TrueTypeRasterizer.cpp
+	src/modules/font/freetype/TrueTypeRasterizer.h
+	src/modules/font/freetype/wrap_Font.cpp
+	src/modules/font/freetype/wrap_Font.h
+)
+
+set(LOVE_SRC_MODULE_FONT
+	${LOVE_SRC_MODULE_FONT_ROOT}
+	${LOVE_SRC_MODULE_FONT_FREETYPE}
+)
+
+source_group("modules\\font" FILES ${LOVE_SRC_MODULE_FONT_ROOT})
+source_group("modules\\font\\freetype" FILES ${LOVE_SRC_MODULE_FONT_FREETYPE})
+
+#
+# love.graphics
+#
+
+set(LOVE_SRC_MODULE_GRAPHICS_ROOT
+	src/modules/graphics/Color.h
+	src/modules/graphics/Drawable.h
+	src/modules/graphics/Graphics.cpp
+	src/modules/graphics/Graphics.h
+	src/modules/graphics/Quad.cpp
+	src/modules/graphics/Quad.h
+	src/modules/graphics/Texture.cpp
+	src/modules/graphics/Texture.h
+	src/modules/graphics/Volatile.cpp
+	src/modules/graphics/Volatile.h
+)
+
+set(LOVE_SRC_MODULE_GRAPHICS_OPENGL
+	src/modules/graphics/opengl/Canvas.cpp
+	src/modules/graphics/opengl/Canvas.h
+	src/modules/graphics/opengl/Font.cpp
+	src/modules/graphics/opengl/Font.h
+	src/modules/graphics/opengl/GLee.c
+	src/modules/graphics/opengl/GLee.h
+	src/modules/graphics/opengl/Graphics.cpp
+	src/modules/graphics/opengl/Graphics.h
+	src/modules/graphics/opengl/Image.cpp
+	src/modules/graphics/opengl/Image.h
+	src/modules/graphics/opengl/Mesh.cpp
+	src/modules/graphics/opengl/Mesh.h
+	src/modules/graphics/opengl/OpenGL.cpp
+	src/modules/graphics/opengl/OpenGL.h
+	src/modules/graphics/opengl/ParticleSystem.cpp
+	src/modules/graphics/opengl/ParticleSystem.h
+	src/modules/graphics/opengl/Polyline.cpp
+	src/modules/graphics/opengl/Polyline.h
+	src/modules/graphics/opengl/Shader.cpp
+	src/modules/graphics/opengl/Shader.h
+	src/modules/graphics/opengl/SpriteBatch.cpp
+	src/modules/graphics/opengl/SpriteBatch.h
+	src/modules/graphics/opengl/Texture.h
+	src/modules/graphics/opengl/VertexBuffer.cpp
+	src/modules/graphics/opengl/VertexBuffer.h
+	src/modules/graphics/opengl/wrap_Canvas.cpp
+	src/modules/graphics/opengl/wrap_Canvas.h
+	src/modules/graphics/opengl/wrap_Font.cpp
+	src/modules/graphics/opengl/wrap_Font.h
+	src/modules/graphics/opengl/wrap_Graphics.cpp
+	src/modules/graphics/opengl/wrap_Graphics.h
+	src/modules/graphics/opengl/wrap_Image.cpp
+	src/modules/graphics/opengl/wrap_Image.h
+	src/modules/graphics/opengl/wrap_Mesh.cpp
+	src/modules/graphics/opengl/wrap_Mesh.h
+	src/modules/graphics/opengl/wrap_ParticleSystem.cpp
+	src/modules/graphics/opengl/wrap_ParticleSystem.h
+	src/modules/graphics/opengl/wrap_Quad.cpp
+	src/modules/graphics/opengl/wrap_Quad.h
+	src/modules/graphics/opengl/wrap_Shader.cpp
+	src/modules/graphics/opengl/wrap_Shader.h
+	src/modules/graphics/opengl/wrap_SpriteBatch.cpp
+	src/modules/graphics/opengl/wrap_SpriteBatch.h
+	src/modules/graphics/opengl/wrap_Texture.cpp
+	src/modules/graphics/opengl/wrap_Texture.h
+)
+
+set(LOVE_SRC_MODULE_GRAPHICS
+	${LOVE_SRC_MODULE_GRAPHICS_ROOT}
+	${LOVE_SRC_MODULE_GRAPHICS_OPENGL}
+)
+
+source_group("modules\\graphics" FILES ${LOVE_SRC_MODULE_GRAPHICS_ROOT})
+source_group("modules\\graphics\\opengl" FILES ${LOVE_SRC_MODULE_GRAPHICS_OPENGL})
+
+#
+# love.image
+#
+
+set(LOVE_SRC_MODULE_IMAGE_ROOT
+	src/modules/image/CompressedData.cpp
+	src/modules/image/CompressedData.h
+	src/modules/image/Image.h
+	src/modules/image/ImageData.cpp
+	src/modules/image/ImageData.h
+	src/modules/image/wrap_CompressedData.cpp
+	src/modules/image/wrap_CompressedData.h
+	src/modules/image/wrap_Image.cpp
+	src/modules/image/wrap_Image.h
+	src/modules/image/wrap_ImageData.cpp
+	src/modules/image/wrap_ImageData.h
+)
+
+set(LOVE_SRC_MODULE_IMAGE_MAGPIE
+	src/modules/image/magpie/CompressedData.cpp
+	src/modules/image/magpie/CompressedData.h
+	src/modules/image/magpie/ddsHandler.cpp
+	src/modules/image/magpie/ddsHandler.h
+	src/modules/image/magpie/DevilHandler.cpp
+	src/modules/image/magpie/DevilHandler.h
+	src/modules/image/magpie/FormatHandler.h
+	src/modules/image/magpie/Image.cpp
+	src/modules/image/magpie/Image.h
+	src/modules/image/magpie/ImageData.cpp
+	src/modules/image/magpie/ImageData.h
+)
+
+set(LOVE_SRC_MODULE_IMAGE
+	${LOVE_SRC_MODULE_IMAGE_ROOT}
+	${LOVE_SRC_MODULE_IMAGE_MAGPIE}
+)
+
+source_group("modules\\image" FILES ${LOVE_SRC_MODULE_IMAGE_ROOT})
+source_group("modules\\image\\magpie" FILES ${LOVE_SRC_MODULE_IMAGE_MAGPIE})
+
+#
+# love.joystick
+#
+
+set(LOVE_SRC_MODULE_JOYSTICK_ROOT
+	src/modules/joystick/Joystick.cpp
+	src/modules/joystick/Joystick.h
+	src/modules/joystick/JoystickModule.h
+)
+
+set(LOVE_SRC_MODULE_JOYSTICK_SDL
+	src/modules/joystick/sdl/Joystick.cpp
+	src/modules/joystick/sdl/Joystick.h
+	src/modules/joystick/sdl/JoystickModule.cpp
+	src/modules/joystick/sdl/JoystickModule.h
+	src/modules/joystick/sdl/wrap_Joystick.cpp
+	src/modules/joystick/sdl/wrap_Joystick.h
+	src/modules/joystick/sdl/wrap_JoystickModule.cpp
+	src/modules/joystick/sdl/wrap_JoystickModule.h
+)
+
+set(LOVE_SRC_MODULE_JOYSTICK
+	${LOVE_SRC_MODULE_JOYSTICK_ROOT}
+	${LOVE_SRC_MODULE_JOYSTICK_SDL}
+)
+
+source_group("modules\\joystick" FILES ${LOVE_SRC_MODULE_JOYSTICK_ROOT})
+source_group("modules\\joystick\\sdl" FILES ${LOVE_SRC_MODULE_JOYSTICK_SDL})
+
+#
+# love.keyboard
+#
+
+set(LOVE_SRC_MODULE_KEYBOARD_ROOT
+	src/modules/keyboard/Keyboard.cpp
+	src/modules/keyboard/Keyboard.h
+	src/modules/keyboard/wrap_Keyboard.cpp
+	src/modules/keyboard/wrap_Keyboard.h
+)
+
+set(LOVE_SRC_MODULE_KEYBOARD_SDL
+	src/modules/keyboard/sdl/Keyboard.cpp
+	src/modules/keyboard/sdl/Keyboard.h
+)
+
+set(LOVE_SRC_MODULE_KEYBOARD
+	${LOVE_SRC_MODULE_KEYBOARD_ROOT}
+	${LOVE_SRC_MODULE_KEYBOARD_SDL}
+)
+
+source_group("modules\\keyboard" FILES ${LOVE_SRC_MODULE_KEYBOARD_ROOT})
+source_group("modules\\keyboard\\sdl" FILES ${LOVE_SRC_MODULE_KEYBOARD_SDL})
+
+#
+# love.math
+#
+
+set(LOVE_SRC_MODULE_MATH
+	src/modules/math/BezierCurve.cpp
+	src/modules/math/BezierCurve.h
+	src/modules/math/MathModule.cpp
+	src/modules/math/MathModule.h
+	src/modules/math/RandomGenerator.cpp
+	src/modules/math/RandomGenerator.h
+	src/modules/math/wrap_BezierCurve.cpp
+	src/modules/math/wrap_BezierCurve.h
+	src/modules/math/wrap_Math.cpp
+	src/modules/math/wrap_Math.h
+	src/modules/math/wrap_RandomGenerator.cpp
+	src/modules/math/wrap_RandomGenerator.h
+)
+
+source_group("modules\\math" FILES ${LOVE_SRC_MODULE_MATH})
+
+#
+# love (module)
+#
+set(LOVE_SRC_MODULE_LOVE
+	src/modules/love/love.cpp
+	src/modules/love/love.h
+)
+
+source_group("modules\\love" FILES ${LOVE_SRC_MODULE_LOVE})
+
+#
+# love.mouse
+#
+
+set(LOVE_SRC_MODULE_MOUSE_ROOT
+	src/modules/mouse/Cursor.cpp
+	src/modules/mouse/Cursor.h
+	src/modules/mouse/Mouse.cpp
+	src/modules/mouse/Mouse.h
+	src/modules/mouse/wrap_Cursor.cpp
+	src/modules/mouse/wrap_Cursor.h
+	src/modules/mouse/wrap_Mouse.cpp
+	src/modules/mouse/wrap_Mouse.h
+)
+
+set(LOVE_SRC_MODULE_MOUSE_SDL
+	src/modules/mouse/sdl/Cursor.cpp
+	src/modules/mouse/sdl/Cursor.h
+	src/modules/mouse/sdl/Mouse.cpp
+	src/modules/mouse/sdl/Mouse.h
+)
+
+set(LOVE_SRC_MODULE_MOUSE
+	${LOVE_SRC_MODULE_MOUSE_ROOT}
+	${LOVE_SRC_MODULE_MOUSE_SDL}
+)
+
+source_group("modules\\mouse" FILES ${LOVE_SRC_MODULE_MOUSE_ROOT})
+source_group("modules\\mouse\\sdl" FILES ${LOVE_SRC_MODULE_MOUSE_SDL})
+
+#
+# love.physics
+#
+
+set(LOVE_SRC_MODULE_PHYSICS_ROOT
+	src/modules/physics/Body.cpp
+	src/modules/physics/Body.h
+	src/modules/physics/Joint.cpp
+	src/modules/physics/Joint.h
+	src/modules/physics/Shape.cpp
+	src/modules/physics/Shape.h
+)
+
+set(LOVE_SRC_MODULE_PHYSICS_BOX2D
+	src/modules/physics/box2d/Body.cpp
+	src/modules/physics/box2d/Body.h
+	src/modules/physics/box2d/ChainShape.cpp
+	src/modules/physics/box2d/ChainShape.h
+	src/modules/physics/box2d/CircleShape.cpp
+	src/modules/physics/box2d/CircleShape.h
+	src/modules/physics/box2d/Contact.cpp
+	src/modules/physics/box2d/Contact.h
+	src/modules/physics/box2d/DistanceJoint.cpp
+	src/modules/physics/box2d/DistanceJoint.h
+	src/modules/physics/box2d/EdgeShape.cpp
+	src/modules/physics/box2d/EdgeShape.h
+	src/modules/physics/box2d/Fixture.cpp
+	src/modules/physics/box2d/Fixture.h
+	src/modules/physics/box2d/FrictionJoint.cpp
+	src/modules/physics/box2d/FrictionJoint.h
+	src/modules/physics/box2d/GearJoint.cpp
+	src/modules/physics/box2d/GearJoint.h
+	src/modules/physics/box2d/Joint.cpp
+	src/modules/physics/box2d/Joint.h
+	src/modules/physics/box2d/MotorJoint.cpp
+	src/modules/physics/box2d/MotorJoint.h
+	src/modules/physics/box2d/MouseJoint.cpp
+	src/modules/physics/box2d/MouseJoint.h
+	src/modules/physics/box2d/Physics.cpp
+	src/modules/physics/box2d/Physics.h
+	src/modules/physics/box2d/PolygonShape.cpp
+	src/modules/physics/box2d/PolygonShape.h
+	src/modules/physics/box2d/PrismaticJoint.cpp
+	src/modules/physics/box2d/PrismaticJoint.h
+	src/modules/physics/box2d/PulleyJoint.cpp
+	src/modules/physics/box2d/PulleyJoint.h
+	src/modules/physics/box2d/RevoluteJoint.cpp
+	src/modules/physics/box2d/RevoluteJoint.h
+	src/modules/physics/box2d/RopeJoint.cpp
+	src/modules/physics/box2d/RopeJoint.h
+	src/modules/physics/box2d/Shape.cpp
+	src/modules/physics/box2d/Shape.h
+	src/modules/physics/box2d/WeldJoint.cpp
+	src/modules/physics/box2d/WeldJoint.h
+	src/modules/physics/box2d/WheelJoint.cpp
+	src/modules/physics/box2d/WheelJoint.h
+	src/modules/physics/box2d/World.cpp
+	src/modules/physics/box2d/World.h
+	src/modules/physics/box2d/wrap_Body.cpp
+	src/modules/physics/box2d/wrap_Body.h
+	src/modules/physics/box2d/wrap_ChainShape.cpp
+	src/modules/physics/box2d/wrap_ChainShape.h
+	src/modules/physics/box2d/wrap_CircleShape.cpp
+	src/modules/physics/box2d/wrap_CircleShape.h
+	src/modules/physics/box2d/wrap_Contact.cpp
+	src/modules/physics/box2d/wrap_Contact.h
+	src/modules/physics/box2d/wrap_DistanceJoint.cpp
+	src/modules/physics/box2d/wrap_DistanceJoint.h
+	src/modules/physics/box2d/wrap_EdgeShape.cpp
+	src/modules/physics/box2d/wrap_EdgeShape.h
+	src/modules/physics/box2d/wrap_Fixture.cpp
+	src/modules/physics/box2d/wrap_Fixture.h
+	src/modules/physics/box2d/wrap_FrictionJoint.cpp
+	src/modules/physics/box2d/wrap_FrictionJoint.h
+	src/modules/physics/box2d/wrap_GearJoint.cpp
+	src/modules/physics/box2d/wrap_GearJoint.h
+	src/modules/physics/box2d/wrap_Joint.cpp
+	src/modules/physics/box2d/wrap_Joint.h
+	src/modules/physics/box2d/wrap_MotorJoint.cpp
+	src/modules/physics/box2d/wrap_MotorJoint.h
+	src/modules/physics/box2d/wrap_MouseJoint.cpp
+	src/modules/physics/box2d/wrap_MouseJoint.h
+	src/modules/physics/box2d/wrap_Physics.cpp
+	src/modules/physics/box2d/wrap_Physics.h
+	src/modules/physics/box2d/wrap_PolygonShape.cpp
+	src/modules/physics/box2d/wrap_PolygonShape.h
+	src/modules/physics/box2d/wrap_PrismaticJoint.cpp
+	src/modules/physics/box2d/wrap_PrismaticJoint.h
+	src/modules/physics/box2d/wrap_PulleyJoint.cpp
+	src/modules/physics/box2d/wrap_PulleyJoint.h
+	src/modules/physics/box2d/wrap_RevoluteJoint.cpp
+	src/modules/physics/box2d/wrap_RevoluteJoint.h
+	src/modules/physics/box2d/wrap_RopeJoint.cpp
+	src/modules/physics/box2d/wrap_RopeJoint.h
+	src/modules/physics/box2d/wrap_Shape.cpp
+	src/modules/physics/box2d/wrap_Shape.h
+	src/modules/physics/box2d/wrap_WeldJoint.cpp
+	src/modules/physics/box2d/wrap_WeldJoint.h
+	src/modules/physics/box2d/wrap_WheelJoint.cpp
+	src/modules/physics/box2d/wrap_WheelJoint.h
+	src/modules/physics/box2d/wrap_World.cpp
+	src/modules/physics/box2d/wrap_World.h
+)
+
+set(LOVE_SRC_MODULE_PHYSICS
+	${LOVE_SRC_MODULE_PHYSICS_ROOT}
+	${LOVE_SRC_MODULE_PHYSICS_BOX2D}
+)
+
+source_group("modules\\physics" FILES ${LOVE_SRC_MODULE_PHYSICS_ROOT})
+source_group("modules\\physics\\box2d" FILES ${LOVE_SRC_MODULE_PHYSICS_BOX2D})
+
+#
+# love.sound
+#
+
+set(LOVE_SRC_MODULE_SOUND_ROOT
+	src/modules/sound/Decoder.h
+	src/modules/sound/Sound.cpp
+	src/modules/sound/Sound.h
+	src/modules/sound/SoundData.cpp
+	src/modules/sound/SoundData.h
+	src/modules/sound/wrap_Decoder.cpp
+	src/modules/sound/wrap_Decoder.h
+	src/modules/sound/wrap_Sound.cpp
+	src/modules/sound/wrap_Sound.h
+	src/modules/sound/wrap_SoundData.cpp
+	src/modules/sound/wrap_SoundData.h
+)
+
+set(LOVE_SRC_MODULE_SOUND_LULLABY
+	src/modules/sound/lullaby/Decoder.cpp
+	src/modules/sound/lullaby/Decoder.h
+	src/modules/sound/lullaby/FLACDecoder.cpp
+	src/modules/sound/lullaby/FLACDecoder.h
+	src/modules/sound/lullaby/GmeDecoder.cpp
+	src/modules/sound/lullaby/GmeDecoder.h
+	src/modules/sound/lullaby/ModPlugDecoder.cpp
+	src/modules/sound/lullaby/ModPlugDecoder.h
+	src/modules/sound/lullaby/Mpg123Decoder.cpp
+	src/modules/sound/lullaby/Mpg123Decoder.h
+	src/modules/sound/lullaby/Sound.cpp
+	src/modules/sound/lullaby/Sound.h
+	src/modules/sound/lullaby/VorbisDecoder.cpp
+	src/modules/sound/lullaby/VorbisDecoder.h
+	src/modules/sound/lullaby/WaveDecoder.cpp
+	src/modules/sound/lullaby/WaveDecoder.h
+)
+
+set(LOVE_SRC_MODULE_SOUND
+	${LOVE_SRC_MODULE_SOUND_ROOT}
+	${LOVE_SRC_MODULE_SOUND_LULLABY}
+)
+
+source_group("modules\\sound" FILES ${LOVE_SRC_MODULE_SOUND_ROOT})
+source_group("modules\\sound\\lullaby" FILES ${LOVE_SRC_MODULE_SOUND_LULLABY})
+
+#
+# love.system
+#
+
+set(LOVE_SRC_MODULE_SYSTEM_ROOT
+	src/modules/system/System.cpp
+	src/modules/system/System.h
+	src/modules/system/wrap_System.cpp
+	src/modules/system/wrap_System.h
+)
+
+set(LOVE_SRC_MODULE_SYSTEM_SDL
+	src/modules/system/sdl/System.cpp
+	src/modules/system/sdl/System.h
+)
+
+set(LOVE_SRC_MODULE_SYSTEM
+	${LOVE_SRC_MODULE_SYSTEM_ROOT}
+	${LOVE_SRC_MODULE_SYSTEM_SDL}
+)
+
+source_group("modules\\system" FILES ${LOVE_SRC_MODULE_SYSTEM_ROOT})
+source_group("modules\\system\\sdl" FILES ${LOVE_SRC_MODULE_SYSTEM_SDL})
+
+#
+# love.thread
+#
+
+set(LOVE_SRC_MODULE_THREAD_ROOT
+	src/modules/thread/Channel.cpp
+	src/modules/thread/Channel.h
+	src/modules/thread/LuaThread.cpp
+	src/modules/thread/LuaThread.h
+	src/modules/thread/Thread.h
+	src/modules/thread/ThreadModule.cpp
+	src/modules/thread/ThreadModule.h
+	src/modules/thread/threads.cpp
+	src/modules/thread/threads.h
+	src/modules/thread/wrap_Channel.cpp
+	src/modules/thread/wrap_Channel.h
+	src/modules/thread/wrap_LuaThread.cpp
+	src/modules/thread/wrap_LuaThread.h
+	src/modules/thread/wrap_ThreadModule.cpp
+	src/modules/thread/wrap_ThreadModule.h
+)
+
+set(LOVE_SRC_MODULE_THREAD_SDL
+	src/modules/thread/sdl/Thread.cpp
+	src/modules/thread/sdl/Thread.h
+	src/modules/thread/sdl/threads.cpp
+	src/modules/thread/sdl/threads.h
+)
+
+set(LOVE_SRC_MODULE_THREAD
+	${LOVE_SRC_MODULE_THREAD_ROOT}
+	${LOVE_SRC_MODULE_THREAD_SDL}
+)
+
+source_group("modules\\thread" FILES ${LOVE_SRC_MODULE_THREAD_ROOT})
+source_group("modules\\thread\\sdl" FILES ${LOVE_SRC_MODULE_THREAD_SDL})
+
+#
+# love.timer
+#
+
+set(LOVE_SRC_MODULE_TIMER_ROOT
+	src/modules/timer/Timer.h
+	src/modules/timer/wrap_Timer.cpp
+	src/modules/timer/wrap_Timer.h
+)
+
+set(LOVE_SRC_MODULE_TIMER_SDL
+	src/modules/timer/sdl/Timer.cpp
+	src/modules/timer/sdl/Timer.h
+)
+
+set(LOVE_SRC_MODULE_TIMER
+	${LOVE_SRC_MODULE_TIMER_ROOT}
+	${LOVE_SRC_MODULE_TIMER_SDL}
+)
+
+source_group("modules\\timer" FILES ${LOVE_SRC_MODULE_TIMER_ROOT})
+source_group("modules\\timer\\sdl" FILES ${LOVE_SRC_MODULE_TIMER_SDL})
+
+#
+# love.window
+#
+
+set(LOVE_SRC_MODULE_WINDOW_ROOT
+	src/modules/window/Window.cpp
+	src/modules/window/Window.h
+	src/modules/window/wrap_Window.cpp
+	src/modules/window/wrap_Window.h
+)
+
+set(LOVE_SRC_MODULE_WINDOW_SDL
+	src/modules/window/sdl/Window.cpp
+	src/modules/window/sdl/Window.h
+)
+
+set(LOVE_SRC_MODULE_WINDOW
+	${LOVE_SRC_MODULE_WINDOW_ROOT}
+	${LOVE_SRC_MODULE_WINDOW_SDL}
+)
+
+source_group("modules\\window" FILES ${LOVE_SRC_MODULE_WINDOW_ROOT})
+source_group("modules\\window\\sdl" FILES ${LOVE_SRC_MODULE_WINDOW_SDL})
+
+###################################
+# Third-party libraries
+###################################
+
+#
+# Box2D
+#
+
+set(LOVE_SRC_3P_BOX2D_ROOT
+	src/libraries/Box2D/Box2D.h
+)
+
+set(LOVE_SRC_3P_BOX2D_COLLISION
+	src/libraries/Box2D/Collision/b2BroadPhase.cpp
+	src/libraries/Box2D/Collision/b2BroadPhase.h
+	src/libraries/Box2D/Collision/b2CollideCircle.cpp
+	src/libraries/Box2D/Collision/b2CollideEdge.cpp
+	src/libraries/Box2D/Collision/b2CollidePolygon.cpp
+	src/libraries/Box2D/Collision/b2Collision.cpp
+	src/libraries/Box2D/Collision/b2Collision.h
+	src/libraries/Box2D/Collision/b2Distance.cpp
+	src/libraries/Box2D/Collision/b2Distance.h
+	src/libraries/Box2D/Collision/b2DynamicTree.cpp
+	src/libraries/Box2D/Collision/b2DynamicTree.h
+	src/libraries/Box2D/Collision/b2TimeOfImpact.cpp
+	src/libraries/Box2D/Collision/b2TimeOfImpact.h
+)
+
+set(LOVE_SRC_3P_BOX2D_COLLISION_SHAPES
+	src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp
+	src/libraries/Box2D/Collision/Shapes/b2ChainShape.h
+	src/libraries/Box2D/Collision/Shapes/b2CircleShape.cpp
+	src/libraries/Box2D/Collision/Shapes/b2CircleShape.h
+	src/libraries/Box2D/Collision/Shapes/b2EdgeShape.cpp
+	src/libraries/Box2D/Collision/Shapes/b2EdgeShape.h
+	src/libraries/Box2D/Collision/Shapes/b2PolygonShape.cpp
+	src/libraries/Box2D/Collision/Shapes/b2PolygonShape.h
+	src/libraries/Box2D/Collision/Shapes/b2Shape.h
+)
+
+set(LOVE_SRC_3P_BOX2D_COMMON
+	src/libraries/Box2D/Common/b2BlockAllocator.cpp
+	src/libraries/Box2D/Common/b2BlockAllocator.h
+	src/libraries/Box2D/Common/b2Draw.cpp
+	src/libraries/Box2D/Common/b2Draw.h
+	src/libraries/Box2D/Common/b2GrowableStack.h
+	src/libraries/Box2D/Common/b2Math.cpp
+	src/libraries/Box2D/Common/b2Math.h
+	src/libraries/Box2D/Common/b2Settings.cpp
+	src/libraries/Box2D/Common/b2Settings.h
+	src/libraries/Box2D/Common/b2StackAllocator.cpp
+	src/libraries/Box2D/Common/b2StackAllocator.h
+	src/libraries/Box2D/Common/b2Timer.cpp
+	src/libraries/Box2D/Common/b2Timer.h
+)
+
+set(LOVE_SRC_3P_BOX2D_DYNAMICS
+	src/libraries/Box2D/Dynamics/b2Body.cpp
+	src/libraries/Box2D/Dynamics/b2Body.h
+	src/libraries/Box2D/Dynamics/b2ContactManager.cpp
+	src/libraries/Box2D/Dynamics/b2ContactManager.h
+	src/libraries/Box2D/Dynamics/b2Fixture.cpp
+	src/libraries/Box2D/Dynamics/b2Fixture.h
+	src/libraries/Box2D/Dynamics/b2Island.cpp
+	src/libraries/Box2D/Dynamics/b2Island.h
+	src/libraries/Box2D/Dynamics/b2TimeStep.h
+	src/libraries/Box2D/Dynamics/b2World.cpp
+	src/libraries/Box2D/Dynamics/b2World.h
+	src/libraries/Box2D/Dynamics/b2WorldCallbacks.cpp
+	src/libraries/Box2D/Dynamics/b2WorldCallbacks.h
+)
+
+set(LOVE_SRC_3P_BOX2D_DYNAMICS_CONTACTS
+	src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2ChainAndCircleContact.h
+	src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2ChainAndPolygonContact.h
+	src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2CircleContact.h
+	src/libraries/Box2D/Dynamics/Contacts/b2Contact.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2Contact.h
+	src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2ContactSolver.h
+	src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndCircleContact.h
+	src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2EdgeAndPolygonContact.h
+	src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h
+	src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.cpp
+	src/libraries/Box2D/Dynamics/Contacts/b2PolygonContact.h
+)
+
+set(LOVE_SRC_3P_BOX2D_DYNAMICS_JOINTS
+	src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2DistanceJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2FrictionJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2GearJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2GearJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2Joint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2Joint.h
+	src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2MotorJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2MouseJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2PrismaticJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2PulleyJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2RevoluteJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2RopeJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2WeldJoint.h
+	src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.cpp
+	src/libraries/Box2D/Dynamics/Joints/b2WheelJoint.h
+)
+
+set(LOVE_SRC_3P_BOX2D_ROPE
+	src/libraries/Box2D/Rope/b2Rope.cpp
+	src/libraries/Box2D/Rope/b2Rope.h
+)
+
+set(LOVE_SRC_3P_BOX2D
+	${LOVE_SRC_3P_BOX2D_ROOT}
+	${LOVE_SRC_3P_BOX2D_COLLISION}
+	${LOVE_SRC_3P_BOX2D_COLLISION_SHAPES}
+	${LOVE_SRC_3P_BOX2D_COMMON}
+	${LOVE_SRC_3P_BOX2D_DYNAMICS}
+	${LOVE_SRC_3P_BOX2D_DYNAMICS_CONTACTS}
+	${LOVE_SRC_3P_BOX2D_DYNAMICS_JOINTS}
+	${LOVE_SRC_3P_BOX2D_ROPE}
+)
+
+add_library(love_3p_box2d ${LOVE_SRC_3P_BOX2D})
+
+#
+# ddsparse
+#
+
+set(LOVE_SRC_3P_DDSPARSE
+	src/libraries/ddsparse/ddsinfo.h
+	src/libraries/ddsparse/ddsparse.cpp
+	src/libraries/ddsparse/ddsparse.h
+)
+
+add_library(love_3p_ddsparse ${LOVE_SRC_3P_DDSPARSE})
+
+#
+# enet
+#
+
+set(LOVE_SRC_3P_ENET_ROOT
+	src/libraries/enet/enet.cpp
+	src/libraries/enet/lua-enet.h
+)
+
+set(LOVE_SRC_3P_ENET_LIBENET
+	src/libraries/enet/libenet/callbacks.c
+	src/libraries/enet/libenet/compress.c
+	src/libraries/enet/libenet/host.c
+	src/libraries/enet/libenet/list.c
+	src/libraries/enet/libenet/packet.c
+	src/libraries/enet/libenet/peer.c
+	src/libraries/enet/libenet/protocol.c
+	src/libraries/enet/libenet/unix.c
+	src/libraries/enet/libenet/win32.c
+)
+
+set(LOVE_SRC_3P_ENET_LIBENET_INCLUDE_ENET
+	src/libraries/enet/libenet/include/enet/enet.h
+	src/libraries/enet/libenet/include/enet/list.h
+	src/libraries/enet/libenet/include/enet/protocol.h
+	src/libraries/enet/libenet/include/enet/time.h
+	src/libraries/enet/libenet/include/enet/types.h
+	src/libraries/enet/libenet/include/enet/unix.h
+	src/libraries/enet/libenet/include/enet/utility.h
+	src/libraries/enet/libenet/include/enet/win32.h
+)
+
+set(LOVE_SRC_3P_ENET
+	${LOVE_SRC_3P_ENET_ROOT}
+	${LOVE_SRC_3P_ENET_LIBENET}
+	${LOVE_SRC_3P_ENET_LIBENET_INCLUDE_ENET}
+)
+
+add_library(love_3p_enet ${LOVE_SRC_3P_ENET})
+target_link_libraries(love_3p_enet ${MEGA_LUA})
+target_include_directories(love_3p_enet PUBLIC src/libraries/enet/libenet/include)
+
+#
+# luasocket
+#
+
+set(LOVE_SRC_3P_LUASOCKET_ROOT
+	src/libraries/luasocket/luasocket.cpp
+	src/libraries/luasocket/luasocket.h
+)
+
+set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET
+	src/libraries/luasocket/libluasocket/auxiliar.c
+	src/libraries/luasocket/libluasocket/auxiliar.h
+	src/libraries/luasocket/libluasocket/buffer.c
+	src/libraries/luasocket/libluasocket/buffer.h
+	src/libraries/luasocket/libluasocket/except.c
+	src/libraries/luasocket/libluasocket/except.h
+	src/libraries/luasocket/libluasocket/ftp.lua.h
+	src/libraries/luasocket/libluasocket/http.lua.h
+	src/libraries/luasocket/libluasocket/inet.c
+	src/libraries/luasocket/libluasocket/inet.h
+	src/libraries/luasocket/libluasocket/io.c
+	src/libraries/luasocket/libluasocket/io.h
+	src/libraries/luasocket/libluasocket/ltn12.lua.h
+	src/libraries/luasocket/libluasocket/lua.h
+	src/libraries/luasocket/libluasocket/luasocket.c
+	src/libraries/luasocket/libluasocket/luasocket.h
+	src/libraries/luasocket/libluasocket/mime.c
+	src/libraries/luasocket/libluasocket/mime.h
+	src/libraries/luasocket/libluasocket/mime.lua.h
+	src/libraries/luasocket/libluasocket/options.c
+	src/libraries/luasocket/libluasocket/options.h
+	src/libraries/luasocket/libluasocket/select.c
+	src/libraries/luasocket/libluasocket/select.h
+	src/libraries/luasocket/libluasocket/smtp.lua.h
+	src/libraries/luasocket/libluasocket/socket.h
+	src/libraries/luasocket/libluasocket/socket.lua.h
+	src/libraries/luasocket/libluasocket/tcp.c
+	src/libraries/luasocket/libluasocket/tcp.h
+	src/libraries/luasocket/libluasocket/timeout.c
+	src/libraries/luasocket/libluasocket/timeout.h
+	src/libraries/luasocket/libluasocket/tp.lua.h
+	src/libraries/luasocket/libluasocket/udp.c
+	src/libraries/luasocket/libluasocket/udp.h
+	src/libraries/luasocket/libluasocket/url.lua.h
+)
+
+if(MSVC)
+	set(LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET
+		${LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET}
+		src/libraries/luasocket/libluasocket/wsocket.c
+		src/libraries/luasocket/libluasocket/wsocket.h
+	)
+endif()
+
+set(LOVE_SRC_3P_LUASOCKET
+	${LOVE_SRC_3P_LUASOCKET_ROOT}
+	${LOVE_SRC_3P_LUASOCKET_LIBLUASOCKET}
+)
+
+add_library(love_3p_luasocket ${LOVE_SRC_3P_LUASOCKET})
+target_link_libraries(love_3p_luasocket ${MEGA_LUA})
+
+#
+# noise1234
+#
+
+set(LOVE_SRC_3P_NOISE1234
+	src/libraries/noise1234/simplexnoise1234.cpp
+	src/libraries/noise1234/simplexnoise1234.h
+)
+
+add_library(love_3p_noise1234 ${LOVE_SRC_3P_NOISE1234})
+
+#
+# utf8
+#
+
+set(LOVE_SRC_3P_UTF8_ROOT src/libraries/utf8/utf8.h)
+
+set(LOVE_SRC_3P_UTF8_UTF8
+	src/libraries/utf8/utf8/checked.h
+	src/libraries/utf8/utf8/core.h
+	src/libraries/utf8/utf8/unchecked.h
+)
+
+set(LOVE_SRC_3P_UTF8
+	${LOVE_SRC_3P_UTF8_ROOT}
+	${LOVE_SRC_3P_UTF8_UTF8}
+)
+
+# This library is all headers ... so there is no need to
+# add_library() here.
+
+#
+# Wuff
+#
+
+set(LOVE_SRC_3P_WUFF
+	src/libraries/Wuff/wuff.c
+	src/libraries/Wuff/wuff.h
+	src/libraries/Wuff/wuff_config.h
+	src/libraries/Wuff/wuff_convert.c
+	src/libraries/Wuff/wuff_convert.h
+	src/libraries/Wuff/wuff_internal.c
+	src/libraries/Wuff/wuff_internal.h
+	src/libraries/Wuff/wuff_memory.c
+)
+
+add_library(love_3p_wuff ${LOVE_SRC_3P_WUFF})
+
+set(LOVE_3P
+	love_3p_box2d
+	love_3p_ddsparse
+	love_3p_enet
+	love_3p_luasocket
+	love_3p_noise1234
+	love_3p_wuff
+)
+
+disable_warnings(love_3p_box2d love_3p_enet love_3p_luasocket)
+
+#
+# liblove
+#
+set(LOVE_LIB_SRC
+	${LOVE_SRC_COMMON}
+	# Modules
+	${LOVE_SRC_MODULE_AUDIO}
+	${LOVE_SRC_MODULE_EVENT}
+	${LOVE_SRC_MODULE_FILESYSTEM}
+	${LOVE_SRC_MODULE_FONT}
+	${LOVE_SRC_MODULE_GRAPHICS}
+	${LOVE_SRC_MODULE_IMAGE}
+	${LOVE_SRC_MODULE_JOYSTICK}
+	${LOVE_SRC_MODULE_KEYBOARD}
+	${LOVE_SRC_MODULE_LOVE}
+	${LOVE_SRC_MODULE_MATH}
+	${LOVE_SRC_MODULE_MOUSE}
+	${LOVE_SRC_MODULE_PHYSICS}
+	${LOVE_SRC_MODULE_SOUND}
+	${LOVE_SRC_MODULE_SYSTEM}
+	${LOVE_SRC_MODULE_THREAD}
+	${LOVE_SRC_MODULE_TIMER}
+	${LOVE_SRC_MODULE_WINDOW}
+)
+
+include_directories(
+	src
+	src/libraries
+	src/modules
+	${MEGA_EXTRA_INCLUDE}
+)
+
+# SDL2 links with some DirectX libraries, and we apparently also
+# pull those libraries in for linkage because we link with SDL2.
+link_directories(${SDL_LINK_DIR})
+
+set(LOVE_MEGA_3P
+	${MEGA_DEVIL}
+	${MEGA_FREETYPE}
+	${MEGA_JASPER}
+	${MEGA_JPEG}
+	${MEGA_LIBOGG}
+	${MEGA_LIBPNG}
+	${MEGA_LIBVORBISFILE}
+	${MEGA_LIBVORBIS}
+	${MEGA_LUA}
+	${MEGA_MODPLUG}
+	${MEGA_MPEG123}
+	${MEGA_OPENAL}
+	${MEGA_PHYSFS}
+	${MEGA_SDL2MAIN}
+	${MEGA_SDL2}
+	${MEGA_TIFF}
+	${MEGA_ZLIB}
+)
+
+set(LOVE_LINK_LIBRARIES
+	${OPENGL_gl_LIBRARY}
+	${LOVE_MEGA_3P}
+)
+
+set(LOVE_RC)
+
+if(MSVC)
+	set(LOVE_LINK_LIBRARIES ${LOVE_LINK_LIBRARIES}
+		ws2_32.lib
+		winmm.lib
+	)
+
+	set(LOVE_RC
+		platform/msvc2010/love.rc
+		platform/msvc2010/love.ico
+	)
+endif()
+
+add_library(${LOVE_LIB_NAME} SHARED ${LOVE_LIB_SRC} ${LOVE_RC})
+target_link_libraries(liblove ${LOVE_LINK_LIBRARIES} ${LOVE_3P})
+
+if(MEGA_EXTRA_DEPENDECIES)
+	add_dependencies(${LOVE_LIB_NAME} ${MEGA_EXTRA_DEPENDECIES})
+endif()
+
+if(MSVC)
+	set_target_properties(${LOVE_LIB_NAME} PROPERTIES RELEASE_OUTPUT_NAME "love" PDB_NAME "liblove")
+	set_target_properties(${LOVE_LIB_NAME} PROPERTIES DEBUG_OUTPUT_NAME "love" PDB_NAME "liblove")
+endif()
+
+#
+# love (executable)
+#
+add_executable(${LOVE_EXE_NAME} WIN32 src/love.cpp ${LOVE_RC})
+target_link_libraries(love liblove)
+
+# Add post build steps to move the DLLs next to the binary. Otherwise
+# running/debugging the binary will not work from inside VS.
+add_move_dll(love ${MEGA_MPEG123})
+add_move_dll(love ${MEGA_SDL2})
+add_move_dll(love ${MEGA_OPENAL})
+add_move_dll(love ${MEGA_DEVIL})
+
+if(LOVE_JIT)
+	add_move_file(love ${MEGA_LUAJIT_DLL})
+else()
+	add_move_dll(love ${MEGA_LUA51})
+endif()
+
+###################################
+# Version
+###################################
+
+# Extract version.h contents.
+file(READ ${CMAKE_CURRENT_SOURCE_DIR}/src/common/version.h LOVE_VERSION_FILE_CONTENTS)
+
+# Extract one of LOVE_VERSION_MAJOR/MINOR/REV.
+function(match_version ARG_STRING OUT_VAR)
+	string(REGEX MATCH "VERSION_${ARG_STRING} = ([0-9]+);" TMP_VER "${LOVE_VERSION_FILE_CONTENTS}")
+	string(REGEX MATCH "[0-9]+" TMP_VER "${TMP_VER}")
+	set(${OUT_VAR} ${TMP_VER} PARENT_SCOPE)
+endfunction()
+
+match_version("MAJOR" LOVE_VERSION_MAJOR)
+match_version("MINOR" LOVE_VERSION_MINOR)
+match_version("REV" LOVE_VERSION_REV)
+
+set(LOVE_VERSION_STR "${LOVE_VERSION_MAJOR}.${LOVE_VERSION_MINOR}.${LOVE_VERSION_REV}")
+
+message(STATUS "Version: ${LOVE_VERSION_STR}")
+
+###################################
+# CPack
+###################################
+install(TARGETS love ${LOVE_LIB_NAME} RUNTIME DESTINATION .)
+
+# Extra DLLs.
+if(MEGA_EXTRA_DLLS)
+	foreach(DLL ${MEGA_EXTRA_DLLS})
+		get_filename_component(DLL_NAME ${DLL} NAME)
+		message(STATUS "Extra DLL: ${DLL_NAME}")
+	endforeach()
+	install(FILES ${MEGA_EXTRA_DLLS} DESTINATION .)
+endif()
+
+# Dynamic runtime libs.
+if(MEGA_MSVC_DLLS)
+	foreach(DLL ${MEGA_MSVC_DLLS})
+		get_filename_component(DLL_NAME ${DLL} NAME)
+		message(STATUS "Runtime DLL: ${DLL_NAME}")
+	endforeach()
+	install(FILES ${MEGA_MSVC_DLLS} DESTINATION .)
+endif()
+
+# Copy a text file from CMAKE_CURRENT_SOURCE_DIR to CMAKE_CURRENT_BINARY_DIR.
+# On Windows, this function will convert line endings to CR,LF.
+function(copy_text_file ARG_FILE_IN ARG_FILE_OUT)
+	file(READ ${CMAKE_CURRENT_SOURCE_DIR}/${ARG_FILE_IN} TMP_TXT_CONTENTS)
+	file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/${ARG_FILE_OUT} ${TMP_TXT_CONTENTS})
+endfunction()
+
+# Text files.
+copy_text_file(readme.md readme.txt)
+copy_text_file(license.txt license.txt)
+copy_text_file(changes.txt changes.txt)
+
+install(FILES
+		${CMAKE_CURRENT_BINARY_DIR}/changes.txt
+		${CMAKE_CURRENT_BINARY_DIR}/license.txt
+		${CMAKE_CURRENT_BINARY_DIR}/readme.txt
+		DESTINATION .)
+
+# Icons
+install(FILES
+		${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis/love.ico
+		${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis/game.ico
+		DESTINATION .)
+
+set(CPACK_GENERATOR ZIP NSIS)
+set(CPACK_PACKAGE_NAME "love")
+set(CPACK_PACKAGE_VENDOR "love2d.org")
+set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "LOVE -- It's awesome")
+set(CPACK_PACKAGE_VERSION "${LOVE_VERSION_STR}")
+set(CPACK_PACKAGE_VERSION_MAJOR "${LOVE_VERSION_MAJOR}")
+set(CPACK_PACKAGE_VERSION_MINOR "${LOVE_VERSION_MINOR}")
+set(CPACK_PACKAGE_VERSION_PATCH "${LOVE_VERSION_REV}")
+set(CPACK_PACKAGE_INSTALL_DIRECTORY "LOVE")
+set(CPACK_PACKAGE_EXECUTABLES "love;LOVE")
+set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/readme.md")
+set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/license.txt")
+
+set(CPACK_NSIS_EXECUTABLES_DIRECTORY .)
+set(CPACK_NSIS_PACKAGE_NAME "LOVE")
+set(CPACK_NSIS_DISPLAY_NAME "LÖVE ${LOVE_VERSION_STR}")
+set(CPACK_NSIS_MODIFY_PATH OFF)
+
+if(LOVE_X64)
+	set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
+else()
+	set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES")
+endif()
+
+set(CPACK_NSIS_MENU_LINKS "http://love2d.org/wiki" "Documentation")
+
+# Some bug somewhere in NSIS requires "\\\\" somewhere in the path,
+# according to The Internet. (And sure enough, it does not work
+# without it).
+set(NSIS_LEFT_BMP "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\left.bmp")
+set(NSIS_TOP_BMP "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\top.bmp")
+set(NSIS_MUI_ICON "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\love.ico")
+set(NSIS_MUI_UNICON "${CMAKE_CURRENT_SOURCE_DIR}/extra/nsis\\\\love.ico")
+
+set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "
+	!define MUI_WELCOMEPAGE_TITLE \\\"LÖVE ${LOVE_VERSION_STR} Setup\\\"
+	!define MUI_WELCOMEFINISHPAGE_BITMAP \\\"${NSIS_LEFT_BMP}\\\"
+	!define MUI_HEADERIMAGE_BITMAP \\\"${NSIS_TOP_BMP}\\\"
+	!define MUI_ICON \\\"${NSIS_MUI_ICON}\\\"
+	!define MUI_UNICON \\\"${NSIS_MUI_UNICON}\\\"
+")
+
+set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS "
+	WriteRegStr HKCR \\\".love\\\" \\\"\\\" \\\"LOVE\\\"
+	WriteRegStr HKCR \\\"LOVE\\\" \\\"\\\" \\\"LOVE Game File\\\"
+	WriteRegStr HKCR \\\"LOVE\\\\DefaultIcon\\\" \\\"\\\" \\\"$INSTDIR\\\\game.ico\\\"
+	WriteRegStr HKCR \\\"LOVE\\\\shell\\\" \\\"\\\" \\\"open\\\"
+	WriteRegStr HKCR \\\"LOVE\\\\shell\\\\open\\\" \\\"\\\" \\\"Open in LOVE\\\"
+	WriteRegStr HKCR \\\"LOVE\\\\shell\\\\open\\\\command\\\" \\\"\\\" \\\"$INSTDIR\\\\love.exe $\\\\\\\"%1$\\\\\\\"\\\"
+	System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v  (0x08000000, 0, 0, 0)'
+")
+
+set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS "
+	DeleteRegKey HKCR \\\"LOVE\\\"
+	DeleteRegKey HKCR \\\".love\\\"
+	System::Call 'shell32.dll::SHChangeNotify(i, i, i, i) v  (0x08000000, 0, 0, 0)'
+")
+
+include(CPack)

+ 241 - 35
changes.txt

@@ -1,72 +1,251 @@
-LOVE 0.9.0 []
---------------
+LOVE 0.9.1 [Baby Inspector]
+---------------------------
+
+  Released: N/A
+
+  * Added Source:clone.
+  * Added ParticleSystem:clone.
+  * Added Mesh:setWireframe and Mesh:isWireframe for debugging.
+  * Added CircleShape:getPoint and CircleShape:setPoint.
+  * Added Mesh/SpriteBatch/ParticleSystem:setTexture, accepts Canvases and Images.
+
+  * Deprecated Mesh/SpriteBatch/ParticleSystem:setImage.
+
+  * Fixed love.graphics.scale with negative values causing incorrect line widths.
+  * Fixed Joystick:isDown using 0-based button index arguments.
+  * Fixed Source:setPitch to error when infinity or NaN is given.
+  * Fixed love.graphics.setCanvas() to restore the proper viewport and scissor rectangles.
+  * Fixed TrueType font glyphs which request a monochrome bitmap pixel mode.
+  * Fixed love.graphics.reset causing crashes when called in between love.graphics.push/pop.
+
+  * Updated the error text for love.filesystem’s module searchers when require fails.
+  * Updated the love.filesystem module searchers to be tried after package.preload instead of before.
+  * Updated love.graphics.newParticleSystem, newSpriteBatch, and newMesh to accept Canvases.
+  * Updated Canvas drawing code, texture coordinates are no longer flipped vertically.
+
+LOVE 0.9.0 [Baby Inspector]
+---------------------------
 
 
+	Released: 2013-12-13
+
+  * Added better multiplayer networking support via ENet.
   * Added --fused command line argument, to simulate fusing.
   * Added --fused command line argument, to simulate fusing.
   * Added liblove.
   * Added liblove.
   * Added the ability to have exit values.
   * Added the ability to have exit values.
   * Added exit value of 1 in case of error by default.
   * Added exit value of 1 in case of error by default.
-  * Added love.joystick.reload.
   * Added basic support for the file:// uri scheme.
   * Added basic support for the file:// uri scheme.
-  * Added love.mouse.setX/setY.
+  * Added love.filesystem.isFused.
   * Added love.filesystem.getIdentity.
   * Added love.filesystem.getIdentity.
+  * Added love.filesystem.append.
+  * Added love.filesystem.getSize.
+  * Added love.filesystem.mount and love.filesystem.unmount.
+  * Added optional file search order parameter to love.filesystem.setIdentity.
+  * Added File:isOpen and File:getMode.
+  * Added Fie:setBuffer, File:getBuffer, and File:flush.
+  * Added textinput event for unicode text input.
+  * Added love.keyboard.setTextInput and love.keyboard.hasTextInput.
+  * Added previously internal Rasterizer and GlyphData object methods.
+  * Added support for UTF-8 ImageFonts.
+  * Added Font:getAscent/getDescent/getBaseline.
+  * Added Font:setFilter/getFilter.
+  * Added Font:hasGlyphs.
+  * Added angle, scale, and shear parameters to love.graphics.printf.
   * Added HDR canvas support.
   * Added HDR canvas support.
-  * Added Source:isPlaying.
   * Added mipmapping support (has isSupported test).
   * Added mipmapping support (has isSupported test).
-  * Added Font:getAscent/getDescent/getBaseline.
-  * Added Canvas:getPixel.
   * Added vertex shader support.
   * Added vertex shader support.
   * Added boolean support to Shader:send.
   * Added boolean support to Shader:send.
-  * Added support for UTF-8 ImageFonts.
-  * Added SoundData:getDuration.
-  * Added new Channels api for love.thread.
-  * Added flags to setMode.
-  * Added support for resizable and borderless windows.
-  * Added resize event.
+  * Added Canvas:getPixel.
+  * Added blend mode "replace".
+  * Added line join modes.
+  * Added Mesh objects, allowing for arbitrary textured polygons.
+  * Added multiple render target support to love.graphics.setCanvas.
+  * Added love.graphics.setColorMask.
+  * Added love.graphics.origin.
+  * Added love.graphics.getRendererInfo.
+  * Added love.graphics.getMaxImageSize.
+  * Added SpriteBatch:getCount and SpriteBatch:getBufferSize.
+  * Added SpriteBatch:getColor.
+  * Added ParticleSystem:emit.
+  * Added ParticleSystem:setInsertMode and ParticleSystem:getInsertMode.
+  * Added many ParticleSystem getter methods.
+  * Added DXT compressed texture support via love.image.newCompressedData.
+  * Added love.image.isCompressed and Image:isCompressed.
+  * Added Image/Canvas/ImageData:getDimensions.
+  * Added anisotropic filtering support for Images, Canvases, and Fonts.
+  * Added Image:refresh.
+  * Added Image:getData.
+  * Added SoundData:getDuration and SoundData:getSampleCount.
+  * Added Source:isPlaying.
+  * Added Source:setRelative and Source:isRelative.
+  * Added Source:setCone and Source:getCone.
+  * Added Source:getChannels.
+  * Added new Channels API for love.thread.
+  * Added limited table support to Channel:push.
+  * Added Thread:getError.
+  * Added Thread:isRunning.
+  * Added threaderror event.
   * Added love.math module.
   * Added love.math module.
   * Added a platform-independent (good) random implementation to love.math.
   * Added a platform-independent (good) random implementation to love.math.
-  * OPTIONAL: Added support for GME.
-
-  * Fixed crashes with font drawing on some ATI cards.
+  * Added RandomGenerator objects.
+  * Added BezierCurve objects.
+  * Added love.math.triangulate and love.math.isConvex.
+  * Added love.math.noise.
+  * Added love.timer.getAverageDelta.
+  * Added Data:getString.
+  * Added Contact:getChildren.
+  * Added love.system module.
+  * Added love.system.getClipboardText and love.system.setClipboardText.
+  * Added love.system.getOS and love.system.getProcessorCount.
+  * Added love.window module.
+  * Added love.window.isVisible.
+  * Added flags to love.window.setMode.
+  * Added monitor choosing support to love.window.setMode.
+  * Added support for resizable, borderless, and non-centered windows.
+  * Added support for "fullscreen-desktop" mode.
+  * Added window resize and visible events.
+  * Added love.window.getDimensions.
+  * Added love.window.getIcon.
+  * Added t.window.icon to love.conf.
+  * Added love.mousefocus and love.window.hasMouseFocus.
+  * Added custom hardware cursors via love.mouse.newCursor. 
+  * Added love.mouse.setX/setY.
+  * Added Joystick objects.
+  * Added love.joystick.getJoystick.
+  * Added joystick connect and disconnect events.
+  * Added joystickaxis and joystickhat events.
+  * Added unified Gamepad API for joysticks which have a similar layout to the Xbox controller.
+  * Added joystick vibration support, works with most common gamepads.
+  * OPTIONAL: Added support for Game Music Emu.
+
+  * Fixed fused mode in OS X.
+  * Fixed printing to the console in Windows before love.load is called.
+  * Fixed the default love.run to not include the time taken by love.load in the first frame's dt.
+  * Fixed the error screen not always appearing until the next input event.
+  * Fixed love.event.clear.
+  * Fixed love.mouse.setPosition when called in love.load.
   * Fixed scaling in several love.physics functions.
   * Fixed scaling in several love.physics functions.
+  * Fixed Box2D exception in World:update.
+  * Fixed many uncaught Box2D / love.physics exceptions for Bodies and Joints.
+  * Fixed ChainShape:getPoints running out of Lua stack space and crashing.
+  * Fixed File:read reading past end of file.
+  * Fixed love.filesystem.setIdentity not removing read access from old directories.
+  * Fixed possible memory leak in utf-8 decoder.
+  * Fixed spacing for the last character in an ImageFont.
+  * Fixed line wrapping in love.graphics.printf.
+  * Fixed love.graphics.printf to error if the wrap limit is negative.
+  * Fixed love.graphics.print truncating strings with embedded zeros.
+  * Fixed crashes with font drawing on some ATI cards.
   * Fixed artifacts when drawing lines at huge scale.
   * Fixed artifacts when drawing lines at huge scale.
-  * Fixed ImageFonts ignoring default image filter.
+  * Fixed Fonts and Canvases ignoring default image filter.
+  * Fixed scissor boxes when a canvas is set after love.graphics.setScissor is called.
+  * Fixed love.graphics.getLineWidth returning incorrect values.
+  * Fixed love.graphics.getColor on some Windows systems.
+  * Fixed alpha blend mode.
+  * Fixed multiplicative blend mode.
+  * Fixed love.graphics.getPointStyle.
+  * Fixed line numbers in shader errors.
+  * Fixed Shader:send with Images and Canvases failing sometimes.
+  * Fixed Shader:send to keep a reference to sent Images and Canvases.
+  * Fixed crash when binding SpriteBatches multiple times.
+  * Fixed SpriteBatches with more than 16,384 sprites.
+  * Fixed particle draw order for ParticleSystems.
+  * Fixed ParticleSystem:setSizes resetting the size variation.
+  * Fixed the graphics viewport not matching the window size when using an unsupported fullscreen mode.
   * Fixed getMode and friends returning wrong values when using desktop size.
   * Fixed getMode and friends returning wrong values when using desktop size.
+  * Fixed keyrepeat settings being lost after (indirect) setMode.
+  * Fixed the icon being reset after setMode.
   * Fixed memory leak in the mp3 decoder.
   * Fixed memory leak in the mp3 decoder.
   * Fixed sound issues with some versions of OpenAL soft, by enabling direct channels.
   * Fixed sound issues with some versions of OpenAL soft, by enabling direct channels.
   * Fixed 'random' hangs in audio.
   * Fixed 'random' hangs in audio.
-  * Fixed love.graphics.getLineWidth returning incorrect values.
-  * Fixed possible memory leak in utf-8 decoder.
   * Fixed love.sound.newDecoder not accepting FileData.
   * Fixed love.sound.newDecoder not accepting FileData.
-  * Fixed multiplicative blend mode.
-  * Fixed Box2D exception in World:update.
-  * Fixed spacing for the last character in an ImageFont.
-  * Fixed crash when locking SpriteBatches multiple times.
-  * Fixed File:read reading past end of file.
-  * Fixed keyrepeat settings being lost after (indirect) setMode.
+  * Fixed case (in)sensitivity of sound file extension parsing.
+  * Fixed looping support in tracker music formats.
+  * Fixed skipping/looping issues when playing streaming audio Sources.
+  * Fixed race condition in Source:play.
+  * Fixed WAVE sound playback.
 
 
   * Moved love's startup to modules/love.
   * Moved love's startup to modules/love.
+  * Moved window-related functions from love.graphics to love.window.
 
 
   * Renamed love's boot script to 'love.boot', which can be required.
   * Renamed love's boot script to 'love.boot', which can be required.
+  * Renamed love.filesystem.mkdir to love.filesystem.createDirectory.
+  * Renamed love.filesystem.enumerate to love.filesystem.getDirectoryItems.
+  * Renamed World:setAllowSleeping to World:setSleepingAllowed.
+  * Renamed ChainShape:setPrevVertex to ChainShape:setPreviousVertex.
+  * Renamed Joint:enableMotor to Joint:setMotorEnabled.
+  * Renamed Joint:enableLimit and Joint:isLimitEnabled to Joint:setLimitsEnabled and Joint:hasLimitsEnabled.
+  * Renamed t.screen to t.window in love.conf.
+  * Renamed love.graphics.setCaption to love.window.setTitle.
   * Renamed PixelEffect to Shader (but now with vertex shaders).
   * Renamed PixelEffect to Shader (but now with vertex shaders).
-
-  * Removed love.joystick.open and friends.
+  * Renamed love.graphics.setDefaultImageFilter to love.graphics.setDefaultFilter.
+  * Renamed ParticleSystem:setSprite to ParticleSystem:setImage.
+  * Renamed ParticleSystem:setGravity to ParticleSystem:setLinearAcceleration.
+  * Renamed ParticleSystem:setLifetime/setParticleLife to setEmitter/ParticleLifetime.
+  * Renamed ParticleSystem:count and all getNum* functions to get*Count.
+  * Renamed Source:setDistance to Source:setAttenuationDistances.
+  * Renamed SoundData:getBits and Decoder:getBits to SoundData:getBitDepth and Decoder:getBitDepth.
+  * Renamed love.mouse.setGrab to love.mouse.setGrabbed.
+
+  * Removed release mode.
+  * Removed love.keyboard.getKeyRepeat (see love.keyboard.hasKeyRepeat).
+  * Removed the unicode argument from love.keypressed (see love.textinput).
   * Removed love.graphics.drawTest.
   * Removed love.graphics.drawTest.
-  * Removed thread names.
-  * Removed old thread messaging api (see Channels).
   * Removed love.graphics.quad/triangle.
   * Removed love.graphics.quad/triangle.
+  * Removed love.graphics.setColorMode.
+  * Removed love.graphics.newStencil.
+  * Removed love.graphics.setLine/setPoint.
+  * Removed love.graphics.drawq (functionality is merged into love.graphics.draw).
+  * Removed SpriteBatch:addq/setq (functionality is merged into SpriteBatch:add/set).
+  * Removed Quad:flip.
+  * Removed ParticleSystem:isFull/isEmpty.
+  * Removed ParticleSystem:getX/getY.
+  * Removed love.graphics.checkMode.
+  * Removed love.joystick.open and friends.
+  * Removed love.joystick module functions which operated on individual joysticks (see Joystick objects).
+  * Removed joystick ball support.
+  * Removed thread names.
+  * Removed old thread messaging API (see Channels).
+  * Removed love.timer.getMicroTime.
 
 
-  * Updated allocation for SoundData, it's more efficient and less wasteful.
-  * Updated Source:set* functions to default z to 0.
+  * Updated functions which return love objects to re-use the Lua-side object instead of always recreating it.
   * Updated the windows console, it now tries to re-use an active one first.
   * Updated the windows console, it now tries to re-use an active one first.
-  * Updated love.image memory handling, improves errors and thread-safety.
+  * Updated error handling, error handlers now get resolved when the error occurs.
   * Updated order of sleep/present in love.run (now draws, *then* sleeps).
   * Updated order of sleep/present in love.run (now draws, *then* sleeps).
+  * Updated love.filesystem to try to create the appdata directory if it doesn't exist yet.
+  * Updated the default filesystem identity to omit file extension.
+  * Updated love.filesystem.newFile to optionally open the file.
+  * Updated most love.filesystem functions to return nil, error on internal failure.
+  * Updated love.keyboard.setKeyRepeat to take a boolean argument instead of numbers.
+  * Updated love.keypressed's second argument to be a boolean indicating key repeat.
+  * Updated keyboard key constants for some more modern keyboard keys.
+  * Updated window code to use adaptive vsync when available, if vsync is enabled.
+  * updated love.graphics.print's x and y arguments to default to 0.
   * Updated the setFilter and setWrap methods, the second argument is now optional.
   * Updated the setFilter and setWrap methods, the second argument is now optional.
-  * Updated font rendering code, now more performant.
-  * Updated error handling, error handlers now get resolved when the error occurs.
+  * Updated Font and ParticleSystem rendering code, now more performant.
+  * Updated SpriteBatch code, now more performant when adding/setting and (un)binding.
+  * Updated Canvas code to support more systems.
+  * Updated Canvas:getImageData and love.graphics.newScreenshot to be more efficient.
+  * Updated love.graphics.newScreenshot to create a fully opaque image by default.
+  * Updated error messages when sending bad values to Shaders.
+  * Updated love.graphics.newParticleSystem to have a default buffer size of 1000.
+  * Updated ImageData:setPixel to accept a table and default to 255 alpha.
+  * Updated ImageData:mapPixel, is now more efficient and accepts optional x,y,w,h arguments.
+  * Updated love.image memory handling, improves errors and thread-safety.
+  * Updated all love object constructors to optionally accept FileData if they accept a filename.
+  * Updated allocation for SoundData, it's more efficient and less wasteful.
+  * Updated SoundData:set/getSample to error for invalid samples.
+  * Updated Source:set* functions to default z to 0.
+  * Updated Source:seek to error for negative offsets.
+  * Updated Thread:start to accept arguments which get passed to the thread.
+  * Updated love.timer.getFPS to be microsecond-accurate.
+  * Updated love.timer.getTime to be microsecond-accurate and monotonic.
+  * Updated Box2D to version 2.3.0.
 
 
 LOVE 0.8.0 [Rubber Piggy]
 LOVE 0.8.0 [Rubber Piggy]
 -------------------------
 -------------------------
 
 
+	Released: 2012-04-02
+
   * Added release error screen.
   * Added release error screen.
   * Added alpha to love.graphics.setBackgroundColor.
   * Added alpha to love.graphics.setBackgroundColor.
   * Added Canvas:clear(r, g, b, a).
   * Added Canvas:clear(r, g, b, a).
@@ -156,6 +335,8 @@ LOVE 0.8.0 [Rubber Piggy]
 LOVE 0.7.2 [Game Slave]
 LOVE 0.7.2 [Game Slave]
 -----------------------
 -----------------------
 
 
+	Released: 2011-05-04
+
   * Added Framebuffer:get/setWrap.
   * Added Framebuffer:get/setWrap.
   * Added love.event.clear.
   * Added love.event.clear.
   * Added support for any number of arguments to love.keyboard.isDown, love.mouse.isDown and love.joystick.isDown.
   * Added support for any number of arguments to love.keyboard.isDown, love.mouse.isDown and love.joystick.isDown.
@@ -180,6 +361,8 @@ LOVE 0.7.2 [Game Slave]
 LOVE 0.7.1 [Game Slave]
 LOVE 0.7.1 [Game Slave]
 -----------------------
 -----------------------
 
 
+	Released: 2011-02-14
+
   * Added source:isPaused()
   * Added source:isPaused()
   * Added error when initial window can't be created.
   * Added error when initial window can't be created.
   * Added framebuffer filter modes.
   * Added framebuffer filter modes.
@@ -214,6 +397,8 @@ LOVE 0.7.1 [Game Slave]
 LOVE 0.7.0 [Game Slave]
 LOVE 0.7.0 [Game Slave]
 -----------------------
 -----------------------
 
 
+	Released: 2010-12-05
+
   * Added love.thread.
   * Added love.thread.
   * Added love.font.
   * Added love.font.
   * Added love.graphics.Framebuffer.
   * Added love.graphics.Framebuffer.
@@ -268,6 +453,8 @@ LOVE 0.7.0 [Game Slave]
 LOVE 0.6.2 [Jiggly Juice]
 LOVE 0.6.2 [Jiggly Juice]
 -------------------------
 -------------------------
 
 
+	Released: 2010-03-06
+
   * Fixed a bug causing ImageFonts to cut off some pixels.
   * Fixed a bug causing ImageFonts to cut off some pixels.
   * Fixed a bug where filled rectangles were too small.
   * Fixed a bug where filled rectangles were too small.
   * Fixed a bug in Image:setFilter where it would switch the parameters.
   * Fixed a bug in Image:setFilter where it would switch the parameters.
@@ -280,6 +467,8 @@ LOVE 0.6.2 [Jiggly Juice]
 LOVE 0.6.1 [Jiggly Juice]
 LOVE 0.6.1 [Jiggly Juice]
 -------------------------
 -------------------------
 
 
+	Released: 2010-02-07
+
   * Added Shape:setGroupIndex and getGroupIndex.
   * Added Shape:setGroupIndex and getGroupIndex.
   * Added Body:setFixedRotation and Body:getFixedRotation.
   * Added Body:setFixedRotation and Body:getFixedRotation.
   * Added Body:setInertia.
   * Added Body:setInertia.
@@ -303,6 +492,8 @@ LOVE 0.6.1 [Jiggly Juice]
 LOVE 0.6.0 [Jiggly Juice]
 LOVE 0.6.0 [Jiggly Juice]
 -------------------------
 -------------------------
 
 
+	Released: 2009-12-24
+
   * Lost track of 0.6.0 changes a long while ago. Don't trust the list below.
   * Lost track of 0.6.0 changes a long while ago. Don't trust the list below.
 
 
   * Added love.graphics.print()/printf().
   * Added love.graphics.print()/printf().
@@ -338,6 +529,8 @@ LOVE 0.6.0 [Jiggly Juice]
 LOVE 0.5.0 [Salted Nuts]
 LOVE 0.5.0 [Salted Nuts]
 ------------------------
 ------------------------
 
 
+	Released: 2009-01-02
+
   * Added love.joystick.
   * Added love.joystick.
   * Added network support via LuaSocket.
   * Added network support via LuaSocket.
   * Added support for loading of appended .love-file.
   * Added support for loading of appended .love-file.
@@ -373,6 +566,8 @@ LOVE 0.5.0 [Salted Nuts]
 LOVE 0.4.0 [Taco Beam]
 LOVE 0.4.0 [Taco Beam]
 ----------------------
 ----------------------
 
 
+	Released: 2008-08-29
+
   * Added love.physics. (YES!)
   * Added love.physics. (YES!)
   * Added love.audio.setMode().
   * Added love.audio.setMode().
   * Added love.audio.setChannels().
   * Added love.audio.setChannels().
@@ -385,6 +580,8 @@ LOVE 0.4.0 [Taco Beam]
 LOVE 0.3.2 [Lemony Fresh]
 LOVE 0.3.2 [Lemony Fresh]
 -------------------------
 -------------------------
 
 
+	Released: 2008-07-04
+
   * Added love.graphics.rectangle()
   * Added love.graphics.rectangle()
   * Added love.graphics.setLineWidth()
   * Added love.graphics.setLineWidth()
   * Added love.graphics.setLineStyle()
   * Added love.graphics.setLineStyle()
@@ -402,6 +599,8 @@ LOVE 0.3.2 [Lemony Fresh]
 LOVE 0.3.1 [Space Meat]
 LOVE 0.3.1 [Space Meat]
 -----------------------
 -----------------------
 
 
+	Released: 2008-06-21
+
   * Fixed segfault related to graphics.
   * Fixed segfault related to graphics.
   * Fixed wait-forever bug related to audio.
   * Fixed wait-forever bug related to audio.
   * Fixed error reporting not working across modules.
   * Fixed error reporting not working across modules.
@@ -411,6 +610,8 @@ LOVE 0.3.1 [Space Meat]
 LOVE 0.3.0 [Mutant Vermin]
 LOVE 0.3.0 [Mutant Vermin]
 --------------------------
 --------------------------
 
 
+	Released: 2008-06-17
+
   * Added ParticleSystem.
   * Added ParticleSystem.
   * Added visual error reporting.
   * Added visual error reporting.
   * Added love.system for game control needs.
   * Added love.system for game control needs.
@@ -429,6 +630,8 @@ LOVE 0.3.0 [Mutant Vermin]
 LOVE 0.2.1 [Impending Doom]
 LOVE 0.2.1 [Impending Doom]
 ---------------------------
 ---------------------------
 
 
+	Released: 2008-03-29
+
   * Added many functions in love.filesystem.
   * Added many functions in love.filesystem.
   * Added a dedicated save-folder for each game.
   * Added a dedicated save-folder for each game.
   * Added timer.sleep.
   * Added timer.sleep.
@@ -463,6 +666,8 @@ LOVE 0.2.1 [Impending Doom]
 LOVE 0.2.0 [Mini-Moose]
 LOVE 0.2.0 [Mini-Moose]
 -----------------------
 -----------------------
 
 
+	Released: 2008-02-06
+
   * Added ImageFont
   * Added ImageFont
   * Added Animation
   * Added Animation
   * Added text formatting functions
   * Added text formatting functions
@@ -481,7 +686,8 @@ LOVE 0.2.0 [Mini-Moose]
 LOVE 0.1.1 [Santa-Power]
 LOVE 0.1.1 [Santa-Power]
 ------------------------
 ------------------------
 
 
-Initial release!
+	Initial release!
+	Released: 2008-01-13
 
 
  * Image loading and rendering.
  * Image loading and rendering.
  * Sound loading and playing.
  * Sound loading and playing.

+ 2 - 5
license.txt

@@ -1,4 +1,4 @@
-Copyright (c) 2006-2012 LOVE Development Team
+Copyright (c) 2006-2014 LOVE Development Team
 
 
 This software is provided 'as-is', without any express or implied
 This software is provided 'as-is', without any express or implied
 warranty. In no event will the authors be held liable for any damages
 warranty. In no event will the authors be held liable for any damages
@@ -21,13 +21,10 @@ distribution.
 
 
 
 
 
 
-
 -------
 -------
+
 LÖVE also uses the following LGPL libraries:
 LÖVE also uses the following LGPL libraries:
 
 
- - SDL
-     Website: http://libsdl.org
-     Source download: http://www.libsdl.org/release/SDL-1.2.14.tar.gz
  - libmpg123
  - libmpg123
      Website: http://www.mpg123.de/
      Website: http://www.mpg123.de/
      Source download: http://sourceforge.net/projects/mpg123/files/latest/download
      Source download: http://sourceforge.net/projects/mpg123/files/latest/download

+ 2 - 2
platform/macosx/Info-Framework.plist

@@ -17,11 +17,11 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>FMWK</string>
 	<string>FMWK</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>0.8.0</string>
+	<string>0.9.0</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>LoVe</string>
 	<string>LoVe</string>
 	<key>CFBundleVersion</key>
 	<key>CFBundleVersion</key>
-	<string>0.8.0</string>
+	<string>0.9.0</string>
 	<key>NSPrincipalClass</key>
 	<key>NSPrincipalClass</key>
 	<string></string>
 	<string></string>
 </dict>
 </dict>

+ 47 - 0
platform/macosx/OSX.h

@@ -0,0 +1,47 @@
+/**
+ * Copyright (c) 2006-2014 LOVE Development Team
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software. If you use this software
+ *    in a product, an acknowledgment in the product documentation would be
+ *    appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ **/
+
+#ifndef LOVE_OSX_H
+#define LOVE_OSX_H
+
+#include <string>
+
+namespace love
+{
+namespace osx
+{
+
+/**
+ * Returns the filepath of the first detected love file in the Resources folder
+ * in love.app.
+ * Returns an empty string if no love file is found.
+ **/
+std::string getLoveInResources();
+
+/**
+ * Checks for drop-file events. Returns the filepath if an event occurred, or
+ * an empty string otherwise.
+ **/
+std::string checkDropEvents();
+
+} // osx
+} // love
+
+#endif // LOVE_OSX_H

+ 75 - 0
platform/macosx/OSX.mm

@@ -0,0 +1,75 @@
+/**
+ * Copyright (c) 2006-2014 LOVE Development Team
+ *
+ * This software is provided 'as-is', without any express or implied
+ * warranty.  In no event will the authors be held liable for any damages
+ * arising from the use of this software.
+ *
+ * Permission is granted to anyone to use this software for any purpose,
+ * including commercial applications, and to alter it and redistribute it
+ * freely, subject to the following restrictions:
+ *
+ * 1. The origin of this software must not be misrepresented; you must not
+ *    claim that you wrote the original software. If you use this software
+ *    in a product, an acknowledgment in the product documentation would be
+ *    appreciated but is not required.
+ * 2. Altered source versions must be plainly marked as such, and must not be
+ *    misrepresented as being the original software.
+ * 3. This notice may not be removed or altered from any source distribution.
+ **/
+
+#import "OSX.h"
+#import <Foundation/Foundation.h>
+
+#include <SDL2/SDL.h>
+
+namespace love
+{
+namespace osx
+{
+
+std::string getLoveInResources()
+{
+	std::string path;
+
+	@autoreleasepool
+	{
+		// check to see if there are any .love files in Resources - props to stevejohnson/diordna
+		NSArray *lovePaths = [[NSBundle mainBundle] pathsForResourcesOfType:@"love" inDirectory:nil];
+		if ([lovePaths count] > 0)
+		{
+			NSString *firstLovePath = [lovePaths objectAtIndex:0];
+			path = std::string([firstLovePath UTF8String]);
+		}
+	}
+
+	return path;
+}
+
+std::string checkDropEvents()
+{
+	std::string dropstr;
+	SDL_Event event;
+
+	bool initvideo = SDL_WasInit(SDL_INIT_VIDEO) != 0;
+	if (!initvideo)
+		SDL_InitSubSystem(SDL_INIT_VIDEO);
+
+	SDL_PumpEvents();
+	if (SDL_PeepEvents(&event, 1, SDL_GETEVENT, SDL_DROPFILE, SDL_DROPFILE) > 0)
+	{
+		if (event.type == SDL_DROPFILE)
+		{
+			dropstr = std::string(event.drop.file);
+			SDL_free(event.drop.file);
+		}
+	}
+
+	if (!initvideo)
+		SDL_QuitSubSystem(SDL_INIT_VIDEO);
+
+	return dropstr;
+}
+
+} // osx
+} // love

+ 0 - 12
platform/macosx/SDLMain.h

@@ -1,12 +0,0 @@
-/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
-       Initial Version: Darrell Walisser <[email protected]>
-       Non-NIB-Code & other changes: Max Horn <[email protected]>
-
-    Feel free to customize this file to suit your needs
-*/
-
-#import <Cocoa/Cocoa.h>
-#import "SDL/SDL.h"
-
-@interface SDLMain : NSObject
-@end

+ 0 - 437
platform/macosx/SDLMain.m

@@ -1,437 +0,0 @@
-/*   SDLMain.m - main entry point for our Cocoa-ized SDL app
-       Initial Version: Darrell Walisser <[email protected]>
-       Non-NIB-Code & other changes: Max Horn <[email protected]>
-
-    Feel free to customize this file to suit your needs
-*/
-
-//#import "SDL.h"
-#import "SDLMain.h"
-#import <sys/param.h> /* for MAXPATHLEN */
-#import <unistd.h>
-
-/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
- but the method still is there and works. To avoid warnings, we declare
- it ourselves here. */
-@interface NSApplication(SDL_Missing_Methods)
-- (void)setAppleMenu:(NSMenu *)menu;
-@end
-
-/* Use this flag to determine whether we use SDLMain.nib or not */
-#define		SDL_USE_NIB_FILE	0
-
-/* Use this flag to determine whether we use CPS (docking) or not */
-#define		SDL_USE_CPS		1
-#ifdef SDL_USE_CPS
-/* Portions of CPS.h */
-typedef struct CPSProcessSerNum
-{
-	UInt32		lo;
-	UInt32		hi;
-} CPSProcessSerNum;
-
-extern OSErr	CPSGetCurrentProcess( CPSProcessSerNum *psn);
-extern OSErr 	CPSEnableForegroundOperation( CPSProcessSerNum *psn, UInt32 _arg2, UInt32 _arg3, UInt32 _arg4, UInt32 _arg5);
-extern OSErr	CPSSetFrontProcess( CPSProcessSerNum *psn);
-
-#endif /* SDL_USE_CPS */
-
-static int    gArgc;
-static char  **gArgv;
-static BOOL   gFinderLaunch;
-static BOOL   gCalledAppMainline = FALSE;
-
-static NSString *getApplicationName(void)
-{
-    NSDictionary *dict;
-    NSString *appName = 0;
-
-    /* Determine the application name */
-    dict = (NSDictionary *)CFBundleGetInfoDictionary(CFBundleGetMainBundle());
-    if (dict)
-        appName = [dict objectForKey: @"CFBundleName"];
-    
-    if (![appName length])
-        appName = [[NSProcessInfo processInfo] processName];
-
-    return appName;
-}
-
-#if SDL_USE_NIB_FILE
-/* A helper category for NSString */
-@interface NSString (ReplaceSubString)
-- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString;
-@end
-#endif
-
-@interface SDLApplication : NSApplication
-@end
-
-@implementation SDLApplication
-/* Invoked from the Quit menu item */
-- (void)terminate:(id)sender
-{
-    /* Post a SDL_QUIT event */
-    SDL_Event event;
-    event.type = SDL_QUIT;
-    SDL_PushEvent(&event);
-}
-
-/* Hack to make Cocoa ignore keystrokes that aren't shortcuts, otherwise it beeps on every key press */
-- (void)sendEvent:(NSEvent *)theEvent {
-	if (NSKeyDown == [theEvent type] || NSKeyUp == [theEvent type]) {
-		if ([theEvent modifierFlags] & NSCommandKeyMask)
-			[super sendEvent: theEvent];
-	} else {
-		[super sendEvent: theEvent];
-	}
-}
-@end
-
-/* The main class of the application, the application's delegate */
-@implementation SDLMain
-
-/* Set the working directory to the .app's parent directory */
-/*CHANGED to Bundle's Resource Directory. */
-- (void) setupWorkingDirectory:(BOOL)shouldChdir
-{
-    if (shouldChdir)
-    {
-    	/*
-        char parentdir[PATH_MAX];
-		//CFURLRef url = CFBundleCopyBundleURL(CFBundleGetMainBundle());
-		CFURLRef url = CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
-		CFURLRef url2 = CFURLCreateCopyDeletingLastPathComponent(0, url);
-		if (CFURLGetFileSystemRepresentation(url2, true, (UInt8 *)parentdir, PATH_MAX)) {
-	        assert ( chdir (parentdir) == 0 );   // chdir to the binary app's parent //
-		}
-		CFRelease(url);
-		CFRelease(url2);
-		*/
-		CFBundleRef mainBundle = CFBundleGetMainBundle();
-		CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle);
-		char path[PATH_MAX];
-		if (!CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX))
-		{
-		    // error!
-		}
-		CFRelease(resourcesURL);
-		chdir(path);
-	}
-
-}
-
-#if SDL_USE_NIB_FILE
-
-/* Fix menu to contain the real app name instead of "SDL App" */
-- (void)fixMenu:(NSMenu *)aMenu withAppName:(NSString *)appName
-{
-    NSRange aRange;
-    NSEnumerator *enumerator;
-    NSMenuItem *menuItem;
-
-    aRange = [[aMenu title] rangeOfString:@"SDL App"];
-    if (aRange.length != 0)
-        [aMenu setTitle: [[aMenu title] stringByReplacingRange:aRange with:appName]];
-
-    enumerator = [[aMenu itemArray] objectEnumerator];
-    while ((menuItem = [enumerator nextObject]))
-    {
-        aRange = [[menuItem title] rangeOfString:@"SDL App"];
-        if (aRange.length != 0)
-            [menuItem setTitle: [[menuItem title] stringByReplacingRange:aRange with:appName]];
-        if ([menuItem hasSubmenu])
-            [self fixMenu:[menuItem submenu] withAppName:appName];
-    }
-    [ aMenu sizeToFit ];
-}
-
-#else
-
-static void setApplicationMenu(void)
-{
-    /* warning: this code is very odd */
-    NSMenu *appleMenu;
-    NSMenuItem *menuItem;
-    NSString *title;
-    NSString *appName;
-    
-    appName = getApplicationName();
-    appleMenu = [[NSMenu alloc] initWithTitle:@""];
-    
-    /* Add menu items */
-    title = [@"About " stringByAppendingString:appName];
-    [appleMenu addItemWithTitle:title action:@selector(orderFrontStandardAboutPanel:) keyEquivalent:@""];
-
-    [appleMenu addItem:[NSMenuItem separatorItem]];
-
-    title = [@"Hide " stringByAppendingString:appName];
-    [appleMenu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
-
-    menuItem = (NSMenuItem *)[appleMenu addItemWithTitle:@"Hide Others" action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
-    [menuItem setKeyEquivalentModifierMask:(NSAlternateKeyMask|NSCommandKeyMask)];
-
-    [appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
-
-    [appleMenu addItem:[NSMenuItem separatorItem]];
-
-    title = [@"Quit " stringByAppendingString:appName];
-    [appleMenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
-
-    
-    /* Put menu into the menubar */
-    menuItem = [[NSMenuItem alloc] initWithTitle:@"" action:nil keyEquivalent:@""];
-    [menuItem setSubmenu:appleMenu];
-    [[NSApp mainMenu] addItem:menuItem];
-
-    /* Tell the application object that this is now the application menu */
-    [NSApp setAppleMenu:appleMenu];
-
-    /* Finally give up our references to the objects */
-    [appleMenu release];
-    [menuItem release];
-}
-
-/* Create a window menu */
-static void setupWindowMenu(void)
-{
-    NSMenu      *windowMenu;
-    NSMenuItem  *windowMenuItem;
-    NSMenuItem  *menuItem;
-
-    windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
-    
-    /* "Minimize" item */
-    menuItem = [[NSMenuItem alloc] initWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@"m"];
-    [windowMenu addItem:menuItem];
-    [menuItem release];
-    
-    /* Put menu into the menubar */
-    windowMenuItem = [[NSMenuItem alloc] initWithTitle:@"Window" action:nil keyEquivalent:@""];
-    [windowMenuItem setSubmenu:windowMenu];
-    [[NSApp mainMenu] addItem:windowMenuItem];
-    
-    /* Tell the application object that this is now the window menu */
-    [NSApp setWindowsMenu:windowMenu];
-
-    /* Finally give up our references to the objects */
-    [windowMenu release];
-    [windowMenuItem release];
-}
-
-/* Replacement for NSApplicationMain */
-static void CustomApplicationMain (int argc, char **argv)
-{
-    NSAutoreleasePool	*pool = [[NSAutoreleasePool alloc] init];
-    SDLMain				*sdlMain;
-
-    /* Ensure the application object is initialised */
-    [SDLApplication sharedApplication];
-    
-#ifdef SDL_USE_CPS
-    {
-        CPSProcessSerNum PSN;
-        /* Tell the dock about us */
-        if (!CPSGetCurrentProcess(&PSN))
-            if (!CPSEnableForegroundOperation(&PSN,0x03,0x3C,0x2C,0x1103))
-                if (!CPSSetFrontProcess(&PSN))
-                    [SDLApplication sharedApplication];
-    }
-#endif /* SDL_USE_CPS */
-
-    /* Set up the menubar */
-    [NSApp setMainMenu:[[[NSMenu alloc] init] autorelease]];
-    setApplicationMenu();
-    setupWindowMenu();
-
-    /* Create SDLMain and make it the app delegate */
-    sdlMain = [[SDLMain alloc] init];
-    [NSApp setDelegate:sdlMain];
-    
-    /* Start the main event loop */
-    [NSApp run];
-    
-    [sdlMain release];
-    [pool release];
-}
-
-#endif
-
-
-/*
- * Catch document open requests...this lets us notice files when the app
- *  was launched by double-clicking a document, or when a document was
- *  dragged/dropped on the app's icon. You need to have a
- *  CFBundleDocumentsType section in your Info.plist to get this message,
- *  apparently.
- *
- * Files are added to gArgv, so to the app, they'll look like command line
- *  arguments. Previously, apps launched from the finder had nothing but
- *  an argv[0].
- *
- * This message may be received multiple times to open several docs on launch.
- *
- * This message is ignored once the app's mainline has been called.
- */
-- (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
-{
-    const char *temparg;
-    size_t arglen;
-    char *arg;
-    char **newargv;
-
-    if (!gFinderLaunch)  /* MacOS is passing command line args. */
-        return FALSE;
-
-    if (gCalledAppMainline)  /* app has started, ignore this document. */
-        return FALSE;
-
-    temparg = [filename UTF8String];
-    arglen = SDL_strlen(temparg) + 1;
-    arg = (char *) SDL_malloc(arglen);
-    if (arg == NULL)
-        return FALSE;
-
-    newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
-    if (newargv == NULL)
-    {
-        SDL_free(arg);
-        return FALSE;
-    }
-    gArgv = newargv;
-
-    SDL_strlcpy(arg, temparg, arglen);
-    gArgv[gArgc++] = arg;
-    gArgv[gArgc] = NULL;
-    return TRUE;
-}
-
-
-/* Called when the internal event loop has just started running */
-- (void) applicationDidFinishLaunching: (NSNotification *) note
-{
-    int status;
-
-    /* Set the working directory to the .app's parent directory */
-    [self setupWorkingDirectory:gFinderLaunch];
-
-#if SDL_USE_NIB_FILE
-    /* Set the main menu to contain the real app name instead of "SDL App" */
-    [self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
-#endif
-	
-	/* Set up the app to receive menu events via keyboard shortcut */
-	setenv("SDL_ENABLEAPPEVENTS", "1", 1);
-
-    /* Hand off to main application code */
-    gCalledAppMainline = TRUE;
-    status = SDL_main (gArgc, gArgv);
-
-    /* We're done, thank you for playing */
-    exit(status);
-}
-@end
-
-
-@implementation NSString (ReplaceSubString)
-
-- (NSString *)stringByReplacingRange:(NSRange)aRange with:(NSString *)aString
-{
-    unsigned int bufferSize;
-    unsigned int selfLen = [self length];
-    unsigned int aStringLen = [aString length];
-    unichar *buffer;
-    NSRange localRange;
-    NSString *result;
-
-    bufferSize = selfLen + aStringLen - aRange.length;
-    buffer = NSAllocateMemoryPages(bufferSize*sizeof(unichar));
-    
-    /* Get first part into buffer */
-    localRange.location = 0;
-    localRange.length = aRange.location;
-    [self getCharacters:buffer range:localRange];
-    
-    /* Get middle part into buffer */
-    localRange.location = 0;
-    localRange.length = aStringLen;
-    [aString getCharacters:(buffer+aRange.location) range:localRange];
-     
-    /* Get last part into buffer */
-    localRange.location = aRange.location + aRange.length;
-    localRange.length = selfLen - localRange.location;
-    [self getCharacters:(buffer+aRange.location+aStringLen) range:localRange];
-    
-    /* Build output string */
-    result = [NSString stringWithCharacters:buffer length:bufferSize];
-    
-    NSDeallocateMemoryPages(buffer, bufferSize);
-    
-    return result;
-}
-
-@end
-
-
-
-#ifdef main
-#  undef main
-#endif
-
-
-/* Main entry point to executable - should *not* be SDL_main! */
-int main (int argc, char **argv)
-{
-    /* Copy the arguments into a global variable */
-    /* This is passed if we are launched by double-clicking */
-    if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
-        gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
-        gArgv[0] = argv[0];
-        gArgv[1] = NULL;
-        gArgc = 1;
-        gFinderLaunch = YES;
-		
-		/* check to see if there are any .love files in Resources - props to stevejohnson/diordna */
-		NSArray *lovePaths = [[NSBundle mainBundle] pathsForResourcesOfType:@"love" inDirectory:nil];
-		if ([lovePaths count] > 0) { /* there are, load the first one we found and run it */
-			NSString *firstLovePath = [lovePaths objectAtIndex:0];
-			gCalledAppMainline = YES;
-			//NSLog(firstLovePath);
-			
-			const char *temparg;
-			size_t arglen;
-			char *arg;
-			char **newargv;
-			
-			temparg = [firstLovePath UTF8String];
-			arglen = SDL_strlen(temparg) + 1;
-			arg = (char *)SDL_malloc(arglen);
-			if (arg == NULL)
-				return FALSE;
-			newargv = (char **)realloc(gArgv, sizeof(char *) * (gArgc + 2));
-			if (newargv == NULL) {
-				SDL_free(arg);
-				return FALSE;
-			}
-			gArgv = newargv;
-			SDL_strlcpy(arg, temparg, arglen);
-			gArgv[gArgc++] = arg;
-			gArgv[gArgc] = NULL;
-		}
-    } else {
-        int i;
-        gArgc = argc;
-        gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
-        for (i = 0; i <= argc; i++)
-            gArgv[i] = argv[i];
-        gFinderLaunch = NO;
-    }
-
-#if SDL_USE_NIB_FILE
-    [SDLApplication poseAsClass:[NSApplication class]];
-    NSApplicationMain (argc, argv);
-#else
-    CustomApplicationMain (argc, argv);
-#endif
-    return 0;
-}

+ 0 - 53
platform/macosx/autobuild

@@ -1,53 +0,0 @@
-#!/bin/bash
-
-cd ../..
-
-# Check which revision to build.
-if [ -z $2 ]; then
-	buildrev="tip"
-else
-	buildrev=$2
-fi
-
-# Update to the appropriate revision.
-hg pull
-hg update $buildrev
-
-# Set the displayversion.
-if [ -z $3 ]; then
-	if [ "$buildrev" == "tip" ]; then
-		# Get the current SVN version, use sed to remove any non-numbers.
-		currentversion=`hg log -l1 | grep changeset | sed 's/.*://g'`
-		currentdate=`date +%Y%m%d`
-		displayversion="$currentdate-$currentversion"
-	else
-		# The revision is already specified, so we'll use that as the 
-		# display version.
-		displayversion="$buildrev"
-	fi
-else
-	# If the param is present, it overrides everything else.
-	displayversion=$3
-fi
-
-cd platform/macosx
-
-outfile="love-$displayversion-macosx-ub"
-outdmg="$outfile.dmg"
-outlog="$outfile.log"
-
-xcodebuild > $outlog 2>&1
-
-cp love.dmg $outdmg
-
-# Deal with uploading.
-if [ "$1" == "build" ]; then
-	pass=`cat pwtehlol`
-	ftp -u ftp://love2d:[email protected]/public_html/builds/files/$outdmg $outdmg
-	ftp -u ftp://love2d:[email protected]/public_html/builds/files/$outlog $outlog
-fi
-
-if [ "$1" == "release" ]; then
-	echo "release"
-fi
-

+ 6 - 6
platform/macosx/love-Info.plist

@@ -13,12 +13,12 @@
 			<string>LÖVE Project</string>
 			<string>LÖVE Project</string>
 			<key>CFBundleTypeRole</key>
 			<key>CFBundleTypeRole</key>
 			<string>Viewer</string>
 			<string>Viewer</string>
+			<key>LSHandlerRank</key>
+			<string>Owner</string>
 			<key>LSItemContentTypes</key>
 			<key>LSItemContentTypes</key>
 			<array>
 			<array>
 				<string>org.love2d.love-game</string>
 				<string>org.love2d.love-game</string>
 			</array>
 			</array>
-			<key>LSHandlerRank</key>
-			<string>Owner</string>
 		</dict>
 		</dict>
 		<dict>
 		<dict>
 			<key>CFBundleTypeName</key>
 			<key>CFBundleTypeName</key>
@@ -46,13 +46,13 @@
 	<key>CFBundlePackageType</key>
 	<key>CFBundlePackageType</key>
 	<string>APPL</string>
 	<string>APPL</string>
 	<key>CFBundleShortVersionString</key>
 	<key>CFBundleShortVersionString</key>
-	<string>0.8.0</string>
+	<string>0.9.0</string>
 	<key>CFBundleSignature</key>
 	<key>CFBundleSignature</key>
 	<string>LoVe</string>
 	<string>LoVe</string>
+	<key>LSApplicationCategoryType</key>
+	<string>public.app-category.games</string>
 	<key>NSHumanReadableCopyright</key>
 	<key>NSHumanReadableCopyright</key>
-	<string>© 2006-2013 LÖVE Development Team</string>
-	<key>NSMainNibFile</key>
-	<string>SDLMain</string>
+	<string>© 2006-2014 LÖVE Development Team</string>
 	<key>NSPrincipalClass</key>
 	<key>NSPrincipalClass</key>
 	<string>NSApplication</string>
 	<string>NSApplication</string>
 	<key>UTExportedTypeDeclarations</key>
 	<key>UTExportedTypeDeclarations</key>

File diff suppressed because it is too large
+ 449 - 85
platform/macosx/love-framework.xcodeproj/project.pbxproj


+ 40 - 49
platform/macosx/love.xcodeproj/project.pbxproj

@@ -8,16 +8,11 @@
 
 
 /* Begin PBXBuildFile section */
 /* Begin PBXBuildFile section */
 		8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
 		8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
-		A911D3C915DFF25D005B7EB8 /* Game_Music_Emu.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A911D3C715DFF24D005B7EB8 /* Game_Music_Emu.framework */; };
 		A9255DD11043183600BA1496 /* FreeType.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E4810420B4A007D418B /* FreeType.framework */; };
 		A9255DD11043183600BA1496 /* FreeType.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E4810420B4A007D418B /* FreeType.framework */; };
-		A9255DD21043183600BA1496 /* SDL.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5210420B57007D418B /* SDL.framework */; };
 		A9255DD31043183600BA1496 /* Lua.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5310420B57007D418B /* Lua.framework */; };
 		A9255DD31043183600BA1496 /* Lua.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5310420B57007D418B /* Lua.framework */; };
-		A9255DEC1043188D00BA1496 /* SDLMain.m in Sources */ = {isa = PBXBuildFile; fileRef = A9255DEA1043188D00BA1496 /* SDLMain.m */; };
 		A9255E031043195A00BA1496 /* Vorbis.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255E021043195A00BA1496 /* Vorbis.framework */; };
 		A9255E031043195A00BA1496 /* Vorbis.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255E021043195A00BA1496 /* Vorbis.framework */; };
 		A9255F431043240F00BA1496 /* IL.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255F421043240F00BA1496 /* IL.framework */; };
 		A9255F431043240F00BA1496 /* IL.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255F421043240F00BA1496 /* IL.framework */; };
 		A9255F58104324E100BA1496 /* Ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255F51104324D700BA1496 /* Ogg.framework */; };
 		A9255F58104324E100BA1496 /* Ogg.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9255F51104324D700BA1496 /* Ogg.framework */; };
-		A93E6E4A10420B4A007D418B /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E4710420B4A007D418B /* OpenGL.framework */; };
-		A93E6E5410420B57007D418B /* SDL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5210420B57007D418B /* SDL.framework */; };
 		A93E6E5510420B57007D418B /* Lua.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5310420B57007D418B /* Lua.framework */; };
 		A93E6E5510420B57007D418B /* Lua.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E6E5310420B57007D418B /* Lua.framework */; };
 		A93E6EED10420BA8007D418B /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A3410420AC0007D418B /* love.cpp */; };
 		A93E6EED10420BA8007D418B /* love.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A93E6A3410420AC0007D418B /* love.cpp */; };
 		A9D307F2106635D3004FEDF8 /* physfs.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9D307E9106635C3004FEDF8 /* physfs.framework */; };
 		A9D307F2106635D3004FEDF8 /* physfs.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9D307E9106635C3004FEDF8 /* physfs.framework */; };
@@ -27,7 +22,10 @@
 		A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F16926109E7BAD00FC83D1 /* libmodplug.framework */; };
 		A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = A9F16926109E7BAD00FC83D1 /* libmodplug.framework */; };
 		FA08F69616C766E000F007B5 /* love.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; };
 		FA08F69616C766E000F007B5 /* love.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; };
 		FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; };
 		FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA08F69116C765A200F007B5 /* love.framework */; };
+		FA9B4A0A16E1579F00074F42 /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0916E1579F00074F42 /* SDL2.framework */; };
+		FA9B4A0B16E157B500074F42 /* SDL2.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FA9B4A0916E1579F00074F42 /* SDL2.framework */; };
 		FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */; };
 		FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */ = {isa = PBXBuildFile; fileRef = FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */; };
+		FAC8E8D416F3C468004DADF3 /* OSX.mm in Sources */ = {isa = PBXBuildFile; fileRef = FAC8E8D316F3C468004DADF3 /* OSX.mm */; };
 /* End PBXBuildFile section */
 /* End PBXBuildFile section */
 
 
 /* Begin PBXContainerItemProxy section */
 /* Begin PBXContainerItemProxy section */
@@ -48,6 +46,7 @@
 			dstSubfolderSpec = 10;
 			dstSubfolderSpec = 10;
 			files = (
 			files = (
 				FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */,
 				FA08F69716C766E700F007B5 /* love.framework in Copy Frameworks */,
+				FA9B4A0B16E157B500074F42 /* SDL2.framework in Copy Frameworks */,
 				FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */,
 				FAAFF04716CB120000CCDE45 /* OpenAL-Soft.framework in Copy Frameworks */,
 				A9F169AC109E825000FC83D1 /* mpg123.framework in Copy Frameworks */,
 				A9F169AC109E825000FC83D1 /* mpg123.framework in Copy Frameworks */,
 				A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */,
 				A9F169AD109E825000FC83D1 /* libmodplug.framework in Copy Frameworks */,
@@ -56,9 +55,7 @@
 				A9255F431043240F00BA1496 /* IL.framework in Copy Frameworks */,
 				A9255F431043240F00BA1496 /* IL.framework in Copy Frameworks */,
 				A9255E031043195A00BA1496 /* Vorbis.framework in Copy Frameworks */,
 				A9255E031043195A00BA1496 /* Vorbis.framework in Copy Frameworks */,
 				A9255DD11043183600BA1496 /* FreeType.framework in Copy Frameworks */,
 				A9255DD11043183600BA1496 /* FreeType.framework in Copy Frameworks */,
-				A9255DD21043183600BA1496 /* SDL.framework in Copy Frameworks */,
 				A9255DD31043183600BA1496 /* Lua.framework in Copy Frameworks */,
 				A9255DD31043183600BA1496 /* Lua.framework in Copy Frameworks */,
-				A911D3C915DFF25D005B7EB8 /* Game_Music_Emu.framework in Copy Frameworks */,
 			);
 			);
 			name = "Copy Frameworks";
 			name = "Copy Frameworks";
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -68,19 +65,14 @@
 /* Begin PBXFileReference section */
 /* Begin PBXFileReference section */
 		1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
 		1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
 		8D1107320486CEB800E47090 /* love.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = love.app; sourceTree = BUILT_PRODUCTS_DIR; };
 		8D1107320486CEB800E47090 /* love.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = love.app; sourceTree = BUILT_PRODUCTS_DIR; };
-		A911D3C715DFF24D005B7EB8 /* Game_Music_Emu.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Game_Music_Emu.framework; path = /Library/Frameworks/Game_Music_Emu.framework; sourceTree = "<absolute>"; };
-		A9255DEA1043188D00BA1496 /* SDLMain.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SDLMain.m; sourceTree = "<group>"; };
-		A9255DEB1043188D00BA1496 /* SDLMain.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDLMain.h; sourceTree = "<group>"; };
 		A9255E021043195A00BA1496 /* Vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Vorbis.framework; path = /Library/Frameworks/Vorbis.framework; sourceTree = "<absolute>"; };
 		A9255E021043195A00BA1496 /* Vorbis.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Vorbis.framework; path = /Library/Frameworks/Vorbis.framework; sourceTree = "<absolute>"; };
 		A9255F421043240F00BA1496 /* IL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IL.framework; path = /Library/Frameworks/IL.framework; sourceTree = "<absolute>"; };
 		A9255F421043240F00BA1496 /* IL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IL.framework; path = /Library/Frameworks/IL.framework; sourceTree = "<absolute>"; };
 		A9255F51104324D700BA1496 /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = /Library/Frameworks/Ogg.framework; sourceTree = "<absolute>"; };
 		A9255F51104324D700BA1496 /* Ogg.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Ogg.framework; path = /Library/Frameworks/Ogg.framework; sourceTree = "<absolute>"; };
 		A93E6A3410420AC0007D418B /* love.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = love.cpp; path = ../../src/love.cpp; sourceTree = "<group>"; };
 		A93E6A3410420AC0007D418B /* love.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = love.cpp; path = ../../src/love.cpp; sourceTree = "<group>"; };
 		A93E6E4710420B4A007D418B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
 		A93E6E4710420B4A007D418B /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
 		A93E6E4810420B4A007D418B /* FreeType.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FreeType.framework; path = /Library/Frameworks/FreeType.framework; sourceTree = "<absolute>"; };
 		A93E6E4810420B4A007D418B /* FreeType.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = FreeType.framework; path = /Library/Frameworks/FreeType.framework; sourceTree = "<absolute>"; };
-		A93E6E5210420B57007D418B /* SDL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL.framework; path = /Library/Frameworks/SDL.framework; sourceTree = "<absolute>"; };
 		A93E6E5310420B57007D418B /* Lua.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lua.framework; path = /Library/Frameworks/Lua.framework; sourceTree = "<absolute>"; };
 		A93E6E5310420B57007D418B /* Lua.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Lua.framework; path = /Library/Frameworks/Lua.framework; sourceTree = "<absolute>"; };
 		A97E3842132A9EDE00198A2F /* love-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "love-Info.plist"; sourceTree = "<group>"; };
 		A97E3842132A9EDE00198A2F /* love-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "love-Info.plist"; sourceTree = "<group>"; };
-		A9B1AE451197293000D496EB /* love_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = love_Prefix.pch; sourceTree = "<group>"; };
 		A9D307E9106635C3004FEDF8 /* physfs.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = physfs.framework; path = /Library/Frameworks/physfs.framework; sourceTree = "<absolute>"; };
 		A9D307E9106635C3004FEDF8 /* physfs.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = physfs.framework; path = /Library/Frameworks/physfs.framework; sourceTree = "<absolute>"; };
 		A9DEC1BF1046EFA60049C70C /* Love.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Love.icns; path = icons/Love.icns; sourceTree = "<group>"; };
 		A9DEC1BF1046EFA60049C70C /* Love.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = Love.icns; path = icons/Love.icns; sourceTree = "<group>"; };
 		A9DEC1C01046EFA70049C70C /* LoveDocument.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = LoveDocument.icns; path = icons/LoveDocument.icns; sourceTree = "<group>"; };
 		A9DEC1C01046EFA70049C70C /* LoveDocument.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; name = LoveDocument.icns; path = icons/LoveDocument.icns; sourceTree = "<group>"; };
@@ -88,7 +80,10 @@
 		A9F169A6109E824900FC83D1 /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = /Library/Frameworks/mpg123.framework; sourceTree = "<absolute>"; };
 		A9F169A6109E824900FC83D1 /* mpg123.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = mpg123.framework; path = /Library/Frameworks/mpg123.framework; sourceTree = "<absolute>"; };
 		FA08F69116C765A200F007B5 /* love.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = love.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		FA08F69116C765A200F007B5 /* love.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = love.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 		FA577A9316C7217800860150 /* love-framework.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "love-framework.xcodeproj"; sourceTree = "<group>"; };
 		FA577A9316C7217800860150 /* love-framework.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = "love-framework.xcodeproj"; sourceTree = "<group>"; };
+		FA9B4A0916E1579F00074F42 /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = /Library/Frameworks/SDL2.framework; sourceTree = "<absolute>"; };
 		FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = "<absolute>"; };
 		FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = "OpenAL-Soft.framework"; path = "/Library/Frameworks/OpenAL-Soft.framework"; sourceTree = "<absolute>"; };
+		FAC8E8D316F3C468004DADF3 /* OSX.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = OSX.mm; sourceTree = "<group>"; };
+		FAC8E8D616F3C46E004DADF3 /* OSX.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = OSX.h; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 /* End PBXFileReference section */
 
 
 /* Begin PBXFrameworksBuildPhase section */
 /* Begin PBXFrameworksBuildPhase section */
@@ -98,9 +93,8 @@
 			files = (
 			files = (
 				FA08F69616C766E000F007B5 /* love.framework in Frameworks */,
 				FA08F69616C766E000F007B5 /* love.framework in Frameworks */,
 				8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
 				8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
-				A93E6E4A10420B4A007D418B /* OpenGL.framework in Frameworks */,
-				A93E6E5410420B57007D418B /* SDL.framework in Frameworks */,
 				A93E6E5510420B57007D418B /* Lua.framework in Frameworks */,
 				A93E6E5510420B57007D418B /* Lua.framework in Frameworks */,
+				FA9B4A0A16E1579F00074F42 /* SDL2.framework in Frameworks */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		};
@@ -110,9 +104,9 @@
 		1058C7A0FEA54F0111CA2CBB /* Frameworks */ = {
 		1058C7A0FEA54F0111CA2CBB /* Frameworks */ = {
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
+				FA9B4A0916E1579F00074F42 /* SDL2.framework */,
 				1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
 				1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
 				A93E6E4810420B4A007D418B /* FreeType.framework */,
 				A93E6E4810420B4A007D418B /* FreeType.framework */,
-				A911D3C715DFF24D005B7EB8 /* Game_Music_Emu.framework */,
 				A9255F421043240F00BA1496 /* IL.framework */,
 				A9255F421043240F00BA1496 /* IL.framework */,
 				A9F16926109E7BAD00FC83D1 /* libmodplug.framework */,
 				A9F16926109E7BAD00FC83D1 /* libmodplug.framework */,
 				FA08F69116C765A200F007B5 /* love.framework */,
 				FA08F69116C765A200F007B5 /* love.framework */,
@@ -122,7 +116,6 @@
 				FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */,
 				FAAFF04616CB120000CCDE45 /* OpenAL-Soft.framework */,
 				A93E6E4710420B4A007D418B /* OpenGL.framework */,
 				A93E6E4710420B4A007D418B /* OpenGL.framework */,
 				A9D307E9106635C3004FEDF8 /* physfs.framework */,
 				A9D307E9106635C3004FEDF8 /* physfs.framework */,
-				A93E6E5210420B57007D418B /* SDL.framework */,
 				A9255E021043195A00BA1496 /* Vorbis.framework */,
 				A9255E021043195A00BA1496 /* Vorbis.framework */,
 			);
 			);
 			name = Frameworks;
 			name = Frameworks;
@@ -171,9 +164,8 @@
 			isa = PBXGroup;
 			isa = PBXGroup;
 			children = (
 			children = (
 				A93E6A3410420AC0007D418B /* love.cpp */,
 				A93E6A3410420AC0007D418B /* love.cpp */,
-				A9255DEA1043188D00BA1496 /* SDLMain.m */,
-				A9255DEB1043188D00BA1496 /* SDLMain.h */,
-				A9B1AE451197293000D496EB /* love_Prefix.pch */,
+				FAC8E8D616F3C46E004DADF3 /* OSX.h */,
+				FAC8E8D316F3C468004DADF3 /* OSX.mm */,
 			);
 			);
 			name = Source;
 			name = Source;
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -206,7 +198,7 @@
 		29B97313FDCFA39411CA2CEA /* Project object */ = {
 		29B97313FDCFA39411CA2CEA /* Project object */ = {
 			isa = PBXProject;
 			isa = PBXProject;
 			attributes = {
 			attributes = {
-				LastUpgradeCheck = 0460;
+				LastUpgradeCheck = 0500;
 			};
 			};
 			buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "love" */;
 			buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "love" */;
 			compatibilityVersion = "Xcode 3.2";
 			compatibilityVersion = "Xcode 3.2";
@@ -261,7 +253,7 @@
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
 				A93E6EED10420BA8007D418B /* love.cpp in Sources */,
 				A93E6EED10420BA8007D418B /* love.cpp in Sources */,
-				A9255DEC1043188D00BA1496 /* SDLMain.m in Sources */,
+				FAC8E8D416F3C468004DADF3 /* OSX.mm in Sources */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;
 		};
 		};
@@ -279,15 +271,6 @@
 				);
 				);
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_DYNAMIC_NO_PIC = NO;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_OPTIMIZATION_LEVEL = 0;
-				GCC_PRECOMPILE_PREFIX_HEADER = YES;
-				GCC_PREFIX_HEADER = love_Prefix.pch;
-				HEADER_SEARCH_PATHS = (
-					"\"$(SRCROOT)/../../src\"",
-					"\"$(SRCROOT)/../../src/libraries\"",
-					"\"$(SRCROOT)/../../src/modules\"",
-					/Library/Frameworks/Lua.framework/Headers,
-					/Library/Frameworks/SDL.framework/Headers,
-				);
 				INSTALL_PATH = /Applications;
 				INSTALL_PATH = /Applications;
 				PRODUCT_NAME = love;
 				PRODUCT_NAME = love;
 			};
 			};
@@ -303,15 +286,6 @@
 					"\"$(SRCROOT)/build/Release\"",
 					"\"$(SRCROOT)/build/Release\"",
 					"\"$(SRCROOT)/build/Debug\"",
 					"\"$(SRCROOT)/build/Debug\"",
 				);
 				);
-				GCC_PRECOMPILE_PREFIX_HEADER = YES;
-				GCC_PREFIX_HEADER = love_Prefix.pch;
-				HEADER_SEARCH_PATHS = (
-					"\"$(SRCROOT)/../../src\"",
-					"\"$(SRCROOT)/../../src/libraries\"",
-					"\"$(SRCROOT)/../../src/modules\"",
-					/Library/Frameworks/Lua.framework/Headers,
-					/Library/Frameworks/SDL.framework/Headers,
-				);
 				INSTALL_PATH = /Applications;
 				INSTALL_PATH = /Applications;
 				PRODUCT_NAME = love;
 				PRODUCT_NAME = love;
 			};
 			};
@@ -321,10 +295,13 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_ENABLE_MODULES = YES;
 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES;
 				GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES;
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_OPTIMIZATION_LEVEL = 0;
+				GCC_PREPROCESSOR_DEFINITIONS = LOVE_MACOSX_USE_FRAMEWORKS;
 				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO;
 				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO;
 				GCC_WARN_ABOUT_MISSING_NEWLINE = NO;
 				GCC_WARN_ABOUT_MISSING_NEWLINE = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
@@ -346,14 +323,19 @@
 					"\"$(SRCROOT)/../../src/libraries\"",
 					"\"$(SRCROOT)/../../src/libraries\"",
 					"\"$(SRCROOT)/../../src/modules\"",
 					"\"$(SRCROOT)/../../src/modules\"",
 					/Library/Frameworks/Lua.framework/Headers,
 					/Library/Frameworks/Lua.framework/Headers,
-					/Library/Frameworks/FreeType.framework/Headers,
-					/Library/Frameworks/SDL.framework/Headers,
+					/Library/Frameworks/SDL2.framework/Headers,
 				);
 				);
 				INFOPLIST_FILE = "love-Info.plist";
 				INFOPLIST_FILE = "love-Info.plist";
-				LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @loader_path/../Libraries";
-				MACOSX_DEPLOYMENT_TARGET = 10.5;
+				LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				ONLY_ACTIVE_ARCH = YES;
 				ONLY_ACTIVE_ARCH = YES;
 				OTHER_LDFLAGS = "";
 				OTHER_LDFLAGS = "";
+				"OTHER_LDFLAGS[arch=x86_64]" = (
+					"-pagezero_size",
+					10000,
+					"-image_base",
+					100000000,
+				);
 				PRODUCT_NAME = love;
 				PRODUCT_NAME = love;
 				WARNING_CFLAGS = (
 				WARNING_CFLAGS = (
 					"-Wall",
 					"-Wall",
@@ -366,10 +348,14 @@
 			isa = XCBuildConfiguration;
 			isa = XCBuildConfiguration;
 			buildSettings = {
 			buildSettings = {
 				ALWAYS_SEARCH_USER_PATHS = NO;
 				ALWAYS_SEARCH_USER_PATHS = NO;
-				ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
+				ARCHS = "$(ARCHS_STANDARD_64_BIT)";
+				CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
+				CLANG_ENABLE_MODULES = YES;
 				DEPLOYMENT_POSTPROCESSING = NO;
 				DEPLOYMENT_POSTPROCESSING = NO;
 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				FRAMEWORK_SEARCH_PATHS = /Library/Frameworks;
 				GCC_INPUT_FILETYPE = automatic;
 				GCC_INPUT_FILETYPE = automatic;
+				GCC_OPTIMIZATION_LEVEL = 3;
+				GCC_PREPROCESSOR_DEFINITIONS = LOVE_MACOSX_USE_FRAMEWORKS;
 				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO;
 				GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = NO;
 				GCC_WARN_ABOUT_MISSING_NEWLINE = NO;
 				GCC_WARN_ABOUT_MISSING_NEWLINE = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
 				GCC_WARN_ABOUT_MISSING_PROTOTYPES = NO;
@@ -393,15 +379,20 @@
 					"\"$(SRCROOT)/../../src/libraries\"",
 					"\"$(SRCROOT)/../../src/libraries\"",
 					"\"$(SRCROOT)/../../src/modules\"",
 					"\"$(SRCROOT)/../../src/modules\"",
 					/Library/Frameworks/Lua.framework/Headers,
 					/Library/Frameworks/Lua.framework/Headers,
-					/Library/Frameworks/FreeType.framework/Headers,
-					/Library/Frameworks/SDL.framework/Headers,
+					/Library/Frameworks/SDL2.framework/Headers,
 				);
 				);
 				INFOPLIST_FILE = "love-Info.plist";
 				INFOPLIST_FILE = "love-Info.plist";
-				LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks @loader_path/../Libraries";
+				LD_RUNPATH_SEARCH_PATHS = "@loader_path/../Frameworks";
 				LLVM_LTO = YES;
 				LLVM_LTO = YES;
-				MACOSX_DEPLOYMENT_TARGET = 10.5;
+				MACOSX_DEPLOYMENT_TARGET = 10.6;
 				ONLY_ACTIVE_ARCH = NO;
 				ONLY_ACTIVE_ARCH = NO;
 				OTHER_LDFLAGS = "";
 				OTHER_LDFLAGS = "";
+				"OTHER_LDFLAGS[arch=x86_64]" = (
+					"-pagezero_size",
+					10000,
+					"-image_base",
+					100000000,
+				);
 				PRODUCT_NAME = love;
 				PRODUCT_NAME = love;
 				SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES;
 				SCAN_ALL_SOURCE_FILES_FOR_INCLUDES = YES;
 				WARNING_CFLAGS = (
 				WARNING_CFLAGS = (

+ 0 - 8
platform/macosx/loveProj.xcconfig

@@ -1,8 +0,0 @@
-	GCC_ENABLE_CPP_EXCEPTIONS = YES;
-	GCC_ENABLE_CPP_RTTI = YES;
-	GCC_WARN_ABOUT_RETURN_TYPE = YES;
-	GCC_WARN_UNUSED_VARIABLE = YES;
-	GCC_INCREASE_PRECOMPILED_HEADER_SHARING = YES;
-	GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
-	PREBINDING = NO;
-	INFOPLIST_EXPAND_BUILD_SETTINGS = YES;

+ 0 - 7
platform/macosx/loveTarget.xcconfig

@@ -1,7 +0,0 @@
-	GCC_PRECOMPILE_PREFIX_HEADER = YES;
-	GCC_PREFIX_HEADER = love_Prefix.pch;
-	INFOPLIST_FILE = Info.plist;
-	INSTALL_PATH = $(HOME)/Applications;
-	PRODUCT_NAME = 	love;
-	STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = Dynamic;
-	GCC_SYMBOLS_PRIVATE_EXTERN = NO;

+ 0 - 7
platform/macosx/love_Prefix.pch

@@ -1,7 +0,0 @@
-//
-// Prefix header for all source files of the 'love' target in the 'love' project
-//
-
-#ifdef __OBJC__
-    #import <Cocoa/Cocoa.h>
-#endif

+ 0 - 28
platform/macosx/script.sh

@@ -1,28 +0,0 @@
-#! /bin/sh
-#Use install_name_tool, make love to search libs in its own framework folder instead
-#*very* hackish.
-#IL
-install_name_tool -change /usr/local/lib/libIL.dylib @executable_path/../Frameworks/IL.framework/Versions/A/IL build/Release/love.app/Contents/MacOS/love
-
-install_name_tool -change /usr/local/lib/libILU.dylib @executable_path/../Frameworks/IL.framework/Versions/A/IL build/Release/love.app/Contents/MacOS/love
-
-install_name_tool -change /usr/local/lib/libILUT.dylib @executable_path/../Frameworks/IL.framework/Versions/A/IL build/Release/love.app/Contents/MacOS/love
-
-install_name_tool -change /usr/local/lib/libIL.1.dylib @executable_path/../Frameworks/IL.framework/Versions/A/IL build/Release/love.app/Contents/MacOS/love
-
-install_name_tool -change /usr/local/lib/libILU.1.dylib @executable_path/../Frameworks/IL.framework/Versions/A/IL build/Release/love.app/Contents/MacOS/love
-
-install_name_tool -change /usr/local/lib/libILUT.1.dylib @executable_path/../Frameworks/IL.framework/Versions/A/IL build/Release/love.app/Contents/MacOS/love
-
-# FreeType
-install_name_tool -change /Library/Frameworks/FreeType.framework/Versions/2.3/FreeType @executable_path/../Frameworks/FreeType.framework/Versions/2.3/FreeType build/Release/love.app/Contents/MacOS/love
-
-# SDL
-install_name_tool -change /Library/Frameworks/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL build/Release/love.app/Contents/MacOS/love
-
-install_name_tool -change /Library/Frameworks/SDL.framework/Versions/A/SDL @executable_path/../Frameworks/SDL.framework/Versions/A/SDL build/Release/love.app/Contents/Frameworks/SDL_mixer.framework/SDL_mixer
-
-# SDL_mixer
-#install_name_tool -change /Library/Frameworks/SDL_mixer.framework/Versions/A/SDL_mixer @executable_path/../#Frameworks/SDL_mixer.framework/Versions/A/SDL_mixer build/Release/love.app/Contents/MacOS/love
-
-exit 0

+ 136 - 33
platform/msvc2010/liblove.vcxproj

@@ -144,7 +144,7 @@
     <ClCompile>
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;..\..\src\libraries\enet\libenet\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>false</MinimalRebuild>
       <MinimalRebuild>false</MinimalRebuild>
@@ -154,10 +154,11 @@
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <IgnoreAllDefaultLibraries>
-      </IgnoreAllDefaultLibraries>
+      <AdditionalDependencies>msvcrtd.lib;msvcprtd.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;winmm.lib;opengl32.lib;oldnames.lib;DevIL.lib;freetype.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;mpg123.lib;physfs.lib;OpenAL.lib;zlib.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Debug\MD\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Debug\MD\</AdditionalLibraryDirectories>
+      <ProgramDatabaseFile>$(TargetDir)lib$(TargetName).pdb</ProgramDatabaseFile>
+      <ProfileGuidedDatabase>$(TargetDir)lib$(TargetName).pgd</ProfileGuidedDatabase>
     </Link>
     </Link>
     <ResourceCompile>
     <ResourceCompile>
       <PreprocessorDefinitions>LOVE_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>LOVE_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -167,7 +168,7 @@
     <ClCompile>
     <ClCompile>
       <WarningLevel>Level3</WarningLevel>
       <WarningLevel>Level3</WarningLevel>
       <Optimization>Disabled</Optimization>
       <Optimization>Disabled</Optimization>
-      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;..\..\src\libraries\enet\libenet\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>_DEBUG;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>false</MinimalRebuild>
       <MinimalRebuild>false</MinimalRebuild>
@@ -177,10 +178,11 @@
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <IgnoreAllDefaultLibraries>
-      </IgnoreAllDefaultLibraries>
+      <AdditionalDependencies>msvcrtd.lib;msvcprtd.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;winmm.lib;opengl32.lib;oldnames.lib;DevIL.lib;freetype.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;mpg123.lib;physfs.lib;OpenAL.lib;zlib.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Debug\MD\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Debug\MD\</AdditionalLibraryDirectories>
+      <ProgramDatabaseFile>$(TargetDir)lib$(TargetName).pdb</ProgramDatabaseFile>
+      <ProfileGuidedDatabase>$(TargetDir)lib$(TargetName).pgd</ProfileGuidedDatabase>
     </Link>
     </Link>
     <ResourceCompile>
     <ResourceCompile>
       <PreprocessorDefinitions>LOVE_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>LOVE_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -192,7 +194,7 @@
       <Optimization>MaxSpeed</Optimization>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;..\..\src\libraries\enet\libenet\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <OmitFramePointers>true</OmitFramePointers>
       <OmitFramePointers>true</OmitFramePointers>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -211,6 +213,12 @@
     </ResourceCompile>
     </ResourceCompile>
     <Lib>
     <Lib>
       <TargetMachine>MachineX86</TargetMachine>
       <TargetMachine>MachineX86</TargetMachine>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
+      <AdditionalLibraryDirectories>
+      </AdditionalLibraryDirectories>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
     </Lib>
     </Lib>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
@@ -219,7 +227,7 @@
       <Optimization>MaxSpeed</Optimization>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;..\..\src\libraries\enet\libenet\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <OmitFramePointers>true</OmitFramePointers>
       <OmitFramePointers>true</OmitFramePointers>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -238,6 +246,12 @@
     </ResourceCompile>
     </ResourceCompile>
     <Lib>
     <Lib>
       <TargetMachine>MachineX64</TargetMachine>
       <TargetMachine>MachineX64</TargetMachine>
+      <AdditionalDependencies>
+      </AdditionalDependencies>
+      <AdditionalLibraryDirectories>
+      </AdditionalLibraryDirectories>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
     </Lib>
     </Lib>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dynamic|Win32'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dynamic|Win32'">
@@ -246,7 +260,7 @@
       <Optimization>MaxSpeed</Optimization>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;..\..\src\libraries\enet\libenet\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <OmitFramePointers>true</OmitFramePointers>
       <OmitFramePointers>true</OmitFramePointers>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -259,10 +273,11 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <IgnoreAllDefaultLibraries>
-      </IgnoreAllDefaultLibraries>
+      <AdditionalDependencies>msvcrt.lib;msvcprt.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;winmm.lib;opengl32.lib;oldnames.lib;DevIL.lib;freetype.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;mpg123.lib;physfs.lib;OpenAL.lib;zlib.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MD\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MD\</AdditionalLibraryDirectories>
+      <ProgramDatabaseFile>$(TargetDir)lib$(TargetName).pdb</ProgramDatabaseFile>
+      <ProfileGuidedDatabase>$(TargetDir)lib$(TargetName).pgd</ProfileGuidedDatabase>
     </Link>
     </Link>
     <ResourceCompile>
     <ResourceCompile>
       <PreprocessorDefinitions>LOVE_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>LOVE_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -274,7 +289,7 @@
       <Optimization>MaxSpeed</Optimization>
       <Optimization>MaxSpeed</Optimization>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <IntrinsicFunctions>true</IntrinsicFunctions>
-      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>include;include\SDL;include\AL;..\..\src;..\..\src\libraries;..\..\src\modules;..\..\src\libraries\enet\libenet\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <MultiProcessorCompilation>true</MultiProcessorCompilation>
       <OmitFramePointers>true</OmitFramePointers>
       <OmitFramePointers>true</OmitFramePointers>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -287,10 +302,11 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
-      <IgnoreAllDefaultLibraries>
-      </IgnoreAllDefaultLibraries>
+      <AdditionalDependencies>msvcrt.lib;msvcprt.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;winmm.lib;opengl32.lib;oldnames.lib;DevIL.lib;freetype.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;mpg123.lib;physfs.lib;OpenAL.lib;zlib.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MD\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MD\</AdditionalLibraryDirectories>
+      <ProgramDatabaseFile>$(TargetDir)lib$(TargetName).pdb</ProgramDatabaseFile>
+      <ProfileGuidedDatabase>$(TargetDir)lib$(TargetName).pgd</ProfileGuidedDatabase>
     </Link>
     </Link>
     <ResourceCompile>
     <ResourceCompile>
       <PreprocessorDefinitions>LOVE_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions>LOVE_LIB;_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -300,7 +316,6 @@
     <ClCompile Include="..\..\src\common\b64.cpp" />
     <ClCompile Include="..\..\src\common\b64.cpp" />
     <ClCompile Include="..\..\src\common\delay.cpp" />
     <ClCompile Include="..\..\src\common\delay.cpp" />
     <ClCompile Include="..\..\src\common\Exception.cpp" />
     <ClCompile Include="..\..\src\common\Exception.cpp" />
-    <ClCompile Include="..\..\src\common\math.cpp" />
     <ClCompile Include="..\..\src\common\Matrix.cpp" />
     <ClCompile Include="..\..\src\common\Matrix.cpp" />
     <ClCompile Include="..\..\src\common\Memoizer.cpp" />
     <ClCompile Include="..\..\src\common\Memoizer.cpp" />
     <ClCompile Include="..\..\src\common\Module.cpp" />
     <ClCompile Include="..\..\src\common\Module.cpp" />
@@ -356,6 +371,16 @@
     <ClCompile Include="..\..\src\libraries\Box2D\Dynamics\Joints\b2WeldJoint.cpp" />
     <ClCompile Include="..\..\src\libraries\Box2D\Dynamics\Joints\b2WeldJoint.cpp" />
     <ClCompile Include="..\..\src\libraries\Box2D\Dynamics\Joints\b2WheelJoint.cpp" />
     <ClCompile Include="..\..\src\libraries\Box2D\Dynamics\Joints\b2WheelJoint.cpp" />
     <ClCompile Include="..\..\src\libraries\Box2D\Rope\b2Rope.cpp" />
     <ClCompile Include="..\..\src\libraries\Box2D\Rope\b2Rope.cpp" />
+    <ClCompile Include="..\..\src\libraries\ddsparse\ddsparse.cpp" />
+    <ClCompile Include="..\..\src\libraries\enet\enet.cpp" />
+    <ClCompile Include="..\..\src\libraries\enet\libenet\callbacks.c" />
+    <ClCompile Include="..\..\src\libraries\enet\libenet\compress.c" />
+    <ClCompile Include="..\..\src\libraries\enet\libenet\host.c" />
+    <ClCompile Include="..\..\src\libraries\enet\libenet\list.c" />
+    <ClCompile Include="..\..\src\libraries\enet\libenet\packet.c" />
+    <ClCompile Include="..\..\src\libraries\enet\libenet\peer.c" />
+    <ClCompile Include="..\..\src\libraries\enet\libenet\protocol.c" />
+    <ClCompile Include="..\..\src\libraries\enet\libenet\win32.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\auxiliar.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\auxiliar.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\buffer.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\buffer.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\except.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\except.c" />
@@ -370,6 +395,11 @@
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\udp.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\udp.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\wsocket.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\libluasocket\wsocket.c" />
     <ClCompile Include="..\..\src\libraries\luasocket\luasocket.cpp" />
     <ClCompile Include="..\..\src\libraries\luasocket\luasocket.cpp" />
+    <ClCompile Include="..\..\src\libraries\noise1234\simplexnoise1234.cpp" />
+    <ClCompile Include="..\..\src\libraries\Wuff\wuff.c" />
+    <ClCompile Include="..\..\src\libraries\Wuff\wuff_convert.c" />
+    <ClCompile Include="..\..\src\libraries\Wuff\wuff_internal.c" />
+    <ClCompile Include="..\..\src\libraries\Wuff\wuff_memory.c" />
     <ClCompile Include="..\..\src\modules\audio\Audio.cpp" />
     <ClCompile Include="..\..\src\modules\audio\Audio.cpp" />
     <ClCompile Include="..\..\src\modules\audio\null\Audio.cpp" />
     <ClCompile Include="..\..\src\modules\audio\null\Audio.cpp" />
     <ClCompile Include="..\..\src\modules\audio\null\Source.cpp" />
     <ClCompile Include="..\..\src\modules\audio\null\Source.cpp" />
@@ -398,7 +428,6 @@
     <ClCompile Include="..\..\src\modules\font\wrap_GlyphData.cpp" />
     <ClCompile Include="..\..\src\modules\font\wrap_GlyphData.cpp" />
     <ClCompile Include="..\..\src\modules\font\wrap_Rasterizer.cpp" />
     <ClCompile Include="..\..\src\modules\font\wrap_Rasterizer.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Drawable.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Drawable.cpp" />
-    <ClCompile Include="..\..\src\modules\graphics\DrawQable.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Graphics.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Graphics.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Image.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Image.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Canvas.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Canvas.cpp" />
@@ -406,38 +435,54 @@
     <ClCompile Include="..\..\src\modules\graphics\opengl\GLee.c" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\GLee.c" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Graphics.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Graphics.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Image.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Image.cpp" />
+    <ClCompile Include="..\..\src\modules\graphics\opengl\Mesh.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\OpenGL.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\OpenGL.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\ParticleSystem.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\ParticleSystem.cpp" />
+    <ClCompile Include="..\..\src\modules\graphics\opengl\Polyline.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Shader.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\Shader.cpp" />
-    <ClCompile Include="..\..\src\modules\graphics\opengl\Quad.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\SpriteBatch.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\SpriteBatch.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\VertexBuffer.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\VertexBuffer.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Canvas.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Canvas.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Font.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Font.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Graphics.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Graphics.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Image.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Image.cpp" />
+    <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Mesh.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_ParticleSystem.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_ParticleSystem.cpp" />
-    <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Shader.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Quad.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Quad.cpp" />
+    <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Shader.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Quad.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Quad.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Volatile.cpp" />
     <ClCompile Include="..\..\src\modules\graphics\Volatile.cpp" />
-    <ClCompile Include="..\..\src\modules\image\devil\Image.cpp" />
-    <ClCompile Include="..\..\src\modules\image\devil\ImageData.cpp" />
+    <ClCompile Include="..\..\src\modules\image\CompressedData.cpp" />
     <ClCompile Include="..\..\src\modules\image\ImageData.cpp" />
     <ClCompile Include="..\..\src\modules\image\ImageData.cpp" />
+    <ClCompile Include="..\..\src\modules\image\magpie\CompressedData.cpp" />
+    <ClCompile Include="..\..\src\modules\image\magpie\ddsHandler.cpp" />
+    <ClCompile Include="..\..\src\modules\image\magpie\DevilHandler.cpp" />
+    <ClCompile Include="..\..\src\modules\image\magpie\Image.cpp" />
+    <ClCompile Include="..\..\src\modules\image\magpie\ImageData.cpp" />
+    <ClCompile Include="..\..\src\modules\image\wrap_CompressedData.cpp" />
     <ClCompile Include="..\..\src\modules\image\wrap_Image.cpp" />
     <ClCompile Include="..\..\src\modules\image\wrap_Image.cpp" />
     <ClCompile Include="..\..\src\modules\image\wrap_ImageData.cpp" />
     <ClCompile Include="..\..\src\modules\image\wrap_ImageData.cpp" />
     <ClCompile Include="..\..\src\modules\joystick\Joystick.cpp" />
     <ClCompile Include="..\..\src\modules\joystick\Joystick.cpp" />
     <ClCompile Include="..\..\src\modules\joystick\sdl\Joystick.cpp" />
     <ClCompile Include="..\..\src\modules\joystick\sdl\Joystick.cpp" />
+    <ClCompile Include="..\..\src\modules\joystick\sdl\JoystickModule.cpp" />
     <ClCompile Include="..\..\src\modules\joystick\sdl\wrap_Joystick.cpp" />
     <ClCompile Include="..\..\src\modules\joystick\sdl\wrap_Joystick.cpp" />
+    <ClCompile Include="..\..\src\modules\joystick\sdl\wrap_JoystickModule.cpp" />
     <ClCompile Include="..\..\src\modules\keyboard\Keyboard.cpp" />
     <ClCompile Include="..\..\src\modules\keyboard\Keyboard.cpp" />
     <ClCompile Include="..\..\src\modules\keyboard\sdl\Keyboard.cpp" />
     <ClCompile Include="..\..\src\modules\keyboard\sdl\Keyboard.cpp" />
     <ClCompile Include="..\..\src\modules\keyboard\wrap_Keyboard.cpp" />
     <ClCompile Include="..\..\src\modules\keyboard\wrap_Keyboard.cpp" />
     <ClCompile Include="..\..\src\modules\love\love.cpp" />
     <ClCompile Include="..\..\src\modules\love\love.cpp" />
-    <ClCompile Include="..\..\src\modules\math\ModMath.cpp" />
+    <ClCompile Include="..\..\src\modules\math\BezierCurve.cpp" />
+    <ClCompile Include="..\..\src\modules\math\MathModule.cpp" />
+    <ClCompile Include="..\..\src\modules\math\RandomGenerator.cpp" />
+    <ClCompile Include="..\..\src\modules\math\wrap_BezierCurve.cpp" />
     <ClCompile Include="..\..\src\modules\math\wrap_Math.cpp" />
     <ClCompile Include="..\..\src\modules\math\wrap_Math.cpp" />
+    <ClCompile Include="..\..\src\modules\math\wrap_RandomGenerator.cpp" />
+    <ClCompile Include="..\..\src\modules\mouse\Cursor.cpp" />
     <ClCompile Include="..\..\src\modules\mouse\Mouse.cpp" />
     <ClCompile Include="..\..\src\modules\mouse\Mouse.cpp" />
+    <ClCompile Include="..\..\src\modules\mouse\sdl\Cursor.cpp" />
     <ClCompile Include="..\..\src\modules\mouse\sdl\Mouse.cpp" />
     <ClCompile Include="..\..\src\modules\mouse\sdl\Mouse.cpp" />
+    <ClCompile Include="..\..\src\modules\mouse\wrap_Cursor.cpp" />
     <ClCompile Include="..\..\src\modules\mouse\wrap_Mouse.cpp" />
     <ClCompile Include="..\..\src\modules\mouse\wrap_Mouse.cpp" />
     <ClCompile Include="..\..\src\modules\physics\Body.cpp" />
     <ClCompile Include="..\..\src\modules\physics\Body.cpp" />
     <ClCompile Include="..\..\src\modules\physics\box2d\Body.cpp" />
     <ClCompile Include="..\..\src\modules\physics\box2d\Body.cpp" />
@@ -490,18 +535,29 @@
     <ClCompile Include="..\..\src\modules\sound\lullaby\Mpg123Decoder.cpp" />
     <ClCompile Include="..\..\src\modules\sound\lullaby\Mpg123Decoder.cpp" />
     <ClCompile Include="..\..\src\modules\sound\lullaby\Sound.cpp" />
     <ClCompile Include="..\..\src\modules\sound\lullaby\Sound.cpp" />
     <ClCompile Include="..\..\src\modules\sound\lullaby\VorbisDecoder.cpp" />
     <ClCompile Include="..\..\src\modules\sound\lullaby\VorbisDecoder.cpp" />
+    <ClCompile Include="..\..\src\modules\sound\lullaby\WaveDecoder.cpp" />
     <ClCompile Include="..\..\src\modules\sound\Sound.cpp" />
     <ClCompile Include="..\..\src\modules\sound\Sound.cpp" />
     <ClCompile Include="..\..\src\modules\sound\SoundData.cpp" />
     <ClCompile Include="..\..\src\modules\sound\SoundData.cpp" />
     <ClCompile Include="..\..\src\modules\sound\wrap_Decoder.cpp" />
     <ClCompile Include="..\..\src\modules\sound\wrap_Decoder.cpp" />
     <ClCompile Include="..\..\src\modules\sound\wrap_Sound.cpp" />
     <ClCompile Include="..\..\src\modules\sound\wrap_Sound.cpp" />
     <ClCompile Include="..\..\src\modules\sound\wrap_SoundData.cpp" />
     <ClCompile Include="..\..\src\modules\sound\wrap_SoundData.cpp" />
-    <ClCompile Include="..\..\src\modules\thread\Thread.cpp" />
+    <ClCompile Include="..\..\src\modules\system\sdl\System.cpp" />
+    <ClCompile Include="..\..\src\modules\system\System.cpp" />
+    <ClCompile Include="..\..\src\modules\system\wrap_System.cpp" />
+    <ClCompile Include="..\..\src\modules\thread\Channel.cpp" />
+    <ClCompile Include="..\..\src\modules\thread\LuaThread.cpp" />
+    <ClCompile Include="..\..\src\modules\thread\sdl\Thread.cpp" />
+    <ClCompile Include="..\..\src\modules\thread\sdl\threads.cpp" />
+    <ClCompile Include="..\..\src\modules\thread\ThreadModule.cpp" />
     <ClCompile Include="..\..\src\modules\thread\threads.cpp" />
     <ClCompile Include="..\..\src\modules\thread\threads.cpp" />
-    <ClCompile Include="..\..\src\modules\thread\wrap_Thread.cpp" />
+    <ClCompile Include="..\..\src\modules\thread\wrap_Channel.cpp" />
+    <ClCompile Include="..\..\src\modules\thread\wrap_LuaThread.cpp" />
+    <ClCompile Include="..\..\src\modules\thread\wrap_ThreadModule.cpp" />
     <ClCompile Include="..\..\src\modules\timer\sdl\Timer.cpp" />
     <ClCompile Include="..\..\src\modules\timer\sdl\Timer.cpp" />
     <ClCompile Include="..\..\src\modules\timer\wrap_Timer.cpp" />
     <ClCompile Include="..\..\src\modules\timer\wrap_Timer.cpp" />
     <ClCompile Include="..\..\src\modules\window\sdl\Window.cpp" />
     <ClCompile Include="..\..\src\modules\window\sdl\Window.cpp" />
     <ClCompile Include="..\..\src\modules\window\Window.cpp" />
     <ClCompile Include="..\..\src\modules\window\Window.cpp" />
+    <ClCompile Include="..\..\src\modules\window\wrap_Window.cpp" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\scripts\auto.lua" />
     <None Include="..\..\src\scripts\auto.lua" />
@@ -576,6 +632,18 @@
     <ClInclude Include="..\..\src\libraries\Box2D\Dynamics\Joints\b2WeldJoint.h" />
     <ClInclude Include="..\..\src\libraries\Box2D\Dynamics\Joints\b2WeldJoint.h" />
     <ClInclude Include="..\..\src\libraries\Box2D\Dynamics\Joints\b2WheelJoint.h" />
     <ClInclude Include="..\..\src\libraries\Box2D\Dynamics\Joints\b2WheelJoint.h" />
     <ClInclude Include="..\..\src\libraries\Box2D\Rope\b2Rope.h" />
     <ClInclude Include="..\..\src\libraries\Box2D\Rope\b2Rope.h" />
+    <ClInclude Include="..\..\src\libraries\ddsparse\ddsinfo.h" />
+    <ClInclude Include="..\..\src\libraries\ddsparse\ddsparse.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\callbacks.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\enet.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\list.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\protocol.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\time.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\types.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\unix.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\utility.h" />
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\win32.h" />
+    <ClInclude Include="..\..\src\libraries\enet\lua-enet.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\auxiliar.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\auxiliar.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\buffer.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\buffer.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\except.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\except.h" />
@@ -593,10 +661,15 @@
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\url.lua.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\url.lua.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\wsocket.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\libluasocket\wsocket.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\luasocket.h" />
     <ClInclude Include="..\..\src\libraries\luasocket\luasocket.h" />
+    <ClInclude Include="..\..\src\libraries\noise1234\simplexnoise1234.h" />
     <ClInclude Include="..\..\src\libraries\utf8\utf8.h" />
     <ClInclude Include="..\..\src\libraries\utf8\utf8.h" />
     <ClInclude Include="..\..\src\libraries\utf8\utf8\checked.h" />
     <ClInclude Include="..\..\src\libraries\utf8\utf8\checked.h" />
     <ClInclude Include="..\..\src\libraries\utf8\utf8\core.h" />
     <ClInclude Include="..\..\src\libraries\utf8\utf8\core.h" />
     <ClInclude Include="..\..\src\libraries\utf8\utf8\unchecked.h" />
     <ClInclude Include="..\..\src\libraries\utf8\utf8\unchecked.h" />
+    <ClInclude Include="..\..\src\libraries\Wuff\wuff.h" />
+    <ClInclude Include="..\..\src\libraries\Wuff\wuff_config.h" />
+    <ClInclude Include="..\..\src\libraries\Wuff\wuff_convert.h" />
+    <ClInclude Include="..\..\src\libraries\Wuff\wuff_internal.h" />
     <ClInclude Include="..\..\src\modules\audio\Audio.h" />
     <ClInclude Include="..\..\src\modules\audio\Audio.h" />
     <ClInclude Include="..\..\src\modules\audio\null\Audio.h" />
     <ClInclude Include="..\..\src\modules\audio\null\Audio.h" />
     <ClInclude Include="..\..\src\modules\audio\null\Source.h" />
     <ClInclude Include="..\..\src\modules\audio\null\Source.h" />
@@ -635,39 +708,57 @@
     <ClInclude Include="..\..\src\modules\graphics\opengl\GLee.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\GLee.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Graphics.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Graphics.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Image.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Image.h" />
+    <ClInclude Include="..\..\src\modules\graphics\opengl\Mesh.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\OpenGL.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\OpenGL.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\ParticleSystem.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\ParticleSystem.h" />
+    <ClInclude Include="..\..\src\modules\graphics\opengl\Polyline.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Shader.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\Shader.h" />
-    <ClInclude Include="..\..\src\modules\graphics\opengl\Quad.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\SpriteBatch.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\SpriteBatch.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\VertexBuffer.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\VertexBuffer.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Canvas.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Canvas.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Font.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Font.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Graphics.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Graphics.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Image.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Image.h" />
+    <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Mesh.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_ParticleSystem.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_ParticleSystem.h" />
-    <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Shader.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Quad.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Quad.h" />
+    <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Shader.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.h" />
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.h" />
     <ClInclude Include="..\..\src\modules\graphics\Quad.h" />
     <ClInclude Include="..\..\src\modules\graphics\Quad.h" />
     <ClInclude Include="..\..\src\modules\graphics\Volatile.h" />
     <ClInclude Include="..\..\src\modules\graphics\Volatile.h" />
-    <ClInclude Include="..\..\src\modules\image\devil\Image.h" />
-    <ClInclude Include="..\..\src\modules\image\devil\ImageData.h" />
+    <ClInclude Include="..\..\src\modules\image\CompressedData.h" />
     <ClInclude Include="..\..\src\modules\image\Image.h" />
     <ClInclude Include="..\..\src\modules\image\Image.h" />
     <ClInclude Include="..\..\src\modules\image\ImageData.h" />
     <ClInclude Include="..\..\src\modules\image\ImageData.h" />
+    <ClInclude Include="..\..\src\modules\image\magpie\CompressedData.h" />
+    <ClInclude Include="..\..\src\modules\image\magpie\ddsHandler.h" />
+    <ClInclude Include="..\..\src\modules\image\magpie\DevilHandler.h" />
+    <ClInclude Include="..\..\src\modules\image\magpie\FormatHandler.h" />
+    <ClInclude Include="..\..\src\modules\image\magpie\Image.h" />
+    <ClInclude Include="..\..\src\modules\image\magpie\ImageData.h" />
+    <ClInclude Include="..\..\src\modules\image\wrap_CompressedData.h" />
     <ClInclude Include="..\..\src\modules\image\wrap_Image.h" />
     <ClInclude Include="..\..\src\modules\image\wrap_Image.h" />
     <ClInclude Include="..\..\src\modules\image\wrap_ImageData.h" />
     <ClInclude Include="..\..\src\modules\image\wrap_ImageData.h" />
     <ClInclude Include="..\..\src\modules\joystick\Joystick.h" />
     <ClInclude Include="..\..\src\modules\joystick\Joystick.h" />
+    <ClInclude Include="..\..\src\modules\joystick\JoystickModule.h" />
     <ClInclude Include="..\..\src\modules\joystick\sdl\Joystick.h" />
     <ClInclude Include="..\..\src\modules\joystick\sdl\Joystick.h" />
+    <ClInclude Include="..\..\src\modules\joystick\sdl\JoystickModule.h" />
     <ClInclude Include="..\..\src\modules\joystick\sdl\wrap_Joystick.h" />
     <ClInclude Include="..\..\src\modules\joystick\sdl\wrap_Joystick.h" />
+    <ClInclude Include="..\..\src\modules\joystick\sdl\wrap_JoystickModule.h" />
     <ClInclude Include="..\..\src\modules\keyboard\Keyboard.h" />
     <ClInclude Include="..\..\src\modules\keyboard\Keyboard.h" />
     <ClInclude Include="..\..\src\modules\keyboard\sdl\Keyboard.h" />
     <ClInclude Include="..\..\src\modules\keyboard\sdl\Keyboard.h" />
     <ClInclude Include="..\..\src\modules\keyboard\wrap_Keyboard.h" />
     <ClInclude Include="..\..\src\modules\keyboard\wrap_Keyboard.h" />
     <ClInclude Include="..\..\src\modules\love\love.h" />
     <ClInclude Include="..\..\src\modules\love\love.h" />
-    <ClInclude Include="..\..\src\modules\math\ModMath.h" />
+    <ClInclude Include="..\..\src\modules\math\BezierCurve.h" />
+    <ClInclude Include="..\..\src\modules\math\MathModule.h" />
+    <ClInclude Include="..\..\src\modules\math\RandomGenerator.h" />
+    <ClInclude Include="..\..\src\modules\math\wrap_BezierCurve.h" />
     <ClInclude Include="..\..\src\modules\math\wrap_Math.h" />
     <ClInclude Include="..\..\src\modules\math\wrap_Math.h" />
+    <ClInclude Include="..\..\src\modules\math\wrap_RandomGenerator.h" />
+    <ClInclude Include="..\..\src\modules\mouse\Cursor.h" />
     <ClInclude Include="..\..\src\modules\mouse\Mouse.h" />
     <ClInclude Include="..\..\src\modules\mouse\Mouse.h" />
+    <ClInclude Include="..\..\src\modules\mouse\sdl\Cursor.h" />
     <ClInclude Include="..\..\src\modules\mouse\sdl\Mouse.h" />
     <ClInclude Include="..\..\src\modules\mouse\sdl\Mouse.h" />
+    <ClInclude Include="..\..\src\modules\mouse\wrap_Cursor.h" />
     <ClInclude Include="..\..\src\modules\mouse\wrap_Mouse.h" />
     <ClInclude Include="..\..\src\modules\mouse\wrap_Mouse.h" />
     <ClInclude Include="..\..\src\modules\physics\Body.h" />
     <ClInclude Include="..\..\src\modules\physics\Body.h" />
     <ClInclude Include="..\..\src\modules\physics\box2d\Body.h" />
     <ClInclude Include="..\..\src\modules\physics\box2d\Body.h" />
@@ -721,19 +812,31 @@
     <ClInclude Include="..\..\src\modules\sound\lullaby\Mpg123Decoder.h" />
     <ClInclude Include="..\..\src\modules\sound\lullaby\Mpg123Decoder.h" />
     <ClInclude Include="..\..\src\modules\sound\lullaby\Sound.h" />
     <ClInclude Include="..\..\src\modules\sound\lullaby\Sound.h" />
     <ClInclude Include="..\..\src\modules\sound\lullaby\VorbisDecoder.h" />
     <ClInclude Include="..\..\src\modules\sound\lullaby\VorbisDecoder.h" />
+    <ClInclude Include="..\..\src\modules\sound\lullaby\WaveDecoder.h" />
     <ClInclude Include="..\..\src\modules\sound\Sound.h" />
     <ClInclude Include="..\..\src\modules\sound\Sound.h" />
     <ClInclude Include="..\..\src\modules\sound\SoundData.h" />
     <ClInclude Include="..\..\src\modules\sound\SoundData.h" />
     <ClInclude Include="..\..\src\modules\sound\wrap_Decoder.h" />
     <ClInclude Include="..\..\src\modules\sound\wrap_Decoder.h" />
     <ClInclude Include="..\..\src\modules\sound\wrap_Sound.h" />
     <ClInclude Include="..\..\src\modules\sound\wrap_Sound.h" />
     <ClInclude Include="..\..\src\modules\sound\wrap_SoundData.h" />
     <ClInclude Include="..\..\src\modules\sound\wrap_SoundData.h" />
+    <ClInclude Include="..\..\src\modules\system\sdl\System.h" />
+    <ClInclude Include="..\..\src\modules\system\System.h" />
+    <ClInclude Include="..\..\src\modules\system\wrap_System.h" />
+    <ClInclude Include="..\..\src\modules\thread\Channel.h" />
+    <ClInclude Include="..\..\src\modules\thread\LuaThread.h" />
+    <ClInclude Include="..\..\src\modules\thread\sdl\Thread.h" />
+    <ClInclude Include="..\..\src\modules\thread\sdl\threads.h" />
     <ClInclude Include="..\..\src\modules\thread\Thread.h" />
     <ClInclude Include="..\..\src\modules\thread\Thread.h" />
+    <ClInclude Include="..\..\src\modules\thread\ThreadModule.h" />
     <ClInclude Include="..\..\src\modules\thread\threads.h" />
     <ClInclude Include="..\..\src\modules\thread\threads.h" />
-    <ClInclude Include="..\..\src\modules\thread\wrap_Thread.h" />
+    <ClInclude Include="..\..\src\modules\thread\wrap_Channel.h" />
+    <ClInclude Include="..\..\src\modules\thread\wrap_LuaThread.h" />
+    <ClInclude Include="..\..\src\modules\thread\wrap_ThreadModule.h" />
     <ClInclude Include="..\..\src\modules\timer\sdl\Timer.h" />
     <ClInclude Include="..\..\src\modules\timer\sdl\Timer.h" />
     <ClInclude Include="..\..\src\modules\timer\Timer.h" />
     <ClInclude Include="..\..\src\modules\timer\Timer.h" />
     <ClInclude Include="..\..\src\modules\timer\wrap_Timer.h" />
     <ClInclude Include="..\..\src\modules\timer\wrap_Timer.h" />
     <ClInclude Include="..\..\src\modules\window\sdl\Window.h" />
     <ClInclude Include="..\..\src\modules\window\sdl\Window.h" />
     <ClInclude Include="..\..\src\modules\window\Window.h" />
     <ClInclude Include="..\..\src\modules\window\Window.h" />
+    <ClInclude Include="..\..\src\modules\window\wrap_Window.h" />
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="love.rc" />
     <ResourceCompile Include="love.rc" />

+ 411 - 63
platform/msvc2010/liblove.vcxproj.filters

@@ -106,9 +106,6 @@
     <Filter Include="modules\graphics\opengl">
     <Filter Include="modules\graphics\opengl">
       <UniqueIdentifier>{72f85e75-dd35-4a93-9c39-258c8aee813b}</UniqueIdentifier>
       <UniqueIdentifier>{72f85e75-dd35-4a93-9c39-258c8aee813b}</UniqueIdentifier>
     </Filter>
     </Filter>
-    <Filter Include="modules\image\devil">
-      <UniqueIdentifier>{d39bd4fd-3bea-428a-813f-4b1c55aedac8}</UniqueIdentifier>
-    </Filter>
     <Filter Include="modules\joystick\sdl">
     <Filter Include="modules\joystick\sdl">
       <UniqueIdentifier>{806ac1d0-ed5c-47d5-8cdc-60e3fdbfe412}</UniqueIdentifier>
       <UniqueIdentifier>{806ac1d0-ed5c-47d5-8cdc-60e3fdbfe412}</UniqueIdentifier>
     </Filter>
     </Filter>
@@ -136,6 +133,45 @@
     <Filter Include="modules\math">
     <Filter Include="modules\math">
       <UniqueIdentifier>{5d2c2149-93bf-42a6-b8b5-6ddbac9485a3}</UniqueIdentifier>
       <UniqueIdentifier>{5d2c2149-93bf-42a6-b8b5-6ddbac9485a3}</UniqueIdentifier>
     </Filter>
     </Filter>
+    <Filter Include="modules\thread\sdl">
+      <UniqueIdentifier>{5673936a-786e-40ee-96d2-1830e89c1532}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="libraries\ddsparse">
+      <UniqueIdentifier>{dd0ef317-7117-4ddc-b8ef-aaf58130c7bd}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="modules\image\magpie">
+      <UniqueIdentifier>{d39bd4fd-3bea-428a-813f-4b1c55aedac8}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="libraries\noise1234">
+      <UniqueIdentifier>{d5e565d0-da66-4412-9144-dff8c7d82b2e}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="libraries\enet">
+      <UniqueIdentifier>{4bf8a9b0-db1a-4a6e-a157-a9eab128f5ca}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="libraries\enet\libenet">
+      <UniqueIdentifier>{ab75aa3d-8e32-45e0-b91b-ed3cb31f472e}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="libraries\enet\libenet\include">
+      <UniqueIdentifier>{86f5346b-8859-4c03-8c1f-3bd8d200b658}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="libraries\enet\libenet\include\enet">
+      <UniqueIdentifier>{a9a12c5a-ff54-43c1-b0c6-ba1597af7b03}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="modules\system">
+      <UniqueIdentifier>{731671fa-d695-42c3-9d1c-9e227d9ebab4}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="modules\system\sdl">
+      <UniqueIdentifier>{2241f4ca-a51c-4d8d-be82-2b7dfd267b7b}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="modules\system">
+      <UniqueIdentifier>{731671fa-d695-42c3-9d1c-9e227d9ebab4}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="modules\system\sdl">
+      <UniqueIdentifier>{2241f4ca-a51c-4d8d-be82-2b7dfd267b7b}</UniqueIdentifier>
+    </Filter>
+    <Filter Include="libraries\Wuff">
+      <UniqueIdentifier>{4127f9be-b9c3-45bf-968f-888df9d5bc35}</UniqueIdentifier>
+    </Filter>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="..\..\src\common\Matrix.cpp">
     <ClCompile Include="..\..\src\common\Matrix.cpp">
@@ -435,27 +471,18 @@
     <ClCompile Include="..\..\src\modules\graphics\Drawable.cpp">
     <ClCompile Include="..\..\src\modules\graphics\Drawable.cpp">
       <Filter>modules\graphics</Filter>
       <Filter>modules\graphics</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\graphics\DrawQable.cpp">
-      <Filter>modules\graphics</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\Graphics.cpp">
     <ClCompile Include="..\..\src\modules\graphics\Graphics.cpp">
       <Filter>modules\graphics</Filter>
       <Filter>modules\graphics</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\Image.cpp">
     <ClCompile Include="..\..\src\modules\graphics\Image.cpp">
       <Filter>modules\graphics</Filter>
       <Filter>modules\graphics</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\graphics\Quad.cpp">
-      <Filter>modules\graphics</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\Volatile.cpp">
     <ClCompile Include="..\..\src\modules\graphics\Volatile.cpp">
       <Filter>modules\graphics</Filter>
       <Filter>modules\graphics</Filter>
     </ClCompile>
     </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\opengl\Shader.cpp">
     <ClCompile Include="..\..\src\modules\graphics\opengl\Shader.cpp">
       <Filter>modules\graphics\opengl</Filter>
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\graphics\opengl\Quad.cpp">
-      <Filter>modules\graphics\opengl</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\opengl\SpriteBatch.cpp">
     <ClCompile Include="..\..\src\modules\graphics\opengl\SpriteBatch.cpp">
       <Filter>modules\graphics\opengl</Filter>
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
     </ClCompile>
@@ -480,9 +507,6 @@
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Shader.cpp">
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Shader.cpp">
       <Filter>modules\graphics\opengl</Filter>
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Quad.cpp">
-      <Filter>modules\graphics\opengl</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.cpp">
     <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.cpp">
       <Filter>modules\graphics\opengl</Filter>
       <Filter>modules\graphics\opengl</Filter>
     </ClCompile>
     </ClCompile>
@@ -516,12 +540,6 @@
     <ClCompile Include="..\..\src\modules\image\wrap_ImageData.cpp">
     <ClCompile Include="..\..\src\modules\image\wrap_ImageData.cpp">
       <Filter>modules\image</Filter>
       <Filter>modules\image</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\image\devil\ImageData.cpp">
-      <Filter>modules\image\devil</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\modules\image\devil\Image.cpp">
-      <Filter>modules\image\devil</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\joystick\Joystick.cpp">
     <ClCompile Include="..\..\src\modules\joystick\Joystick.cpp">
       <Filter>modules\joystick</Filter>
       <Filter>modules\joystick</Filter>
     </ClCompile>
     </ClCompile>
@@ -717,15 +735,6 @@
     <ClCompile Include="..\..\src\modules\sound\lullaby\FLACDecoder.cpp">
     <ClCompile Include="..\..\src\modules\sound\lullaby\FLACDecoder.cpp">
       <Filter>modules\sound\lullaby</Filter>
       <Filter>modules\sound\lullaby</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\thread\Thread.cpp">
-      <Filter>modules\thread</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\modules\thread\threads.cpp">
-      <Filter>modules\thread</Filter>
-    </ClCompile>
-    <ClCompile Include="..\..\src\modules\thread\wrap_Thread.cpp">
-      <Filter>modules\thread</Filter>
-    </ClCompile>
     <ClCompile Include="..\..\src\modules\timer\wrap_Timer.cpp">
     <ClCompile Include="..\..\src\modules\timer\wrap_Timer.cpp">
       <Filter>modules\timer</Filter>
       <Filter>modules\timer</Filter>
     </ClCompile>
     </ClCompile>
@@ -744,15 +753,186 @@
     <ClCompile Include="..\..\src\common\Module.cpp">
     <ClCompile Include="..\..\src\common\Module.cpp">
       <Filter>common</Filter>
       <Filter>common</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\common\math.cpp">
-      <Filter>common</Filter>
+    <ClCompile Include="..\..\src\modules\math\wrap_Math.cpp">
+      <Filter>modules\math</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\thread\Channel.cpp">
+      <Filter>modules\thread</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\thread\LuaThread.cpp">
+      <Filter>modules\thread</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\thread\ThreadModule.cpp">
+      <Filter>modules\thread</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\thread\threads.cpp">
+      <Filter>modules\thread</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\thread\wrap_Channel.cpp">
+      <Filter>modules\thread</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\thread\wrap_LuaThread.cpp">
+      <Filter>modules\thread</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\thread\wrap_ThreadModule.cpp">
+      <Filter>modules\thread</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\thread\sdl\threads.cpp">
+      <Filter>modules\thread\sdl</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\math\ModMath.cpp">
+    <ClCompile Include="..\..\src\modules\thread\sdl\Thread.cpp">
+      <Filter>modules\thread\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\math\MathModule.cpp">
       <Filter>modules\math</Filter>
       <Filter>modules\math</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="..\..\src\modules\math\wrap_Math.cpp">
+    <ClCompile Include="..\..\src\libraries\ddsparse\ddsparse.cpp">
+      <Filter>libraries\ddsparse</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\image\magpie\DevilHandler.cpp">
+      <Filter>modules\image\magpie</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\image\magpie\Image.cpp">
+      <Filter>modules\image\magpie</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\image\magpie\ImageData.cpp">
+      <Filter>modules\image\magpie</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\image\magpie\CompressedData.cpp">
+      <Filter>modules\image\magpie</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\image\magpie\ddsHandler.cpp">
+      <Filter>modules\image\magpie</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\image\CompressedData.cpp">
+      <Filter>modules\image</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\image\wrap_CompressedData.cpp">
+      <Filter>modules\image</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\math\RandomGenerator.cpp">
+      <Filter>modules\math</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\math\wrap_RandomGenerator.cpp">
+      <Filter>modules\math</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\noise1234\simplexnoise1234.cpp">
+      <Filter>libraries\noise1234</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\math\wrap_BezierCurve.cpp">
+      <Filter>modules\math</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\math\BezierCurve.cpp">
       <Filter>modules\math</Filter>
       <Filter>modules\math</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="..\..\src\modules\window\wrap_Window.cpp">
+      <Filter>modules\window</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\libenet\callbacks.c">
+      <Filter>libraries\enet\libenet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\libenet\compress.c">
+      <Filter>libraries\enet\libenet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\libenet\host.c">
+      <Filter>libraries\enet\libenet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\libenet\list.c">
+      <Filter>libraries\enet\libenet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\libenet\packet.c">
+      <Filter>libraries\enet\libenet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\libenet\peer.c">
+      <Filter>libraries\enet\libenet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\libenet\protocol.c">
+      <Filter>libraries\enet\libenet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\libenet\win32.c">
+      <Filter>libraries\enet\libenet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\enet\enet.cpp">
+      <Filter>libraries\enet</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\graphics\opengl\Polyline.cpp">
+      <Filter>modules\graphics\opengl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\joystick\sdl\JoystickModule.cpp">
+      <Filter>modules\joystick\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\joystick\sdl\wrap_JoystickModule.cpp">
+      <Filter>modules\joystick\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\mouse\Cursor.cpp">
+      <Filter>modules\mouse</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\mouse\wrap_Cursor.cpp">
+      <Filter>modules\mouse</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\mouse\sdl\Cursor.cpp">
+      <Filter>modules\mouse\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\system\System.cpp">
+      <Filter>modules\system</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\system\wrap_System.cpp">
+      <Filter>modules\system</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\system\sdl\System.cpp">
+      <Filter>modules\system\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\joystick\sdl\JoystickModule.cpp">
+      <Filter>modules\joystick\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\joystick\sdl\wrap_JoystickModule.cpp">
+      <Filter>modules\joystick\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\mouse\Cursor.cpp">
+      <Filter>modules\mouse</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\mouse\wrap_Cursor.cpp">
+      <Filter>modules\mouse</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\mouse\sdl\Cursor.cpp">
+      <Filter>modules\mouse\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\system\System.cpp">
+      <Filter>modules\system</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\system\wrap_System.cpp">
+      <Filter>modules\system</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\system\sdl\System.cpp">
+      <Filter>modules\system\sdl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\graphics\Quad.cpp">
+      <Filter>modules\graphics</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Quad.cpp">
+      <Filter>modules\graphics\opengl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\graphics\opengl\wrap_Mesh.cpp">
+      <Filter>modules\graphics\opengl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\graphics\opengl\Mesh.cpp">
+      <Filter>modules\graphics\opengl</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\Wuff\wuff_convert.c">
+      <Filter>libraries\Wuff</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\Wuff\wuff_internal.c">
+      <Filter>libraries\Wuff</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\Wuff\wuff_memory.c">
+      <Filter>libraries\Wuff</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\libraries\Wuff\wuff.c">
+      <Filter>libraries\Wuff</Filter>
+    </ClCompile>
+    <ClCompile Include="..\..\src\modules\sound\lullaby\WaveDecoder.cpp">
+      <Filter>modules\sound\lullaby</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <None Include="..\..\src\scripts\boot.lua">
     <None Include="..\..\src\scripts\boot.lua">
@@ -1117,18 +1297,12 @@
     <ClInclude Include="..\..\src\modules\graphics\Drawable.h">
     <ClInclude Include="..\..\src\modules\graphics\Drawable.h">
       <Filter>modules\graphics</Filter>
       <Filter>modules\graphics</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\graphics\DrawQable.h">
-      <Filter>modules\graphics</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\Graphics.h">
     <ClInclude Include="..\..\src\modules\graphics\Graphics.h">
       <Filter>modules\graphics</Filter>
       <Filter>modules\graphics</Filter>
     </ClInclude>
     </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\Image.h">
     <ClInclude Include="..\..\src\modules\graphics\Image.h">
       <Filter>modules\graphics</Filter>
       <Filter>modules\graphics</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\graphics\Quad.h">
-      <Filter>modules\graphics</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\Volatile.h">
     <ClInclude Include="..\..\src\modules\graphics\Volatile.h">
       <Filter>modules\graphics</Filter>
       <Filter>modules\graphics</Filter>
     </ClInclude>
     </ClInclude>
@@ -1141,9 +1315,6 @@
     <ClInclude Include="..\..\src\modules\graphics\opengl\Shader.h">
     <ClInclude Include="..\..\src\modules\graphics\opengl\Shader.h">
       <Filter>modules\graphics\opengl</Filter>
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\graphics\opengl\Quad.h">
-      <Filter>modules\graphics\opengl</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\opengl\SpriteBatch.h">
     <ClInclude Include="..\..\src\modules\graphics\opengl\SpriteBatch.h">
       <Filter>modules\graphics\opengl</Filter>
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
     </ClInclude>
@@ -1168,9 +1339,6 @@
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Shader.h">
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Shader.h">
       <Filter>modules\graphics\opengl</Filter>
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Quad.h">
-      <Filter>modules\graphics\opengl</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.h">
     <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_SpriteBatch.h">
       <Filter>modules\graphics\opengl</Filter>
       <Filter>modules\graphics\opengl</Filter>
     </ClInclude>
     </ClInclude>
@@ -1204,12 +1372,6 @@
     <ClInclude Include="..\..\src\modules\image\wrap_ImageData.h">
     <ClInclude Include="..\..\src\modules\image\wrap_ImageData.h">
       <Filter>modules\image</Filter>
       <Filter>modules\image</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\image\devil\Image.h">
-      <Filter>modules\image\devil</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\src\modules\image\devil\ImageData.h">
-      <Filter>modules\image\devil</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\joystick\Joystick.h">
     <ClInclude Include="..\..\src\modules\joystick\Joystick.h">
       <Filter>modules\joystick</Filter>
       <Filter>modules\joystick</Filter>
     </ClInclude>
     </ClInclude>
@@ -1408,15 +1570,6 @@
     <ClInclude Include="..\..\src\modules\sound\lullaby\FLACDecoder.h">
     <ClInclude Include="..\..\src\modules\sound\lullaby\FLACDecoder.h">
       <Filter>modules\sound\lullaby</Filter>
       <Filter>modules\sound\lullaby</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\thread\Thread.h">
-      <Filter>modules\thread</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\src\modules\thread\threads.h">
-      <Filter>modules\thread</Filter>
-    </ClInclude>
-    <ClInclude Include="..\..\src\modules\thread\wrap_Thread.h">
-      <Filter>modules\thread</Filter>
-    </ClInclude>
     <ClInclude Include="..\..\src\modules\timer\Timer.h">
     <ClInclude Include="..\..\src\modules\timer\Timer.h">
       <Filter>modules\timer</Filter>
       <Filter>modules\timer</Filter>
     </ClInclude>
     </ClInclude>
@@ -1435,12 +1588,207 @@
     <ClInclude Include="..\..\src\modules\love\love.h">
     <ClInclude Include="..\..\src\modules\love\love.h">
       <Filter>modules\love</Filter>
       <Filter>modules\love</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\math\ModMath.h">
+    <ClInclude Include="..\..\src\modules\math\wrap_Math.h">
       <Filter>modules\math</Filter>
       <Filter>modules\math</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="..\..\src\modules\math\wrap_Math.h">
+    <ClInclude Include="..\..\src\modules\thread\Channel.h">
+      <Filter>modules\thread</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\LuaThread.h">
+      <Filter>modules\thread</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\Thread.h">
+      <Filter>modules\thread</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\ThreadModule.h">
+      <Filter>modules\thread</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\threads.h">
+      <Filter>modules\thread</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\wrap_Channel.h">
+      <Filter>modules\thread</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\wrap_LuaThread.h">
+      <Filter>modules\thread</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\wrap_ThreadModule.h">
+      <Filter>modules\thread</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\sdl\Thread.h">
+      <Filter>modules\thread\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\thread\sdl\threads.h">
+      <Filter>modules\thread\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\math\MathModule.h">
+      <Filter>modules\math</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\ddsparse\ddsparse.h">
+      <Filter>libraries\ddsparse</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\ddsparse\ddsinfo.h">
+      <Filter>libraries\ddsparse</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\image\magpie\ddsHandler.h">
+      <Filter>modules\image\magpie</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\image\magpie\DevilHandler.h">
+      <Filter>modules\image\magpie</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\image\magpie\FormatHandler.h">
+      <Filter>modules\image\magpie</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\image\magpie\Image.h">
+      <Filter>modules\image\magpie</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\image\magpie\ImageData.h">
+      <Filter>modules\image\magpie</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\image\magpie\CompressedData.h">
+      <Filter>modules\image\magpie</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\image\CompressedData.h">
+      <Filter>modules\image</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\image\wrap_CompressedData.h">
+      <Filter>modules\image</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\math\RandomGenerator.h">
+      <Filter>modules\math</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\math\wrap_RandomGenerator.h">
+      <Filter>modules\math</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\noise1234\simplexnoise1234.h">
+      <Filter>libraries\noise1234</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\math\wrap_BezierCurve.h">
+      <Filter>modules\math</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\math\BezierCurve.h">
       <Filter>modules\math</Filter>
       <Filter>modules\math</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="..\..\src\modules\window\wrap_Window.h">
+      <Filter>modules\window</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\lua-enet.h">
+      <Filter>libraries\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\callbacks.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\enet.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\list.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\protocol.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\time.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\types.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\unix.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\utility.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\enet\libenet\include\enet\win32.h">
+      <Filter>libraries\enet\libenet\include\enet</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\graphics\opengl\Polyline.h">
+      <Filter>modules\graphics\opengl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\joystick\JoystickModule.h">
+      <Filter>modules\joystick</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\joystick\sdl\JoystickModule.h">
+      <Filter>modules\joystick\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\joystick\sdl\wrap_JoystickModule.h">
+      <Filter>modules\joystick\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\mouse\Cursor.h">
+      <Filter>modules\mouse</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\mouse\wrap_Cursor.h">
+      <Filter>modules\mouse</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\mouse\sdl\Cursor.h">
+      <Filter>modules\mouse\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\system\System.h">
+      <Filter>modules\system</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\system\wrap_System.h">
+      <Filter>modules\system</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\system\sdl\System.h">
+      <Filter>modules\system\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\joystick\JoystickModule.h">
+      <Filter>modules\joystick</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\joystick\sdl\JoystickModule.h">
+      <Filter>modules\joystick\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\joystick\sdl\wrap_JoystickModule.h">
+      <Filter>modules\joystick\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\mouse\Cursor.h">
+      <Filter>modules\mouse</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\mouse\wrap_Cursor.h">
+      <Filter>modules\mouse</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\mouse\sdl\Cursor.h">
+      <Filter>modules\mouse\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\system\System.h">
+      <Filter>modules\system</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\system\wrap_System.h">
+      <Filter>modules\system</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\system\sdl\System.h">
+      <Filter>modules\system\sdl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\graphics\DrawQable.h">
+      <Filter>modules\graphics</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\graphics\Quad.h">
+      <Filter>modules\graphics</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Quad.h">
+      <Filter>modules\graphics\opengl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\graphics\opengl\wrap_Mesh.h">
+      <Filter>modules\graphics\opengl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\graphics\opengl\Mesh.h">
+      <Filter>modules\graphics\opengl</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\Wuff\wuff.h">
+      <Filter>libraries\Wuff</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\Wuff\wuff_config.h">
+      <Filter>libraries\Wuff</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\Wuff\wuff_convert.h">
+      <Filter>libraries\Wuff</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\libraries\Wuff\wuff_internal.h">
+      <Filter>libraries\Wuff</Filter>
+    </ClInclude>
+    <ClInclude Include="..\..\src\modules\sound\lullaby\WaveDecoder.h">
+      <Filter>modules\sound\lullaby</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ResourceCompile Include="love.rc" />
     <ResourceCompile Include="love.rc" />

BIN
platform/msvc2010/love.rc


+ 28 - 28
platform/msvc2010/love.sln

@@ -10,36 +10,36 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "liblove", "liblove.vcxproj"
 EndProject
 EndProject
 Global
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
-		Debug Dynamic|Win32 = Debug Dynamic|Win32
-		Debug Dynamic|x64 = Debug Dynamic|x64
-		Release Dynamic|Win32 = Release Dynamic|Win32
-		Release Dynamic|x64 = Release Dynamic|x64
-		Release Static|Win32 = Release Static|Win32
-		Release Static|x64 = Release Static|x64
+		Debug MD|Win32 = Debug MD|Win32
+		Debug MD|x64 = Debug MD|x64
+		Release MD|Win32 = Release MD|Win32
+		Release MD|x64 = Release MD|x64
+		Release MT|Win32 = Release MT|Win32
+		Release MT|x64 = Release MT|x64
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Debug Dynamic|Win32.ActiveCfg = Debug Dynamic|Win32
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Debug Dynamic|Win32.Build.0 = Debug Dynamic|Win32
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Debug Dynamic|x64.ActiveCfg = Debug Dynamic|x64
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release Dynamic|Win32.ActiveCfg = Release Dynamic|Win32
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release Dynamic|Win32.Build.0 = Release Dynamic|Win32
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release Dynamic|x64.ActiveCfg = Release Dynamic|x64
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release Dynamic|x64.Build.0 = Release Dynamic|x64
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release Static|Win32.ActiveCfg = Release Static|Win32
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release Static|Win32.Build.0 = Release Static|Win32
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release Static|x64.ActiveCfg = Release Static|x64
-		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release Static|x64.Build.0 = Release Static|x64
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Debug Dynamic|Win32.ActiveCfg = Debug Dynamic|Win32
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Debug Dynamic|Win32.Build.0 = Debug Dynamic|Win32
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Debug Dynamic|x64.ActiveCfg = Debug Dynamic|x64
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release Dynamic|Win32.ActiveCfg = Release Dynamic|Win32
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release Dynamic|Win32.Build.0 = Release Dynamic|Win32
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release Dynamic|x64.ActiveCfg = Release Dynamic|x64
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release Dynamic|x64.Build.0 = Release Dynamic|x64
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release Static|Win32.ActiveCfg = Release Static|Win32
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release Static|Win32.Build.0 = Release Static|Win32
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release Static|x64.ActiveCfg = Release Static|x64
-		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release Static|x64.Build.0 = Release Static|x64
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Debug MD|Win32.ActiveCfg = Debug Dynamic|Win32
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Debug MD|Win32.Build.0 = Debug Dynamic|Win32
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Debug MD|x64.ActiveCfg = Debug Dynamic|x64
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release MD|Win32.ActiveCfg = Release Dynamic|Win32
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release MD|Win32.Build.0 = Release Dynamic|Win32
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release MD|x64.ActiveCfg = Release Dynamic|x64
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release MD|x64.Build.0 = Release Dynamic|x64
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release MT|Win32.ActiveCfg = Release Static|Win32
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release MT|Win32.Build.0 = Release Static|Win32
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release MT|x64.ActiveCfg = Release Static|x64
+		{B496CCF6-9B6D-0794-8F41-67A6EC86B4AA}.Release MT|x64.Build.0 = Release Static|x64
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Debug MD|Win32.ActiveCfg = Debug Dynamic|Win32
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Debug MD|Win32.Build.0 = Debug Dynamic|Win32
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Debug MD|x64.ActiveCfg = Debug Dynamic|x64
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release MD|Win32.ActiveCfg = Release Dynamic|Win32
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release MD|Win32.Build.0 = Release Dynamic|Win32
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release MD|x64.ActiveCfg = Release Dynamic|x64
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release MD|x64.Build.0 = Release Dynamic|x64
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release MT|Win32.ActiveCfg = Release Static|Win32
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release MT|Win32.Build.0 = Release Static|Win32
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release MT|x64.ActiveCfg = Release Static|x64
+		{A3FCC735-3E18-4D6B-9DA9-01D9E910B7F8}.Release MT|x64.Build.0 = Release Static|x64
 	EndGlobalSection
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 		HideSolutionNode = FALSE

+ 18 - 11
platform/msvc2010/love.vcxproj

@@ -135,8 +135,10 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Debug\MD\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Debug\MD\</AdditionalLibraryDirectories>
-      <AdditionalDependencies>msvcrtd.lib;msvcprtd.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>msvcrtd.lib;msvcprtd.lib;kernel32.lib;lua51.lib;SDL2main.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
+      <ProfileGuidedDatabase>$(TargetDir)$(TargetName).pgd</ProfileGuidedDatabase>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dynamic|x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Dynamic|x64'">
@@ -150,13 +152,16 @@
       <MultiProcessorCompilation>
       <MultiProcessorCompilation>
       </MultiProcessorCompilation>
       </MultiProcessorCompilation>
       <MinimalRebuild>false</MinimalRebuild>
       <MinimalRebuild>false</MinimalRebuild>
+      <OmitFramePointers>false</OmitFramePointers>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
-      <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Debug\MT\</AdditionalLibraryDirectories>
-      <AdditionalDependencies>msvcrtd.lib;msvcprtd.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Debug\MD\</AdditionalLibraryDirectories>
+      <AdditionalDependencies>msvcrtd.lib;msvcprtd.lib;kernel32.lib;lua51.lib;SDL2main.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <ProfileGuidedDatabase>$(TargetDir)$(TargetName).pgd</ProfileGuidedDatabase>
+      <ProgramDatabaseFile>$(TargetDir)$(TargetName).pdb</ProgramDatabaseFile>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dynamic|Win32'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Dynamic|Win32'">
@@ -173,13 +178,12 @@
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
       <TargetMachine>MachineX86</TargetMachine>
       <TargetMachine>MachineX86</TargetMachine>
-      <GenerateDebugInformation>
-      </GenerateDebugInformation>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MD\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MD\</AdditionalLibraryDirectories>
-      <AdditionalDependencies>msvcrt.lib;msvcprt.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>msvcrt.lib;msvcprt.lib;kernel32.lib;lua51.lib;SDL2main.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
@@ -196,13 +200,12 @@
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <FunctionLevelLinking>true</FunctionLevelLinking>
     </ClCompile>
     </ClCompile>
     <Link>
     <Link>
-      <GenerateDebugInformation>
-      </GenerateDebugInformation>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MD\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MD\</AdditionalLibraryDirectories>
-      <AdditionalDependencies>msvcrt.lib;msvcprt.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>msvcrt.lib;msvcprt.lib;kernel32.lib;lua51.lib;SDL2main.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
@@ -220,9 +223,12 @@
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalDependencies>libcmt.lib;libcpmt.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>libcmt.lib;libcpmt.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;winmm.lib;opengl32.lib;oldnames.lib;DevIL.lib;freetype.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;mpg123.lib;physfs.lib;OpenAL.lib;zlib.lib;SDL2main.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MT\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MT\</AdditionalLibraryDirectories>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <ShowProgress>NotSet</ShowProgress>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
@@ -239,9 +245,10 @@
       <SubSystem>Windows</SubSystem>
       <SubSystem>Windows</SubSystem>
       <OptimizeReferences>true</OptimizeReferences>
       <OptimizeReferences>true</OptimizeReferences>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
-      <AdditionalDependencies>libcmt.lib;libcpmt.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;opengl32.lib;oldnames.lib;freetype2.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua5.1.lib;physfs.lib;SDLmain.lib;zlib.lib;DevIL.lib;mpg123.lib;OpenAL.lib;SDL.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>libcmt.lib;libcpmt.lib;kernel32.lib;user32.lib;shell32.lib;uuid.lib;advapi32.lib;ws2_32.lib;winmm.lib;opengl32.lib;oldnames.lib;DevIL.lib;freetype.lib;libmodplug.lib;libogg.lib;libvorbis.lib;libvorbisfile.lib;lua51.lib;mpg123.lib;physfs.lib;OpenAL.lib;zlib.lib;SDL2main.lib;SDL2.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MT\</AdditionalLibraryDirectories>
       <AdditionalLibraryDirectories>lib\$(PlatformShortName)\Release\MT\</AdditionalLibraryDirectories>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
       <IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
     </Link>
     </Link>
   </ItemDefinitionGroup>
   </ItemDefinitionGroup>
   <ItemGroup>
   <ItemGroup>

+ 22 - 1
platform/unix/Makefile.am

@@ -1,3 +1,24 @@
 ACLOCAL_AMFLAGS = -I platform/unix/m4
 ACLOCAL_AMFLAGS = -I platform/unix/m4
 SUBDIRS = src
 SUBDIRS = src
-EXTRA_DIST = changes.txt license.txt readme.txt
+EXTRA_DIST = changes.txt license.txt readme.md \
+	platform/unix/love.desktop.in
+dist_man1_MANS = platform/unix/love.1
+
+applicationsdir=$(datarootdir)/applications
+mimeinfodir=$(datarootdir)/mime/packages
+pixmapsdir=$(datarootdir)/pixmaps
+mimeiconsdir=$(datarootdir)/icons/hicolor/scalable/mimetypes
+
+applications_DATA = platform/unix/love.desktop
+dist_mimeinfo_DATA = platform/unix/love.xml
+dist_pixmaps_DATA = platform/unix/love.svg
+dist_mimeicons_DATA = platform/unix/application-x-love-game.svg
+
+platform/unix/love.desktop: platform/unix/love.desktop.in
+	$(MKDIR_P) platform/unix
+	rm -f $@ [email protected]
+	$(SED) \
+		-e "s|@bindir[@]|$(bindir)|" \
+		${srcdir}/[email protected] > [email protected]
+	chmod a-w [email protected]
+	mv [email protected] $@

+ 0 - 0
platform/unix/game.svg → platform/unix/application-x-love-game.svg


+ 0 - 135
platform/unix/autobuild

@@ -1,135 +0,0 @@
-#!/bin/bash
-
-#
-# This script gets all needed packages, builds LOVE, makes deb and tar.gz
-# and optionally uploads them to servers.
-#
-# Note: this script must be called in the same directory as the love
-# folder resides. It also assumes that love has been checked out previously.
-#
-# Usage:
-#
-# autobuild [action [revision [version]]]
-# 
-# action:
-#
-# There are only two recognized actions:
-#
-# build -- Causes files to be uploaded to tehlol servers.
-# release -- Coming soon.
-#
-# All other actions will be ignored, so if you don not wish to upload
-# files (but still build LOVE), you can write "test", for instance. 
-#
-# revision:
-#
-# The revision that should be built. Should be a valid revision 
-# number or tip. If not specified, it defaults to tip.
-#
-# version: 
-#
-# The display version that will appear in files, eg. love-version.tar.gz.
-# If not specified, the script defaults to use the SVN revision number.
-#
-# Examples:
-#
-# autobuild
-# (Builds HEAD, but does not upload)
-#
-# autobuild build
-# (Builds tip and uploads to tehlol server with the current rev. as
-# version number)
-#
-# autobuild build tip 1.0
-# (Builds tip and uploads it using the version 1.0)
-#
-#
-# Passwords for servers must be in these external files:
-#
-# tehlol.com: 		pwtehlol
-# sourceforge.net: 	pwsourceforge
-#
-
-cd ../..
-
-# Get required packages.
-#sudo apt-get -y install subversion build-essential liblua5.1-dev \
-#libopenal-dev libsdl1.2-dev libfreetype6-dev \
-#libphysfs-dev libdevil-dev libtiff4-dev libmng-dev \
-#liblcms1-dev ftp-upload libmpg123-dev libmodplug-dev libpng12-dev
-
-# Check which revision to build.
-if [ -z $2 ]; then
-	buildrev="tip"
-else
-	buildrev=$2
-fi
-
-echo $buildrev
-
-# Upload to the appropriate revision.
-hg pull
-hg update -r $buildrev
-
-# Set the displayversion.
-if [ -z $3 ]; then
-	if [ "$buildrev" == "tip" ]; then
-		# Get the current SVN version, use sed to remove any non-numbers.
-		currentversion=`hg log -l1 --template "{node|short}"`
-		currentdate=`date +%Y%m%d`
-		displayversion="$currentdate-$currentversion"
-	else
-		# The revision is already specified, so we'll use that as the 
-		# display version.
-		displayversion="$buildrev"
-	fi
-else
-	# If the param is present, it overrides everything else.
-	displayversion=$3
-fi
-
-echo $displayversion
-
-# Update version in configure.
-# cat configure.in | sed "s/LOVE_VERSION/$displayversion/g" > configure.in
-head -c 15 configure.in > configure.in.tmp
-echo " [$displayversion])" >> configure.in.tmp
-tail -n +2 configure.in >> configure.in.tmp
-cp configure.in.tmp configure.in
-rm configure.in.tmp
-
-# Build ... BUILD!
-#sh platform/unix/gen-makefile
-sh platform/unix/automagic
-./configure
-make
-make dist
-
-# Move and rename the tar.
-tar="love-$displayversion-linux-src.tar.gz"
-mv "love-$displayversion.tar.gz" platform/unix/$tar
-
-# Create the deb.
-cd platform/unix
-sh make-package deb $displayversion
-
-machine=`uname -m`
-
-# Move and rename the deb.
-deb="love-$displayversion-ubuntu-$machine.deb"
-mv "love-$displayversion.deb" $deb
-
-# Copy and rename the binary.
-binary="love-$displayversion-linux-$machine"
-cp ../../src/love $binary
-
-# Deal with uploading.
-#if [ "$1" == "build" ]; then
-#	curl -F build=@$deb -F press=ok http://love2d.org/builds/upload.php?upload
-#	curl -F build=@$tar -F press=ok http://love2d.org/builds/upload.php?upload
-#	curl -F build=@$binary -F press=ok http://love2d.org/builds/upload.php?upload
-#fi
-
-if [ "$1" == "release" ]; then
-	echo "release"
-fi

+ 35 - 12
platform/unix/automagic

@@ -1,15 +1,24 @@
 #!/bin/bash
 #!/bin/bash
 
 
+log() {
+	echo "[automagic] " $@
+}
+
 die() {
 die() {
-	echo "Fatal: "$@
+	log "Fatal: "$@
 	exit 1
 	exit 1
 }
 }
 
 
-AUTOHEADER=$(which autoheader)
-AUTOCONF=$(which autoconf)
-LIBTOOLIZE=$(which libtoolize)
-ACLOCAL=$(which aclocal)
-AUTOMAKE=$(which automake)
+if [[ ! -d platform/unix ]]; then
+	log "Can't find the 'plaform/unix' folder, make sure you run this from the root of the repository."
+	exit 1
+fi
+
+AUTOHEADER=${AUTOHEADER:-$(which autoheader)}
+AUTOCONF=${AUTOCONF:-$(which autoconf)}
+LIBTOOLIZE=${LIBTOOLIZE:-$(which libtoolize)}
+ACLOCAL=${ACLOCAL:-$(which aclocal)}
+AUTOMAKE=${AUTOMAKE:-$(which automake)}
 
 
 [[ -x ${AUTOHEADER} ]] || die "Could not find autoheader. Install autoconf."
 [[ -x ${AUTOHEADER} ]] || die "Could not find autoheader. Install autoconf."
 [[ -x ${AUTOCONF} ]]   || die "Could not find autoconf."
 [[ -x ${AUTOCONF} ]]   || die "Could not find autoconf."
@@ -18,29 +27,43 @@ AUTOMAKE=$(which automake)
 [[ -x ${AUTOMAKE} ]]   || die "Could not find automake."
 [[ -x ${AUTOMAKE} ]]   || die "Could not find automake."
 
 
 automagic() {
 automagic() {
+	log "Copying files..." >&2
 	cp platform/unix/configure.ac .
 	cp platform/unix/configure.ac .
 	cp platform/unix/Makefile.am .
 	cp platform/unix/Makefile.am .
 
 
-	if ! sh platform/unix/gen-makefile; then
+	log "Running genmodules..." >&2
+	if ! bash platform/unix/genmodules "$1"; then
 		echo "You should be doing this from the root directory of the project."
 		echo "You should be doing this from the root directory of the project."
 		exit 1
 		exit 1
 	fi
 	fi
 
 
+	log "Running autoheader..." >&2
 	${AUTOHEADER} 2>&1 || return 1 # Gimmie config.h.in
 	${AUTOHEADER} 2>&1 || return 1 # Gimmie config.h.in
+
+	log "Running libtoolize..." >&2
 	${LIBTOOLIZE} --force 2>&1 || return 1
 	${LIBTOOLIZE} --force 2>&1 || return 1
+
+	log "Running aclocal..." >&2
 	${ACLOCAL} 2>&1 || return 1
 	${ACLOCAL} 2>&1 || return 1
+
+	log "Running autoconf..." >&2
 	${AUTOCONF} 2>&1 || return 1
 	${AUTOCONF} 2>&1 || return 1
+
+	log "Running automake..." >&2
 	${AUTOMAKE} -a 2>&1 || return 1
 	${AUTOMAKE} -a 2>&1 || return 1
 }
 }
 
 
 if [[ $1 == "-d" ]]; then
 if [[ $1 == "-d" ]]; then
-	automagic
+	shift 1
+	automagic "$@" 2>&1
 else
 else
-	automagic > /dev/null
+	(automagic "$@" > /dev/null) 2>&1
 fi
 fi
-if [ $? -eq 1 ]; then
-	echo "Failed, please contact the developers."
+if [[ $? -eq 1 ]]; then
+	log "Failed, sadface."
+	log "You can make this script more verbose running it in debug mode (-d)"
+	log "This is generally a configuration error (I'm looking at you aclocal)"
 	exit 1
 	exit 1
 else
 else
-	echo "Success, carry on configuring."
+	log "Success, carry on configuring."
 fi
 fi

+ 120 - 61
platform/unix/configure.ac

@@ -10,75 +10,134 @@ m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
 AC_PROG_LIBTOOL
 AC_PROG_LIBTOOL
 AC_PROG_CC
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_CXX
+AC_PROG_SED
+AC_PROG_MKDIR_P
+AC_PROG_OBJCXX
 AC_C_BIGENDIAN
 AC_C_BIGENDIAN
-AC_SEARCH_LIBS([sqrt], [m], [], AC_MSG_ERROR([Can't LÖVE without C math library]))
-AC_SEARCH_LIBS([SDL_Init], [SDL], [], AC_MSG_ERROR([Can't LÖVE without SDL]))
-AC_SEARCH_LIBS([glLoadIdentity], [GL], [], AC_MSG_ERROR([Can't LÖVE without OpenGL]))
-#AC_SEARCH_LIBS([gluOrtho2D], [GLU], [], AC_MSG_ERROR([Can't LÖVE without OpenGL Utility Library]))
-AC_SEARCH_LIBS([alSourcePlay], [openal], [], AC_MSG_ERROR([Can't LÖVE without OpenAL]))
-lua=lua
-AC_ARG_WITH([luajit],
-	    [AS_HELP_STRING([--with-luajit], [Use LuaJIT instead of lua and llvm-lua])],
-	    [lua=luajit],
-	    [])
-AC_ARG_WITH([llvm-lua],
-	    [AS_HELP_STRING([--with-llvm-lua], [Use llvm-lua instead of lua and LuaJIT])],
-	    [lua=llvm-lua],
-	    [])
-
-AS_IF([test "$lua" = "lua"],
-	AC_SEARCH_LIBS(
-		[lua_pcall],
-		[lua lua5.1],
-		if test "$ac_cv_search_lua_pcall" = "-llua5.1"; then
-			AC_SUBST([INCLUDE_LUA], [-I/usr/include/lua5.1])
-		fi,
-		AC_MSG_ERROR([Can't LÖVE without Lua])
-	)
-      )
-AS_IF([test "$lua" = "luajit"],
-	AC_SEARCH_LIBS(
-		[lua_pcall],
-		[luajit luajit-5.1],
-		AC_SUBST([INCLUDE_LUA], [-I/usr/include/luajit-2.0]),
-		AC_MSG_ERROR([Can't LÖVE without LuaJIT])
-	)
-      )
-AS_IF([test "$lua" = "llvm-lua"],
-	AC_SEARCH_LIBS(
-		[lua_pcall],
-		[llvm-lua],
-		[],
-		AC_MSG_ERROR([Can't LÖVE without llvm-lua])
-	)
-      )
-
-AC_SEARCH_LIBS([ilInit], [IL], [], AC_MSG_ERROR([Can't LÖVE without DevIL]))
-AC_SEARCH_LIBS([FT_Load_Glyph], [freetype], [], AC_MSG_ERROR([Can't LÖVE without FreeType]))
-AC_SEARCH_LIBS([PHYSFS_init], [physfs], [], AC_MSG_ERROR([Can't LÖVE without PhysicsFS]))
-AC_SEARCH_LIBS([ModPlug_Load], [modplug], [], AC_MSG_ERROR([Can't LÖVE without ModPlug]))
-AC_SEARCH_LIBS([ov_open], [vorbisfile], [], AC_MSG_ERROR([Can't LÖVE without VorbisFile]))
+AC_LANG([C++])
 
 
+includes=
+
+AC_DEFUN([ACLOVE_CXX_FLAG_TEST], # WARNING: NOT REENTRANT
+		 [aclove_cxx_flag_test_save_cflags="$CXXFLAGS"
+		  CXXFLAGS="$1"
+		  AC_MSG_CHECKING([whether $CXX supports flag $1])
+		  AC_COMPILE_IFELSE([AC_LANG_PROGRAM([])],
+			  [AC_MSG_RESULT([yes])]; $2,
+			  [AC_MSG_RESULT([no]); $3])
+		  CXXFLAGS="$aclove_cxx_flag_test_save_cflags"])
+
+AC_DEFUN([LOVE_MSG_ERROR],
+		 [AC_MSG_ERROR([LÖVE needs "$1"[,] please install "$1" with development files and try again])])
+
+# C++11 support
+cxx11name="no"
+ACLOVE_CXX_FLAG_TEST([-std=c++0x], cxx11name="c++0x", [])
+ACLOVE_CXX_FLAG_TEST([-std=c++11], cxx11name="c++11", [])
+AS_VAR_IF([cxx11name], [no], AC_MSG_ERROR([LÖVE needs a C++ compiler with C++11 support]), CXXFLAGS="$CXXFLAGS -std=$cxx11name")
+
+# Allow people on OSX to use autotools, they need their platform files
+AC_ARG_ENABLE([osx],
+			  AC_HELP_STRING([--enable-osx], [Compile platform-specific files for OSX]), [], [enable_osx=no])
+AS_VAR_IF([enable_osx], [no], [], #else
+		  ac_cv_search_glLoadIdentity="-framework OpenGL"
+		  AC_SUBST([LDFLAGS], ["${LDFLAGS} -framework CoreFoundation -framework Cocoa"])
+		  AC_SUBST([CPPFLAGS], ["${CPPFLAGS} -I../platform/macosx"]))
+
+# --with-lua and --with-luaversion
+AC_ARG_WITH([lua], [AS_HELP_STRING([--with-lua], [Select the lua implementation])],
+			[], [with_lua=luajit])
+AC_ARG_WITH([luaversion], [AS_HELP_STRING([--with-luaversion], [Select the lua version])],
+			[], [with_luaversion=5.1])
+
+# pkg-config libraries
+AM_PATH_SDL2([], [], [LOVE_MSG_ERROR([SDL 2])])
+PKG_CHECK_MODULES([lua], [${with_lua}${with_luaversion}], [lua_found=yes],
+				  [PKG_CHECK_MODULES([lua], [${with_lua}], [lua_found=yes], [lua_found=no])])
+PKG_CHECK_MODULES([freetype2], [freetype2], [], [LOVE_MSG_ERROR([FreeType2])])
+PKG_CHECK_MODULES([openal], [openal], [], [LOVE_MSG_ERROR([OpenAL])])
+PKG_CHECK_MODULES([devil], [IL], [], [LOVE_MSG_ERROR([DevIL])])
+PKG_CHECK_MODULES([libmodplug], [libmodplug], [], [LOVE_MSG_ERROR([libmodplug])])
+PKG_CHECK_MODULES([vorbisfile], [vorbisfile], [], [LOVE_MSG_ERROR([libvorbis and libvorbisfile])])
+
+# Other libraries
+AC_SEARCH_LIBS([sqrt], [m], [], [LOVE_MSG_ERROR([the C math library])])
+AC_SEARCH_LIBS([PHYSFS_init], [physfs], [], [LOVE_MSG_ERROR([PhysicsFS])])
+AC_SEARCH_LIBS([glLoadIdentity], [GL], [], [LOVE_MSG_ERROR([OpenGL])])
+
+# Lua, treated seperately because of --with-lua
+AS_VAR_IF([with_luaversion], [5.2], [luatest=lua_version], [luatest=lua_pcall]) # use lua_version for 5.2
+AS_VAR_IF([lua_found], [yes],
+		  #if
+		  [
+		   luaheaders_found=yes
+		   AC_MSG_CHECKING([for library containing ${luatest}])
+		   AC_MSG_RESULT([${lua_LIBS}])],
+		  #else
+		  [
+		   AC_MSG_WARN([Could not find pkg-config definition for ${with_lua}${with_luaversion} or ${with_lua}, falling back to manual detection])
+		   AC_SEARCH_LIBS([$luatest], ["${with_lua}${with_luaversion}" "${with_lua}"], [],
+						  [LOVE_MSG_ERROR([$with_lua])])
+		   luaheaders_found=no
+		   AC_CHECK_HEADER(["${with_lua}${with_luaversion}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}${with_luaversion}"], [])
+		   AC_CHECK_HEADER(["${with_lua}/lua.h"], [luaheaders_found=yes includes="$includes -I/usr/include/${with_lua}"], [])])
+AS_VAR_IF([luaheaders_found], [yes], [], #else
+		  [
+		   AC_MSG_WARN([Could not locate lua headers for ${with_lua}${with_luaversion} or ${with_lua}, you probably need to specify them with CPPFLAGS])])
+
+# mpg123, treated seperately because it can be disabled (default on)
+# also not pkg-config because of the FILE_OFFSET_BITS.. bit
 AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
 AC_ARG_ENABLE([mpg123], AC_HELP_STRING([--disable-mpg123], [Disable mp3 support, for patent-free builds]), [], [enable_mpg123=yes])
-AS_IF([test "x$enable_mpg123" != xno],
-	AC_SEARCH_LIBS([mpg123_open_feed], [mpg123], [], AC_MSG_ERROR([Can't LÖVE without Mpg123])),
-	AC_DEFINE([LOVE_NOMPG123], [], [Build without mpg123]))
-AS_IF([test "x$enable_mpg123" != xno],
-	AC_SEARCH_LIBS([mpg123_seek_64], [mpg123], AC_SUBST([FILE_OFFSET],[-D_FILE_OFFSET_BITS=64]), AC_SUBST([FILE_OFFSET],[])))
-
-AC_ARG_ENABLE([exe], AC_HELP_STRING([--disable-exe], [Disable building of executable launcher]), [], [enable_exe=yes])
-AS_IF([test "x$enable_exe" != xno],
-	  AC_DEFINE([LOVE_BUILD_EXE], [], [Don't build launcher]))
-AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno])
+AS_VAR_IF([enable_mpg123], [no],
+	  AC_DEFINE([LOVE_NOMPG123], [], [Build without mpg123]),
+	  # else
+	  AC_SEARCH_LIBS([mpg123_open_feed], [mpg123], [],
+					 [LOVE_MSG_ERROR([libmpg123])])
+	  AC_SEARCH_LIBS([mpg123_seek_64], [mpg123],
+					 AC_SUBST([FILE_OFFSET],[-D_FILE_OFFSET_BITS=64]),
+					 AC_SUBST([FILE_OFFSET],[])))
 
 
+# GME, treated seperately because it can be enabled (default off)
 AC_ARG_ENABLE([gme], AC_HELP_STRING([--enable-gme], [Enable GME support, for more chiptuney goodness]), [], [enable_gme=no])
 AC_ARG_ENABLE([gme], AC_HELP_STRING([--enable-gme], [Enable GME support, for more chiptuney goodness]), [], [enable_gme=no])
-AS_IF([test "x$enable_gme" == xyes],
-	  AC_SEARCH_LIBS([gme_open_data], [gme], [], AC_MSG_ERROR([Can't LÖVE without gme])))
-AS_IF([test "x$enable_gme" == xyes],
-	  AC_DEFINE([LOVE_SUPPORT_GME], [], [Enable gme]))
+AS_VAR_IF([enable_gme], [yes],
+	  AC_SEARCH_LIBS([gme_open_data], [gme], [], [LOVE_MSG_ERROR([gme])])
+	  AC_DEFINE([LOVE_SUPPORT_GME], [], [Enable gme])
+	  AC_CHECK_HEADER([gme/gme.h], [includes="$includes -I/usr/include/gme"], []))
+
+# libenet check for socklen_t
+AC_CHECK_TYPE([socklen_t], [AC_DEFINE([HAS_SOCKLEN_T], [1], [Define if socklen_t exists.] )], , 
+              #include <sys/types.h>
+              #include <sys/socket.h>
+)
+
+# Optionally build the executable (default on)
+AC_ARG_ENABLE([exe],
+			  AC_HELP_STRING([--disable-exe], [Disable building of executable launcher]), [], [enable_exe=yes])
+
+AS_VAR_IF([enable_exe], [no], [], #else
+	  AC_DEFINE([LOVE_BUILD_EXE], [], [Skip building launcher]))
+
+AM_CONDITIONAL([LOVE_BUILD_EXE], [test "x$enable_exe" != xno])
+AM_CONDITIONAL([LOVE_NOMPG123], [test "x$enable_mpg123" == xno])
+AM_CONDITIONAL([LOVE_TARGET_OSX], [test "x$enable_osx" != xno])
+
+# Automatic script file rebuilding
+AC_CHECK_PROGS([LUA_EXECUTABLE], ["${with_lua}${with_luaversion}" "${with_lua}" "lua"], [:])
+AS_VAR_IF([LUA_EXECUTABLE], [:],
+		  [AC_MSG_WARN([Did not find a lua executable, you may need to update the scripts manually if you change them])], [])
+
+# Set our includes as automake variable
+AC_SUBST([LOVE_INCLUDES], ["$includes"])
+
+m4_include([configure-modules.ac])
 
 
 AC_CONFIG_FILES([
 AC_CONFIG_FILES([
 	Makefile
 	Makefile
 	src/Makefile
 	src/Makefile
+	platform/unix/debian/control
+	platform/unix/debian/changelog
+	platform/unix/debian/rules
 ])
 ])
 AC_OUTPUT
 AC_OUTPUT
+
+chmod 755 platform/unix/debian/rules

+ 0 - 11
platform/unix/debian

@@ -1,11 +0,0 @@
-Package: love
-Version: %VERSION%
-Section: games
-Priority: optional
-Architecture: %ARCHITECTURE%
-Essential: no
-Depends: libdevil1c2, libfreetype6, libgl1-mesa-glx, liblua5.1-0, libphysfs1, libsdl1.2debian, libopenal1, libogg0, libvorbis0a, libvorbisfile3, libmodplug0c2, libmpg123-0
-Installed-Size: %INSTALLSIZE%
-Maintainer: Bart van Strien [[email protected]]
-Provides: love
-Description: LOVE is a free 2D game engine which enables easy game creation in Lua.

+ 5 - 0
platform/unix/debian/changelog.in

@@ -0,0 +1,5 @@
+love@LOVE_SUFFIX@ (0.9.0~ppatest5) precise; urgency=medium
+
+  * Upstream testing release
+
+ -- Bart van Strien <[email protected]>  Sat, 2 Nov 2013 16:23:40 +0100

+ 1 - 0
platform/unix/debian/compat

@@ -0,0 +1 @@
+9

+ 59 - 0
platform/unix/debian/control.in

@@ -0,0 +1,59 @@
+Source: love@LOVE_SUFFIX@
+Section: games
+Priority: extra
+Maintainer: Bart van Strien <[email protected]>
+Build-Depends: debhelper (>= 9),
+               autotools-dev,
+               pkg-config,
+               libdevil-dev,
+               libfreetype6-dev,
+               libluajit-5.1-dev,
+               libphysfs-dev,
+               libsdl2-dev (>= 2.0.0),
+               libopenal-dev,
+               libogg-dev,
+               libvorbis-dev,
+               libflac-dev,
+               libflac++-dev,
+               libmodplug-dev,
+               libmpg123-dev,
+               libmng-dev
+Standards-Version: 3.9.3
+Homepage: http://love2d.org
+
+Package: liblove@LOVE_SUFFIX@
+Architecture: any
+Multi-Arch: same
+Pre-Depends: ${misc:Pre-Depends}
+Depends: ${misc:Depends},
+         ${shlibs:Depends},
+         libdevil1c2,
+         libmng1,
+         libfreetype6,
+         libgl1-mesa-glx,
+         libluajit-5.1-2,
+         libphysfs-1.0-0,
+         libsdl2 (>= 2.0.0),
+         libopenal1,
+         libogg0,
+         libvorbis0a,
+         libvorbisfile3,
+         libmodplug1,
+         libmpg123-0
+Description: LOVE is a free 2D game engine which enables easy game creation in Lua.
+
+Package: love@LOVE_SUFFIX@
+Architecture: any
+Multi-Arch: same
+Depends: ${misc:Depends},
+         liblove@LOVE_SUFFIX@ (= ${binary:Version})
+Description: LOVE is a free 2D game engine which enables easy game creation in Lua.
+
+Package: love@LOVE_SUFFIX@-dbg
+Priority: extra
+Section: debug
+Architecture: any
+Multi-Arch: same
+Depends: ${misc:Depends},
+         love@LOVE_SUFFIX@ (= ${binary:Version}),
+Description: LOVE is a free 2D game engine which enables easy game creation in Lua.

+ 20 - 0
platform/unix/debian/copyright

@@ -0,0 +1,20 @@
+Copyright (c) 2006-2013 LOVE Development Team
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any damages
+arising from the use of this software.
+
+Permission is granted to anyone to use this software for any purpose,
+including commercial applications, and to alter it and redistribute it
+freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must not
+claim that you wrote the original software. If you use this software
+in a product, an acknowledgment in the product documentation would be
+appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and must not be
+misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.

+ 2 - 0
platform/unix/debian/docs

@@ -0,0 +1,2 @@
+changes.txt
+license.txt

+ 1 - 0
platform/unix/debian/liblove-unstable.install

@@ -0,0 +1 @@
+usr/lib/*/liblove-unstable.so.*

+ 1 - 0
platform/unix/debian/liblove.install

@@ -0,0 +1 @@
+usr/lib/*/liblove.so.*

+ 1 - 0
platform/unix/debian/love-unstable.install

@@ -0,0 +1 @@
+usr/bin/love-unstable

+ 1 - 0
platform/unix/debian/love.install

@@ -0,0 +1 @@
+usr/bin/love

+ 1 - 0
platform/unix/debian/love.manpages

@@ -0,0 +1 @@
+platform/unix/love.1

+ 16 - 0
platform/unix/debian/rules.in

@@ -0,0 +1,16 @@
+#!/usr/bin/make -f
+
+DEB_HOST_ARCH_CPU ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_CPU)
+DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
+
+override_dh_auto_configure:
+	dh_auto_configure -- --with-lua=luajit
+
+override_dh_link:
+	dh_link -plove@LOVE_SUFFIX@-dev usr/lib/$(DEB_HOST_MULTIARCH)/liblove@[email protected] usr/lib/$(DEB_HOST_MULTIARCH)/liblove@[email protected]
+
+override_dh_strip:
+	dh_strip --dbg-package=love@LOVE_SUFFIX@-dbg
+
+%:
+	dh  $@ --parallel

+ 1 - 0
platform/unix/debian/source/format

@@ -0,0 +1 @@
+3.0 (native)

+ 2 - 21
platform/unix/exclude

@@ -1,24 +1,5 @@
-\./modules/native/tcc/libtcc/tccelf\.c
-\./modules/native/tcc/libtcc/x86_64-gen\.c
-\./modules/native/tcc/libtcc/tccasm\.c
-\./modules/native/tcc/libtcc/tccpp\.c
-\./modules/native/tcc/libtcc/il-gen\.c
-\./modules/native/tcc/libtcc/c67-gen\.c
-\./modules/native/tcc/libtcc/tcc\.c
-\./modules/native/tcc/libtcc/elf\.h
-\./modules/native/tcc/libtcc/tcccoff\.c
-\./modules/native/tcc/libtcc/config\.h
-\./modules/native/tcc/libtcc/i386-asm\.h
-\./modules/native/tcc/libtcc/tccpe\.c
-\./modules/native/tcc/libtcc/tcctok\.h
-\./modules/native/tcc/libtcc/arm-gen\.c
-\./modules/native/tcc/libtcc/i386-asm\.c
-\./modules/native/tcc/libtcc/i386-gen\.c
-\./modules/native/tcc/libtcc/tccgen\.c
-\./modules/native/tcc/libtcc/tcc\.h
-\./modules/native/tcc/libtcc/il-opcodes\.h
-\./modules/native/tcc/libtcc/coff\.h
-\./modules/native/tcc/libtcc/stab\.h
 \./libraries/luasocket/libluasocket/wsocket\.*
 \./libraries/luasocket/libluasocket/wsocket\.*
 \./modules/sound/lullaby/FLACDecoder\.*
 \./modules/sound/lullaby/FLACDecoder\.*
 \./love\.cpp
 \./love\.cpp
+\./modules/sound/lullaby/Mpg123Decoder\.cpp
+\./modules/sound/lullaby/Mpg123Decoder\.h

+ 20 - 10
platform/unix/gen-makefile

@@ -1,10 +1,12 @@
 #!/bin/bash
 #!/bin/bash
 echo Generating src/Makefile.am ...
 echo Generating src/Makefile.am ...
-cd src
-inc_current=.
+inc_current='$(srcdir)'
 inc_modules="$inc_current/modules"
 inc_modules="$inc_current/modules"
 inc_libraries="$inc_current/libraries"
 inc_libraries="$inc_current/libraries"
-echo "AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I/usr/include/AL -I/usr/include/freetype2  \$(INCLUDE_LUA) -I/usr/include/SDL \$(FILE_OFFSET) -I/usr/include/gme
+
+cat > src/Makefile.am << EOF
+AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I$inc_libraries/enet/libenet/include \$(LOVE_INCLUDES) \$(FILE_OFFSET)
+AM_CXXFLAGS = \$(SDL_CFLAGS)
 AUTOMAKE_OPTIONS = subdir-objects
 AUTOMAKE_OPTIONS = subdir-objects
 SUBDIRS =
 SUBDIRS =
 
 
@@ -16,13 +18,21 @@ love_LDADD = liblove.la
 love_SOURCES = love.cpp
 love_SOURCES = love.cpp
 endif
 endif
 
 
+# Compile scripts
+#scripts/%.lua.h: scripts/%.lua
+#	cd scripts; \
+#	lua auto.lua \$*
+#TODO: Figure out how to only do this on gnu make, and detect which lua
+#      executable to run
+
 # libLÖVE
 # libLÖVE
 lib_LTLIBRARIES = liblove.la
 lib_LTLIBRARIES = liblove.la
-liblove_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS)
-liblove_la_SOURCES = \\" > Makefile.am.tmp
-find . \( \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.h" -o -iname "*.lch" \) \) -exec echo '{}' \\ \; >> Makefile.am.tmp
-cat Makefile.am.tmp | grep -v -f"../platform/unix/exclude" | head -c -3 > Makefile.am
-#head -c -3 Makefile.am.tmp > Makefile.am
-rm Makefile.am.tmp
+liblove_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS) \$(SDL_LIBS)
+EOF
+
+platform/unix/genmodules >> src/Makefile.am
+
+printf "\n" >> src/Makefile.am
+
 cd ..
 cd ..
-echo src/Makefile.am is updated! \^.^
+echo "src/Makefile.am is updated! ^.^"

+ 168 - 0
platform/unix/genmodules

@@ -0,0 +1,168 @@
+#!/bin/bash
+
+love_suffix="$1"
+love_amsuffix="$(echo "$love_suffix" | sed 's/\-/_/g' | sed 's/\./_/g')"
+
+flags=""
+upper()
+{
+	echo "$@" | tr '[:lower:]' '[:upper:]'
+}
+
+implfind()
+{
+	find "$1" -maxdepth 1 -type d -exec basename '{}' \; | grep -v "^\." | tail -n +2
+}
+
+sourcefind()
+{
+	find "$1" $2 -type f \( -iname "*.c" -o -iname "*.cpp" -o -iname "*.h" -o -iname "*.lch" \) | awk "{print \"./$prefix\"\$0\" \\\\\"}" | grep -v -f"$LOVEROOT/platform/unix/exclude"
+}
+
+handlemodule()
+{
+	module="$1"
+	DEFINENAME="LOVE_MODULE_$(upper "$module")"
+	printf "$DEFINENAME"
+}
+
+handleimpl()
+{
+	module="$1"
+	implementation="$2"
+	name="$3"
+
+	printf "if $name\n"
+	FILES="$(sourcefind "$module/$implementation" | sed "s/^/    /")"
+	if [[ "x$FILES" != "x" ]]; then
+		printf "liblove${love_amsuffix}_la_SOURCES += \\\\\n"
+		printf "${FILES:0:${#FILES}-2}\n"
+	fi
+	printf "endif\n\n"
+}
+
+genmodules()
+{
+	LOVEROOT="$(pwd)"
+	cd src
+
+	printf "liblove${love_amsuffix}_la_SOURCES = \\\\\n"
+	sourcefind "common" | sed "s/^/    /"
+	FILES="$(sourcefind "scripts" | sed "s/^/    /")"
+	printf "${FILES:0:${#FILES}-2}\n\n"
+
+	cd modules
+	prefix="modules/"
+	for module in *; do
+		NAME=$(handlemodule "$module")
+		flags="$flags module-$module"
+
+		printf "if $NAME\n"
+
+		for implementation in $(implfind "$module"); do
+			flags="$flags implementation-$module-$implementation"
+			handleimpl "$module" "$implementation" "LOVE_IMPLEMENTATION_$(upper "$module")_$(upper "$implementation")"
+		done
+
+		FILES="$(sourcefind "$module" "-maxdepth 1" | sed "s/^/    /")"
+		if [[ "x$FILES" != "x" ]]; then
+			printf "liblove${love_amsuffix}_la_SOURCES += \\\\\n"
+			printf "${FILES:0:${#FILES}-2}\n"
+		fi
+
+		printf "endif\n\n"
+	done
+
+	cd ../libraries
+	prefix="libraries/"
+	for library in *; do
+		NAME="LOVE_LIBRARY_$(upper "$library")"
+		flags="$flags library-$library"
+
+		printf "if $NAME\n"
+		printf "liblove${love_amsuffix}_la_SOURCES += \\\\\n"
+		FILES="$(sourcefind "$library" | sed "s/^/    /")"
+		printf "${FILES:0:${#FILES}-2}\nendif\n\n"
+	done
+	cd ../..
+}
+
+genflags()
+{
+	for flag in $flags; do
+		prettyflag="$(echo "$flag" | sed 's/-/ love./' | sed 's/-/./g')"
+		varflag="enable_$(echo "$flag" | sed 's/^[^-]*-//' | sed 's/[^a-zA-Z0-9]/_/')"
+		defineflag="LOVE_ENABLE_$(upper $(echo $flag | sed 's/^[^-]*-//' | sed 's/-/_/g'))"
+		amflag="$(upper $(echo love-$flag | sed 's/-/_/g'))"
+		printf "AC_ARG_ENABLE([$flag], [  --disable-$flag    Turn off $prettyflag], [], [$varflag=true])\n"
+		printf "AH_TEMPLATE([$defineflag], [])\n"
+		printf "if test x\"\$$varflag\" == xtrue; then\n"
+		printf "    AC_DEFINE([$defineflag], [])\n"
+		printf "fi\n"
+		printf "AM_CONDITIONAL([$amflag], [test x\$$varflag == xtrue])\n\n"
+	done
+}
+
+echo Generating src/Makefile.am ...
+inc_current='$(srcdir)'
+inc_modules="$inc_current/modules"
+inc_libraries="$inc_current/libraries"
+
+cat > src/Makefile.am << EOF
+AM_CPPFLAGS = -I$inc_current -I$inc_modules -I$inc_libraries -I$inc_libraries/enet/libenet/include \$(LOVE_INCLUDES) \$(FILE_OFFSET)\
+	\$(SDL_CFLAGS) \$(lua_CFLAGS) \$(freetype2_CFLAGS)\
+	\$(openal_CFLAGS) \$(devil_CFLAGS) \$(libmodplug_CFLAGS)\
+	\$(vorbisfile_CFLAGS)
+AUTOMAKE_OPTIONS = subdir-objects
+SUBDIRS =
+SUFFIXES = .lua .lua.h
+
+if LOVE_BUILD_EXE
+# LÖVE executable
+bin_PROGRAMS = love${love_suffix}
+#love_LDFLAGS =
+love${love_amsuffix}_LDADD = liblove${love_suffix}.la \$(lua_LIBS)
+love${love_amsuffix}_SOURCES = love.cpp
+
+if LOVE_TARGET_OSX
+love${love_amsuffix}_LIBTOOLFLAGS = --tag=OBJCXX
+love${love_amsuffix}_SOURCES += \\
+    ../platform/macosx/OSX.h \\
+    ../platform/macosx/OSX.mm
+else
+love${love_amsuffix}_LIBTOOLFLAGS = --tag=CXX
+endif
+endif
+
+# Compile scripts
+.lua.lua.h:
+	cd scripts; \
+	\$(LUA_EXECUTABLE) auto.lua \$<
+
+# libLÖVE
+lib_LTLIBRARIES = liblove${love_suffix}.la
+liblove${love_amsuffix}_la_LDFLAGS = -module -export-dynamic \$(LDFLAGS)
+liblove${love_amsuffix}_la_LIBADD = \
+	\$(SDL_LIBS) \$(freetype2_LIBS) \$(lua_LIBS)\
+	\$(openal_LIBS) \$(devil_LIBS) \$(libmodplug_LIBS)\
+	\$(vorbisfile_LIBS)
+EOF
+
+genmodules >> src/Makefile.am
+
+cat >> src/Makefile.am << EOF
+if !LOVE_NOMPG123
+liblove${love_amsuffix}_la_SOURCES += \\
+    ./modules/sound/lullaby/Mpg123Decoder.cpp \\
+    ./modules/sound/lullaby/Mpg123Decoder.h
+endif
+EOF
+
+echo "src/Makefile.am is updated! ^.^"
+
+echo "Generating configure-modules.ac"
+genflags > configure-modules.ac
+cat >> configure-modules.ac << EOF
+AC_SUBST([LOVE_SUFFIX], [${love_suffix}])
+EOF
+echo "configure-modules.ac is updated! ^.^"

+ 0 - 7
platform/unix/get-libs

@@ -1,7 +0,0 @@
-#!/bin/sh
-# Get required packages.
-sudo apt-get -y install subversion build-essential automake autoconf libtool \
-liblua5.1-dev libopenal-dev libsdl1.2-dev libfreetype6-dev \
-libphysfs-dev libdevil-dev libtiff4-dev libmng-dev \
-liblcms1-dev ftp-upload libmpg123-dev libmodplug-dev libpng12-dev \
-libvorbis-dev

+ 26 - 0
platform/unix/love.1

@@ -0,0 +1,26 @@
+.\" (c) 2008-2011 Miriam Ruiz <[email protected]>
+.\"
+.\" This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damagesarising from the use of this software.
+.\"
+.\" Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
+.\"
+.\" 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
+.\"
+.\" 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
+.\"
+.\" 3. This notice may not be removed or altered from any source distribution.
+.\"
+.\" Modifications:
+.\" - Update version to 0.9 and remove reference to doc dir - Bart van Strien, 2013
+.TH "LÖVE" "1" "0.9" "" ""
+.SH "NAME"
+love \- 2D game development framework
+.SH "SYNOPSIS"
+.B love
+<\fIgame.love\fR>
+.SH "DESCRIPTION"
+LÖVE was created to be a user\-friendly engine in which simple (or complicated) games could be made without having extensive knowledge of system or graphics functions and without having to dedicate time towards developing the same engine features time and time again.
+.P
+Developed with cross\-platform implementation in mind, it utilizes the latest open source libraries to deliver a similar game experience, independent of operating system. By relying on the Lua scripting language for game\-specific programming, it allows even the novice game creator to quickly and efficiently develop an idea into a fully working game.
+.SH "SEE ALSO"
+You can find more information at \fIhttp://love2d.org/\fR

+ 2 - 3
platform/unix/love.desktop → platform/unix/love.desktop.in

@@ -2,10 +2,9 @@
 Name=LÖVE
 Name=LÖVE
 Comment=The unquestionably awesome 2D game engine
 Comment=The unquestionably awesome 2D game engine
 MimeType=application/x-love-game;
 MimeType=application/x-love-game;
-Exec=/usr/bin/love
+Exec=@bindir@/love
 Type=Application
 Type=Application
 Categories=Development;Game;
 Categories=Development;Game;
 Terminal=false
 Terminal=false
-Icon=love.svg
+Icon=love
 NoDisplay=true
 NoDisplay=true
-

+ 0 - 0
platform/unix/app.svg → platform/unix/love.svg


+ 0 - 65
platform/unix/make-package

@@ -1,65 +0,0 @@
-#!/bin/bash
-echo
-echo "Packing LÖVE to go v1.2"
-echo
-
-arch="i386"
-
-if [ "`uname -m | grep -c -G x86_64`" != 0 ]; then
-	arch="amd64"
-elif [ "`uname -m | grep -c -G ppc`" != 0 ]; then
-	arch="ppc"
-fi
-
-if [ -z "$2" ]; then
-	echo "Syntax:  ./make-package <package> <version>"
-	echo "Example: ./make-package deb 0.3.0-1"
-	echo "All files will be created in this folder."
-	echo
-	exit 0
-fi
-case "$1" in
-	deb )
-		strip ../../src/love
-		mkdir deb
-		mkdir deb/DEBIAN
-		cat debian | sed "s/%VERSION%/$2/" | sed "s/%ARCHITECTURE%/$arch/g" > deb/DEBIAN/tmp
-		cat deb/DEBIAN/tmp
-		sed "s/%INSTALLSIZE%/`ls -l ../../src/love | awk '{ sum += $5 } END { printf "%.2f", sum / 1000 }'`/" < deb/DEBIAN/tmp > deb/DEBIAN/control
-		rm deb/DEBIAN/tmp
-		cp postinst deb/DEBIAN/postinst
-		cp postrm deb/DEBIAN/postrm
-		mkdir deb/usr
-		mkdir deb/usr/bin
-		cp ../../src/love deb/usr/bin/love
-		mkdir deb/usr/share
-		mkdir deb/usr/share/mime
-		mkdir deb/usr/share/mime/packages
-		cp love.xml deb/usr/share/mime/packages
-		mkdir deb/usr/share/icons
-		mkdir deb/usr/share/icons/gnome
-		mkdir deb/usr/share/icons/gnome/scalable
-		mkdir deb/usr/share/icons/gnome/scalable/apps
-		cp app.svg deb/usr/share/icons/gnome/scalable/apps/love.svg
-		mkdir deb/usr/share/icons/gnome/scalable/mimetypes
-		cp game.svg deb/usr/share/icons/gnome/scalable/mimetypes/gnome-mime-application-x-love-game.svg
-		mkdir deb/usr/share/applications
-		cp love.desktop deb/usr/share/applications
-		dpkg -b deb love-$2.deb && \
-		echo "  * love-$2.deb created"
-		rm -rf deb
-		;;
-	src )
-		cd ../../../
-		tar -czf love/platform/unix/love-$2-src.tar.gz --exclude=*.o --exclude=.* love/demos/* love/*.txt love/src/ && \
-		echo "  * love-$2-src.tar.gz created"
-		tar -cjf love/platform/unix/love-$2-src.tar.bz2 --exclude=*.o --exclude=.* love/demos/* love/*.txt love/src/ && \
-		echo "  * love-$2-src.tar.bz2 created"
-		zip -9q love/platform/unix/love-$2-src.zip love/*.txt love/demos/* `find love/src/* | grep -viE *.o` && \
-		echo "  * love-$2-src.zip created"
-		;;
-	* )
-		echo "Unknown package type: $1"
-		echo "Valid types: deb src"
-esac
-echo

+ 13 - 9
readme.md

@@ -10,15 +10,19 @@ Compilation
 -----------
 -----------
 
 
 ###Windows
 ###Windows
-Use the project files for Visual Studio 2010 located in the platform dir.
+Follow the instructions at the [megasource][megasource] repository page.
 
 
 ###*nix
 ###*nix
-Run platform/unix/automagic, then run ./configure and make.
+Run `platform/unix/automagic` from the repository root, then run ./configure and make.
 
 
-###OSX
-Use the XCode project in platform/macosx.
+	$ platform/unix/automagic
+	$ ./configure
+	$ make
 
 
-For both Windows and OSX there are dependencies available [here][dependencies].
+###Mac OS X
+Download the required frameworks from [here][dependencies] and place them in `/Library/Frameworks/`.
+
+Then use the Xcode project found at `platform/macosx/love.xcodeproj`.
 
 
 Repository information
 Repository information
 ----------------------
 ----------------------
@@ -37,15 +41,14 @@ and there's a ppa for ubuntu, [ppa:bartbes/love-stable][stableppa].
 
 
 There are also unstable/nightly builds:
 There are also unstable/nightly builds:
 
 
-- For windows they are located [here][winbuilds].
+- Most can be found [here][builds].
 - For ubuntu linux they are in [ppa:bartbes/love-unstable][unstableppa]
 - For ubuntu linux they are in [ppa:bartbes/love-unstable][unstableppa]
 - For arch linux there's [love-hg][aur] in the AUR.
 - For arch linux there's [love-hg][aur] in the AUR.
-- For other linuxes and OSX there are currently no official builds.
 
 
 Dependencies
 Dependencies
 ------------
 ------------
 
 
-- SDL
+- SDL2
 - OpenGL
 - OpenGL
 - OpenAL
 - OpenAL
 - Lua / LuaJIT / LLVM-lua
 - Lua / LuaJIT / LLVM-lua
@@ -61,7 +64,8 @@ Dependencies
 [forums]: http://love2d.org/forums
 [forums]: http://love2d.org/forums
 [irc]: irc://irc.oftc.net/love
 [irc]: irc://irc.oftc.net/love
 [dependencies]: http://love2d.org/sdk
 [dependencies]: http://love2d.org/sdk
-[winbuilds]: http://love2d.org/builds
+[megasource]: https://bitbucket.org/rude/megasource
+[builds]: http://love2d.org/builds
 [stableppa]: https://launchpad.net/~bartbes/+archive/love-stable
 [stableppa]: https://launchpad.net/~bartbes/+archive/love-stable
 [unstableppa]: https://launchpad.net/~bartbes/+archive/love-unstable
 [unstableppa]: https://launchpad.net/~bartbes/+archive/love-unstable
 [aur]: http://aur.archlinux.org/packages.php?ID=35279
 [aur]: http://aur.archlinux.org/packages.php?ID=35279

+ 1 - 1
src/common/Data.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 1 - 1
src/common/EnumMap.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 1 - 3
src/common/Exception.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -23,8 +23,6 @@
 
 
 #include <iostream>
 #include <iostream>
 
 
-using namespace std;
-
 namespace love
 namespace love
 {
 {
 
 

+ 1 - 1
src/common/Exception.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 4 - 4
src/common/Matrix.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -104,7 +104,7 @@ void Matrix::setTranslation(float x, float y)
 void Matrix::setRotation(float rad)
 void Matrix::setRotation(float rad)
 {
 {
 	setIdentity();
 	setIdentity();
-	float c = cos(rad), s = sin(rad);
+	float c = cosf(rad), s = sinf(rad);
 	e[0] = c;
 	e[0] = c;
 	e[4] = -s;
 	e[4] = -s;
 	e[1] = s;
 	e[1] = s;
@@ -128,7 +128,7 @@ void Matrix::setShear(float kx, float ky)
 void Matrix::setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 void Matrix::setTransformation(float x, float y, float angle, float sx, float sy, float ox, float oy, float kx, float ky)
 {
 {
 	memset(e, 0, sizeof(float)*16); // zero out matrix
 	memset(e, 0, sizeof(float)*16); // zero out matrix
-	float c = cos(angle), s = sin(angle);
+	float c = cosf(angle), s = sinf(angle);
 	// matrix multiplication carried out on paper:
 	// matrix multiplication carried out on paper:
 	// |1     x| |c -s    | |sx       | | 1 ky    | |1     -ox|
 	// |1     x| |c -s    | |sx       | | 1 ky    | |1     -ox|
 	// |  1   y| |s  c    | |   sy    | |kx  1    | |  1   -oy|
 	// |  1   y| |s  c    | |   sy    | |kx  1    | |  1   -oy|
@@ -181,7 +181,7 @@ void Matrix::shear(float kx, float ky)
 // | e2 e6 e10 e14 |
 // | e2 e6 e10 e14 |
 // | e3 e7 e11 e15 |
 // | e3 e7 e11 e15 |
 
 
-void Matrix::transform(vertex *dst, const vertex *src, int size) const
+void Matrix::transform(Vertex *dst, const Vertex *src, int size) const
 {
 {
 	for (int i = 0; i<size; i++)
 	for (int i = 0; i<size; i++)
 	{
 	{

+ 2 - 2
src/common/Matrix.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -148,7 +148,7 @@ public:
 	 * @param src The source vertices.
 	 * @param src The source vertices.
 	 * @param size The number of vertices.
 	 * @param size The number of vertices.
 	 **/
 	 **/
-	void transform(vertex *dst, const vertex *src, int size) const;
+	void transform(Vertex *dst, const Vertex *src, int size) const;
 
 
 private:
 private:
 
 

+ 1 - 1
src/common/Memoizer.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 1 - 1
src/common/Memoizer.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 80 - 21
src/common/Module.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -29,37 +29,96 @@
 
 
 namespace
 namespace
 {
 {
-	std::map<std::string, love::Module*> registry;
+	typedef std::map<std::string, love::Module*> ModuleRegistry;
+
+	// The registry must be dynamically managed, because some modules
+	// (the math module) are static globals that are not guaranteed to
+	// be destroyed before other static globals.
+	ModuleRegistry *registry = nullptr;
+
+	ModuleRegistry &registryInstance()
+	{
+		if (!registry)
+			registry = new ModuleRegistry;
+
+		return *registry;
+	}
+
+	void freeEmptyRegistry()
+	{
+		if (registry && registry->empty())
+		{
+			delete registry;
+			registry = nullptr;
+		}
+	}
+
 } // anonymous namespace
 } // anonymous namespace
 
 
 namespace love
 namespace love
 {
 {
-	void Module::registerInstance(Module *instance)
-	{
-		if (instance == NULL)
-			throw Exception("Module instance is NULL");
-
-		std::string name(instance->getName());
 
 
-		std::map<std::string, Module*>::iterator it = registry.find(name);
+Module::~Module()
+{
+	ModuleRegistry &registry = registryInstance();
 
 
-		if (registry.end() != it)
+	// We can't use the overridden Module::getName() in this destructor.
+	for (auto it = registry.begin(); it != registry.end(); ++it)
+	{
+		if (it->second == this)
 		{
 		{
-			if (it->second == instance)
-				return;
-			throw Exception("Module %s already registered!", instance->getName());
+			registry.erase(it);
+			break;
 		}
 		}
-
-		registry.insert(make_pair(name, instance));
 	}
 	}
 
 
-	Module *Module::getInstance(const char *name)
+	freeEmptyRegistry();
+}
+
+void Module::registerInstance(Module *instance)
+{
+	if (instance == nullptr)
+		throw Exception("Module instance is null");
+
+	std::string name(instance->getName());
+
+	ModuleRegistry &registry = registryInstance();
+
+	auto it = registry.find(name);
+
+	if (it != registry.end())
 	{
 	{
-		std::map<std::string, Module*>::iterator it = registry.find(std::string(name));
+		if (it->second == instance)
+			return;
+		throw Exception("Module %s already registered!", instance->getName());
+	}
+
+	registry.insert(make_pair(name, instance));
+}
+
+Module *Module::getInstance(const std::string &name)
+{
+	ModuleRegistry &registry = registryInstance();
+
+	auto it = registry.find(name);
+
+	if (registry.end() == it)
+		return nullptr;
+
+	return it->second;
+}
 
 
-		if (registry.end() == it)
-			return NULL;
+Module *Module::findInstance(const std::string &name)
+{
+	ModuleRegistry &registry = registryInstance();
 
 
-		return it->second;
+	for (auto it = registry.begin(); it != registry.end(); ++it)
+	{
+		if (it->first.find(name) == 0)
+			return it->second;
 	}
 	}
-} // namespace love
+
+	return nullptr;
+}
+
+} // love

+ 13 - 5
src/common/Module.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -22,7 +22,6 @@
 #define LOVE_MODULE_H
 #define LOVE_MODULE_H
 
 
 // LOVE
 // LOVE
-#include "runtime.h"
 #include "Exception.h"
 #include "Exception.h"
 #include "Object.h"
 #include "Object.h"
 
 
@@ -38,7 +37,7 @@ public:
 	/**
 	/**
 	 * Destructor.
 	 * Destructor.
 	 **/
 	 **/
-	virtual ~Module() {};
+	virtual ~Module();
 
 
 	/**
 	/**
 	 * Gets the name of the module. This is used in case of errors
 	 * Gets the name of the module. This is used in case of errors
@@ -59,9 +58,18 @@ public:
 	 * Retrieve module instance from internal registry. May return NULL
 	 * Retrieve module instance from internal registry. May return NULL
 	 * if module not registered.
 	 * if module not registered.
 	 * @param name The full name of the module.
 	 * @param name The full name of the module.
-	 * @returns Module instance of NULL if the module is not registered.
+	 * @return Module instance or NULL if the module is not registered.
 	 */
 	 */
-	static Module *getInstance(const char *name);
+	static Module *getInstance(const std::string &name);
+
+	/**
+	 * Find the first module instance from the internal registry whose name
+	 * starts with the supplied name. May return NULL if module is not
+	 * registered or the supplied name is not part of any module name.
+	 * @param name The partial name of the module.
+	 * @return Module instance or NULL if the module is not registered.
+	 **/
+	static Module *findInstance(const std::string &name);
 
 
 }; // Module
 }; // Module
 
 

+ 1 - 1
src/common/Object.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 28 - 1
src/common/Object.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -65,6 +65,33 @@ public:
 	 **/
 	 **/
 	virtual void release();
 	virtual void release();
 
 
+	/**
+	 * Meant to be used as a temporary object. Facilitates safer and cleaner
+	 * code to release objects by doing so when the AutoRelease object is
+	 * destroyed (e.g. goes out of scope.)
+	 **/
+	class AutoRelease
+	{
+	public:
+
+		AutoRelease(Object *obj)
+			: object(obj)
+		{
+		}
+
+		~AutoRelease()
+		{
+			if (object)
+				object->release();
+		}
+
+	private:
+
+		AutoRelease() {}
+		Object *object;
+
+	}; // AutoRelease
+
 private:
 private:
 
 
 	// The reference count.
 	// The reference count.

+ 5 - 3
src/common/Reference.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -26,12 +26,14 @@ namespace love
 const char REFERENCE_TABLE_NAME[] = "love-references";
 const char REFERENCE_TABLE_NAME[] = "love-references";
 
 
 Reference::Reference()
 Reference::Reference()
-	: L(0), idx(LUA_REFNIL)
+	: L(0)
+	, idx(LUA_REFNIL)
 {
 {
 }
 }
 
 
 Reference::Reference(lua_State *L)
 Reference::Reference(lua_State *L)
-	: L(0), idx(LUA_REFNIL)
+	: L(L)
+	, idx(LUA_REFNIL)
 {
 {
 	ref(L);
 	ref(L);
 }
 }

+ 1 - 1
src/common/Reference.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 2 - 2
src/common/StringMap.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -70,7 +70,7 @@ public:
 
 
 		for (unsigned i = 0; i < MAX; ++i)
 		for (unsigned i = 0; i < MAX; ++i)
 		{
 		{
-			unsigned str_i = (str_hash + i) % MAX; //this isn't used, is this intentional?
+			unsigned str_i = (str_hash + i) % MAX;
 
 
 			if (!records[str_i].set)
 			if (!records[str_i].set)
 				return false;
 				return false;

+ 91 - 11
src/common/Variant.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -26,7 +26,7 @@ namespace love
 
 
 extern StringMap<Type, TYPE_MAX_ENUM> types;
 extern StringMap<Type, TYPE_MAX_ENUM> types;
 
 
-love::Type extractudatatype(lua_State *L, int idx)
+static love::Type extractudatatype(lua_State *L, int idx)
 {
 {
 	Type t = INVALID_ID;
 	Type t = INVALID_ID;
 	if (!lua_isuserdata(L, idx))
 	if (!lua_isuserdata(L, idx))
@@ -42,21 +42,39 @@ love::Type extractudatatype(lua_State *L, int idx)
 	return t;
 	return t;
 }
 }
 
 
+static inline void delete_table(std::vector<std::pair<Variant*, Variant*> > *table)
+{
+	while (!table->empty())
+	{
+		std::pair<Variant*, Variant*> &kv = table->back();
+		kv.first->release();
+		kv.second->release();
+		table->pop_back();
+	}
+	delete table;
+}
+
+Variant::Variant()
+	: type(NIL)
+	, data()
+{
+}
+
 Variant::Variant(bool boolean)
 Variant::Variant(bool boolean)
+	: type(BOOLEAN)
 {
 {
-	type = BOOLEAN;
 	data.boolean = boolean;
 	data.boolean = boolean;
 }
 }
 
 
 Variant::Variant(double number)
 Variant::Variant(double number)
+	: type(NUMBER)
 {
 {
-	type = NUMBER;
 	data.number = number;
 	data.number = number;
 }
 }
 
 
 Variant::Variant(const char *string, size_t len)
 Variant::Variant(const char *string, size_t len)
+	: type(STRING)
 {
 {
-	type = STRING;
 	char *buf = new char[len+1];
 	char *buf = new char[len+1];
 	memset(buf, 0, len+1);
 	memset(buf, 0, len+1);
 	memcpy(buf, string, len);
 	memcpy(buf, string, len);
@@ -65,21 +83,21 @@ Variant::Variant(const char *string, size_t len)
 }
 }
 
 
 Variant::Variant(char c)
 Variant::Variant(char c)
+	: type(CHARACTER)
 {
 {
-	type = CHARACTER;
 	data.character = c;
 	data.character = c;
 }
 }
 
 
 Variant::Variant(void *userdata)
 Variant::Variant(void *userdata)
+	: type(LUSERDATA)
 {
 {
-	type = LUSERDATA;
 	data.userdata = userdata;
 	data.userdata = userdata;
 }
 }
 
 
 Variant::Variant(love::Type udatatype, void *userdata)
 Variant::Variant(love::Type udatatype, void *userdata)
+	: type(FUSERDATA)
+	, udatatype(udatatype)
 {
 {
-	type = FUSERDATA;
-	this->udatatype = udatatype;
 	if (udatatype != INVALID_ID)
 	if (udatatype != INVALID_ID)
 	{
 	{
 		Proxy *p = (Proxy *) userdata;
 		Proxy *p = (Proxy *) userdata;
@@ -91,6 +109,13 @@ Variant::Variant(love::Type udatatype, void *userdata)
 		data.userdata = userdata;
 		data.userdata = userdata;
 }
 }
 
 
+// Variant gets ownership of the vector.
+Variant::Variant(std::vector<std::pair<Variant*, Variant*> > *table)
+	: type(TABLE)
+{
+	data.table = table;
+}
+
 Variant::~Variant()
 Variant::~Variant()
 {
 {
 	switch (type)
 	switch (type)
@@ -101,16 +126,21 @@ Variant::~Variant()
 	case FUSERDATA:
 	case FUSERDATA:
 		((love::Object *) data.userdata)->release();
 		((love::Object *) data.userdata)->release();
 		break;
 		break;
+	case TABLE:
+		delete_table(data.table);
 	default:
 	default:
 		break;
 		break;
 	}
 	}
 }
 }
 
 
-Variant *Variant::fromLua(lua_State *L, int n)
+Variant *Variant::fromLua(lua_State *L, int n, bool allowTables)
 {
 {
 	Variant *v = NULL;
 	Variant *v = NULL;
 	size_t len;
 	size_t len;
 	const char *str;
 	const char *str;
+	if (n < 0) // Fix the stack position, we might modify it later
+		n += lua_gettop(L) + 1;
+
 	switch (lua_type(L, n))
 	switch (lua_type(L, n))
 	{
 	{
 	case LUA_TBOOLEAN:
 	case LUA_TBOOLEAN:
@@ -129,6 +159,45 @@ Variant *Variant::fromLua(lua_State *L, int n)
 	case LUA_TUSERDATA:
 	case LUA_TUSERDATA:
 		v = new Variant(extractudatatype(L, n), lua_touserdata(L, n));
 		v = new Variant(extractudatatype(L, n), lua_touserdata(L, n));
 		break;
 		break;
+	case LUA_TNIL:
+		v = new Variant();
+		break;
+	case LUA_TTABLE:
+		if (allowTables)
+		{
+			bool success = true;
+			std::vector<std::pair<Variant*, Variant*> > *table = new std::vector<std::pair<Variant*, Variant*> >();
+			lua_pushnil(L);
+			while (lua_next(L, n))
+			{
+				Variant *key = fromLua(L, -2, false);
+				if (!key)
+				{
+					success = false;
+					lua_pop(L, 2);
+					break;
+				}
+
+				Variant *value = fromLua(L, -1, false);
+				if (!value)
+				{
+					delete key;
+					success = false;
+					lua_pop(L, 2);
+					break;
+				}
+
+				table->push_back(std::make_pair(key, value));
+
+				lua_pop(L, 1);
+			}
+
+			if (success)
+				v = new Variant(table);
+			else
+				delete_table(table);
+		}
+		break;
 	}
 	}
 	return v;
 	return v;
 }
 }
@@ -158,7 +227,7 @@ void Variant::toLua(lua_State *L)
 			const char *name = NULL;
 			const char *name = NULL;
 			love::types.find(udatatype, name);
 			love::types.find(udatatype, name);
 			((love::Object *) data.userdata)->retain();
 			((love::Object *) data.userdata)->retain();
-			luax_newtype(L, name, flags, data.userdata);
+			luax_pushtype(L, name, flags, (love::Object *) data.userdata);
 		}
 		}
 		else
 		else
 			lua_pushlightuserdata(L, data.userdata);
 			lua_pushlightuserdata(L, data.userdata);
@@ -166,6 +235,17 @@ void Variant::toLua(lua_State *L)
 		// sadly, however, it's the most
 		// sadly, however, it's the most
 		// I can do (at the moment).
 		// I can do (at the moment).
 		break;
 		break;
+	case TABLE:
+		lua_newtable(L);
+		for (size_t i = 0; i < data.table->size(); ++i)
+		{
+			std::pair<Variant*, Variant*> &kv = data.table->at(i);
+			kv.first->toLua(L);
+			kv.second->toLua(L);
+			lua_settable(L, -3);
+		}
+		break;
+	case NIL:
 	default:
 	default:
 		lua_pushnil(L);
 		lua_pushnil(L);
 		break;
 		break;

+ 10 - 3
src/common/Variant.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -25,6 +25,8 @@
 #include "common/Object.h"
 #include "common/Object.h"
 
 
 #include <cstring>
 #include <cstring>
+#include <vector>
+#include <utility>
 
 
 namespace love
 namespace love
 {
 {
@@ -33,15 +35,17 @@ class Variant : public love::Object
 {
 {
 public:
 public:
 
 
+	Variant();
 	Variant(bool boolean);
 	Variant(bool boolean);
 	Variant(double number);
 	Variant(double number);
 	Variant(const char *string, size_t len);
 	Variant(const char *string, size_t len);
 	Variant(char c);
 	Variant(char c);
 	Variant(void *userdata);
 	Variant(void *userdata);
 	Variant(love::Type udatatype, void *userdata);
 	Variant(love::Type udatatype, void *userdata);
+	Variant(std::vector<std::pair<Variant*, Variant*> > *table);
 	virtual ~Variant();
 	virtual ~Variant();
 
 
-	static Variant *fromLua(lua_State *L, int n);
+	static Variant *fromLua(lua_State *L, int n, bool allowTables = true);
 	void toLua(lua_State *L);
 	void toLua(lua_State *L);
 
 
 private:
 private:
@@ -53,7 +57,9 @@ private:
 		CHARACTER,
 		CHARACTER,
 		STRING,
 		STRING,
 		LUSERDATA,
 		LUSERDATA,
-		FUSERDATA
+		FUSERDATA,
+		NIL,
+		TABLE
 	} type;
 	} type;
 	union
 	union
 	{
 	{
@@ -66,6 +72,7 @@ private:
 			size_t len;
 			size_t len;
 		} string;
 		} string;
 		void *userdata;
 		void *userdata;
+		std::vector<std::pair<Variant*, Variant*> > *table;
 	} data;
 	} data;
 	love::Type udatatype;
 	love::Type udatatype;
 	bits flags;
 	bits flags;

+ 1 - 1
src/common/Vector.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 27 - 13
src/common/Vector.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -59,24 +59,33 @@ public:
 	 * Gets the length of the Vector.
 	 * Gets the length of the Vector.
 	 * @return The length of the Vector.
 	 * @return The length of the Vector.
 	 *
 	 *
-	 * This method requires sqrt() and should be used
+	 * This method requires sqrtf() and should be used
 	 * carefully.
 	 * carefully.
 	 **/
 	 **/
 	float getLength() const;
 	float getLength() const;
 
 
 	/**
 	/**
 	 * Normalizes the Vector.
 	 * Normalizes the Vector.
+	 * @param length Desired length of the vector.
 	 * @return The old length of the Vector.
 	 * @return The old length of the Vector.
 	 **/
 	 **/
-	float normalize();
+	float normalize(float length = 1.0);
 
 
 	/**
 	/**
-	 * Gets a normal to the Vector.
+	 * Gets a vector perpendicular to the Vector.
+	 * To get the true (normalized) normal, use v.getNormal(1.0f / v.getLength())
 	 * @return A normal to the Vector.
 	 * @return A normal to the Vector.
 	 **/
 	 **/
-
 	Vector getNormal() const;
 	Vector getNormal() const;
 
 
+	/**
+	 * Gets a vector perpendicular to the Vector.
+	 * To get the true (normalized) normal, use v.getNormal(1.0f / v.getLength())
+	 * @param scale factor to apply.
+	 * @return A normal to the Vector.
+	 **/
+	Vector getNormal(float scale) const;
+
 	/**
 	/**
 	 * Adds a Vector to this Vector.
 	 * Adds a Vector to this Vector.
 	 * @param v The Vector we want to add to this Vector.
 	 * @param v The Vector we want to add to this Vector.
@@ -164,13 +173,13 @@ public:
 
 
 	/**
 	/**
 	 * Sets the x value of the Vector.
 	 * Sets the x value of the Vector.
-	 * @param The x value of the Vector.
+	 * @param x The x value of the Vector.
 	 **/
 	 **/
 	void setX(float x);
 	void setX(float x);
 
 
 	/**
 	/**
 	 * Sets the x value of the Vector.
 	 * Sets the x value of the Vector.
-	 * @param The x value of the Vector.
+	 * @param y The x value of the Vector.
 	 **/
 	 **/
 	void setY(float y);
 	void setY(float y);
 
 
@@ -178,7 +187,7 @@ public:
 
 
 inline float Vector::getLength() const
 inline float Vector::getLength() const
 {
 {
-	return sqrt(x*x + y*y);
+	return sqrtf(x*x + y*y);
 }
 }
 
 
 inline Vector Vector::getNormal() const
 inline Vector Vector::getNormal() const
@@ -186,15 +195,20 @@ inline Vector Vector::getNormal() const
 	return Vector(-y, x);
 	return Vector(-y, x);
 }
 }
 
 
-inline float Vector::normalize()
+inline Vector Vector::getNormal(float scale) const
+{
+	return Vector(-y * scale, x * scale);
+}
+
+inline float Vector::normalize(float length)
 {
 {
 
 
-	float len = getLength();
+	float length_current = getLength();
 
 
-	if (len > 0)
-		(*this) /= len;
+	if (length_current > 0)
+		(*this) *= length / length_current;
 
 
-	return len;
+	return length_current;
 }
 }
 
 
 /**
 /**

+ 3 - 3
src/common/b64.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -25,7 +25,7 @@ namespace love
 
 
 static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
 static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq";
 
 
-void b64_decode_block(char in[4], char out[3])
+static void b64_decode_block(char in[4], char out[3])
 {
 {
 	out[0] = (char)(in[0] << 2 | in[1] >> 4);
 	out[0] = (char)(in[0] << 2 | in[1] >> 4);
 	out[1] = (char)(in[1] << 4 | in[2] >> 2);
 	out[1] = (char)(in[1] << 4 | in[2] >> 2);
@@ -39,7 +39,7 @@ char *b64_decode(const char *src, int slen, int &size)
 	char *dst = new char[size];
 	char *dst = new char[size];
 	char *d = dst;
 	char *d = dst;
 
 
-	char in[4], out[3], v;
+	char in[4] = {0}, out[3], v;
 	int i, len, pos = 0;
 	int i, len, pos = 0;
 
 
 	while (pos <= slen)
 	while (pos <= slen)

+ 1 - 1
src/common/b64.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 44 - 5
src/common/config.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -30,9 +30,7 @@
 #endif
 #endif
 #if defined(__APPLE__)
 #if defined(__APPLE__)
 #	define LOVE_MACOSX 1
 #	define LOVE_MACOSX 1
-#endif
-#if defined(macintosh)
-#	define LOVE_MACOS 1
+#	include <AvailabilityMacros.h>
 #endif
 #endif
 
 
 // Endianness.
 // Endianness.
@@ -74,7 +72,7 @@
 #endif
 #endif
 
 
 #if defined(LOVE_MACOSX)
 #if defined(LOVE_MACOSX)
-#	define LOVE_LEGENDARY_LIBSTDCXX_HACK
+#	define LOVE_LEGENDARY_APP_ARGV_HACK
 #endif
 #endif
 
 
 // Autotools config.h
 // Autotools config.h
@@ -88,6 +86,47 @@
 #		undef LOVE_BIG_ENDIAN
 #		undef LOVE_BIG_ENDIAN
 #		define LOVE_LITTLE_ENDIAN 1
 #		define LOVE_LITTLE_ENDIAN 1
 #	endif
 #	endif
+#else
+#	define LOVE_ENABLE_AUDIO
+#	define LOVE_ENABLE_AUDIO_NULL
+#	define LOVE_ENABLE_AUDIO_OPENAL
+#	define LOVE_ENABLE_BOX2D
+#	define LOVE_ENABLE_DDSPARSE
+#	define LOVE_ENABLE_ENET
+#	define LOVE_ENABLE_EVENT
+#	define LOVE_ENABLE_EVENT_SDL
+#	define LOVE_ENABLE_FILESYSTEM
+#	define LOVE_ENABLE_FILESYSTEM_PHYSFS
+#	define LOVE_ENABLE_FONT
+#	define LOVE_ENABLE_FONT_FREETYPE
+#	define LOVE_ENABLE_GRAPHICS
+#	define LOVE_ENABLE_GRAPHICS_OPENGL
+#	define LOVE_ENABLE_IMAGE
+#	define LOVE_ENABLE_IMAGE_MAGPIE
+#	define LOVE_ENABLE_JOYSTICK
+#	define LOVE_ENABLE_JOYSTICK_SDL
+#	define LOVE_ENABLE_KEYBOARD
+#	define LOVE_ENABLE_KEYBOARD_SDL
+#	define LOVE_ENABLE_LOVE
+#	define LOVE_ENABLE_LUASOCKET
+#	define LOVE_ENABLE_MATH
+#	define LOVE_ENABLE_MOUSE
+#	define LOVE_ENABLE_MOUSE_SDL
+#	define LOVE_ENABLE_NOISE1234
+#	define LOVE_ENABLE_PHYSICS
+#	define LOVE_ENABLE_PHYSICS_BOX2D
+#	define LOVE_ENABLE_SOUND
+#	define LOVE_ENABLE_SOUND_LULLABY
+#	define LOVE_ENABLE_SYSTEM
+#	define LOVE_ENABLE_SYSTEM_SDL
+#	define LOVE_ENABLE_THREAD
+#	define LOVE_ENABLE_THREAD_SDL
+#	define LOVE_ENABLE_TIMER
+#	define LOVE_ENABLE_TIMER_SDL
+#	define LOVE_ENABLE_UTF8
+#	define LOVE_ENABLE_WINDOW
+#	define LOVE_ENABLE_WINDOW_SDL
+#	define LOVE_ENABLE_WUFF
 #endif
 #endif
 
 
 #endif // LOVE_CONFIG_H
 #endif // LOVE_CONFIG_H

+ 3 - 2
src/common/delay.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -19,7 +19,8 @@
  **/
  **/
 
 
 #include "delay.h"
 #include "delay.h"
-#include <SDL.h>
+
+#include <SDL_timer.h>
 
 
 namespace love
 namespace love
 {
 {

+ 2 - 2
src/common/delay.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -26,6 +26,6 @@ namespace love
 
 
 void delay(unsigned int ms);
 void delay(unsigned int ms);
 
 
-}; // namespace love
+} // namespace love
 
 
 #endif // DELAY_H_
 #endif // DELAY_H_

+ 1 - 1
src/common/int.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 0 - 33
src/common/math.cpp

@@ -1,33 +0,0 @@
-#include "math.h"
-#include <limits>
-#include <cmath>
-
-namespace
-{
-	// The Box–Muller transform generates two random numbers, one of which we
-	// cache here. A value of +infinity is used to signal the cache is invalid
-	// and that new numbers have to be generated.
-	float last_randnormal = std::numeric_limits<float>::infinity();
-}
-
-namespace love
-{
-
-float random_normal(float o)
-{
-	// number in cache?
-	if (last_randnormal != std::numeric_limits<float>::infinity())
-	{
-		float r = last_randnormal;
-		last_randnormal = std::numeric_limits<float>::infinity();
-		return r * o;
-	}
-
-	// else: generate numbers using the Box-Muller transform
-	float a = sqrt(-2.0f * log(1. - random()));
-	float b = float(LOVE_M_PI) * 2.0f * (1. - random());
-	last_randnormal = a * cos(b);
-	return a * sin(b) * o;
-}
-
-} // namespace love

+ 11 - 39
src/common/math.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -61,11 +61,19 @@
 namespace love
 namespace love
 {
 {
 
 
-struct vertex
+struct Vertex
 {
 {
-	unsigned char r, g, b, a;
 	float x, y;
 	float x, y;
 	float s, t;
 	float s, t;
+	unsigned char r, g, b, a;
+};
+
+struct Triangle
+{
+	Triangle(const Vertex &x, const Vertex &y, const Vertex &z)
+		: a(x), b(y), c(z)
+	{}
+	Vertex a, b, c;
 };
 };
 
 
 inline int next_p2(int x)
 inline int next_p2(int x)
@@ -81,42 +89,6 @@ inline float next_p2(float x)
 	return static_cast<float>(next_p2(static_cast<int>(x)));
 	return static_cast<float>(next_p2(static_cast<int>(x)));
 }
 }
 
 
-/**
- * Draws a random number from a uniform distribution.
- * @returns Uniformly distributed random number in [0:1).
- */
-inline float random()
-{
-	// to satisfy picky compilers...
-	return float(double(rand() % RAND_MAX) / double(RAND_MAX));
-}
-
-/**
- * Draws a random number from a uniform distribution.
- * @return Uniformly distributed random number in [0:max).
- */
-inline float random(float max)
-{
-	return random() * max;
-}
-
-/**
- * Draws a random number from a uniform distribution.
- * @return Uniformly distributed random number in [min:max).
- */
-inline float random(float min, float max)
-{
-	return random(max - min) + min;
-}
-
-/**
- * Draws a random number from a normal/gaussian distribution.
- * @param o Standard deviation of the distribution.
- * @returns Normal distributed random number with mean 0 and variance o^2.
- */
-float random_normal(float o = 1.);
-#define random_gaussian random_normal
-
 } // love
 } // love
 
 
 #endif // LOVE_MATH_H
 #endif // LOVE_MATH_H

+ 274 - 30
src/common/runtime.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -18,6 +18,7 @@
  * 3. This notice may not be removed or altered from any source distribution.
  * 3. This notice may not be removed or altered from any source distribution.
  **/
  **/
 
 
+#include "config.h"
 #include "runtime.h"
 #include "runtime.h"
 
 
 // LOVE
 // LOVE
@@ -27,14 +28,17 @@
 #include "StringMap.h"
 #include "StringMap.h"
 #include <thread/threads.h>
 #include <thread/threads.h>
 
 
-// STD
+// C++
+#include <algorithm>
 #include <iostream>
 #include <iostream>
+#include <cstdio>
 
 
 namespace love
 namespace love
 {
 {
 
 
 static thread::Mutex *gcmutex = 0;
 static thread::Mutex *gcmutex = 0;
 void *_gcmutex = 0;
 void *_gcmutex = 0;
+
 /**
 /**
  * Called when an object is collected. The object is released
  * Called when an object is collected. The object is released
  * once in this function, possibly deleting it.
  * once in this function, possibly deleting it.
@@ -46,13 +50,21 @@ static int w__gc(lua_State *L)
 		gcmutex = thread::newMutex();
 		gcmutex = thread::newMutex();
 		_gcmutex = (void *) gcmutex;
 		_gcmutex = (void *) gcmutex;
 	}
 	}
+
 	Proxy *p = (Proxy *)lua_touserdata(L, 1);
 	Proxy *p = (Proxy *)lua_touserdata(L, 1);
 	Object *t = (Object *)p->data;
 	Object *t = (Object *)p->data;
-	if (p->own)
-	{
-		thread::Lock lock(gcmutex);
+
+	thread::Lock lock(gcmutex);
+
+	int numretains = p->retains;
+	if (numretains >= 0)
+		numretains = std::min(numretains, t->getReferenceCount());
+
+	for (int i = numretains; i > 0; i--)
 		t->release();
 		t->release();
-	}
+
+	// Signal that this Proxy is dead.
+	p->retains = -1;
 	return 0;
 	return 0;
 }
 }
 
 
@@ -78,7 +90,7 @@ static int w__eq(lua_State *L)
 	return 1;
 	return 1;
 }
 }
 
 
-Reference *luax_refif (lua_State *L, int type)
+Reference *luax_refif(lua_State *L, int type)
 {
 {
 	Reference *r = 0;
 	Reference *r = 0;
 
 
@@ -130,11 +142,39 @@ std::string luax_checkstring(lua_State *L, int idx)
 	return std::string(str, len);
 	return std::string(str, len);
 }
 }
 
 
-void luax_pushstring(lua_State *L, std::string str)
+void luax_pushstring(lua_State *L, const std::string &str)
 {
 {
 	lua_pushlstring(L, str.data(), str.size());
 	lua_pushlstring(L, str.data(), str.size());
 }
 }
 
 
+bool luax_boolflag(lua_State *L, int table_index, const char *key, bool defaultValue)
+{
+	lua_getfield(L, table_index, key);
+
+	bool retval;
+	if (lua_isnoneornil(L, -1))
+		retval = defaultValue;
+	else
+		retval = lua_toboolean(L, -1);
+
+	lua_pop(L, 1);
+	return retval;
+}
+
+int luax_intflag(lua_State *L, int table_index, const char *key, int defaultValue)
+{
+	lua_getfield(L, table_index, key);
+
+	int retval;
+	if (!lua_isnumber(L, -1))
+		retval = defaultValue;
+	else
+		retval = (int) lua_tointeger(L, -1);
+
+	lua_pop(L, 1);
+	return retval;
+}
+
 int luax_assert_argc(lua_State *L, int min)
 int luax_assert_argc(lua_State *L, int min)
 {
 {
 	int argc = lua_gettop(L);
 	int argc = lua_gettop(L);
@@ -151,20 +191,44 @@ int luax_assert_argc(lua_State *L, int min, int max)
 	return 0;
 	return 0;
 }
 }
 
 
-int luax_assert_function(lua_State *L, int n)
+int luax_assert_function(lua_State *L, int idx)
 {
 {
-	if (!lua_isfunction(L, n))
+	if (!lua_isfunction(L, idx))
 		return luaL_error(L, "Argument must be of type \"function\".");
 		return luaL_error(L, "Argument must be of type \"function\".");
 	return 0;
 	return 0;
 }
 }
 
 
+int luax_assert_nilerror(lua_State *L, int idx)
+{
+	if (lua_isnoneornil(L, idx))
+	{
+		if (lua_isstring(L, idx + 1))
+			return luaL_error(L, lua_tostring(L, idx + 1));
+		else
+			return luaL_error(L, "assertion failed!");
+	}
+	return 0;
+}
+
+void luax_setfuncs(lua_State *L, const luaL_Reg *l)
+{
+	if (l == 0)
+		return;
+
+	for (; l->name != 0; l++)
+	{
+		lua_pushcfunction(L, l->func);
+		lua_setfield(L, -2, l->name);
+	}
+}
+
 int luax_register_module(lua_State *L, const WrappedModule &m)
 int luax_register_module(lua_State *L, const WrappedModule &m)
 {
 {
 	// Put a reference to the C++ module in Lua.
 	// Put a reference to the C++ module in Lua.
-	luax_getregistry(L, REGISTRY_MODULES);
+	luax_insistregistry(L, REGISTRY_MODULES);
 
 
 	Proxy *p = (Proxy *)lua_newuserdata(L, sizeof(Proxy));
 	Proxy *p = (Proxy *)lua_newuserdata(L, sizeof(Proxy));
-	p->own = true;
+	p->retains = 1;
 	p->data = m.module;
 	p->data = m.module;
 	p->flags = m.flags;
 	p->flags = m.flags;
 
 
@@ -185,7 +249,8 @@ int luax_register_module(lua_State *L, const WrappedModule &m)
 	lua_newtable(L);
 	lua_newtable(L);
 
 
 	// Register all the functions.
 	// Register all the functions.
-	luaL_register(L, 0, m.functions);
+	if (m.functions != 0)
+		luax_setfuncs(L, m.functions);
 
 
 	// Register types.
 	// Register types.
 	if (m.types != 0)
 	if (m.types != 0)
@@ -214,6 +279,36 @@ int luax_preload(lua_State *L, lua_CFunction f, const char *name)
 
 
 int luax_register_type(lua_State *L, const char *tname, const luaL_Reg *f)
 int luax_register_type(lua_State *L, const char *tname, const luaL_Reg *f)
 {
 {
+	// Verify that this type name has a matching Type ID and type name mapping.
+	love::Type ltype;
+	if (!love::getType(tname, ltype))
+		printf("Missing type entry for type name: %s\n", tname);
+
+	// Get the place for storing and re-using instantiated love types.
+	luax_getregistry(L, REGISTRY_TYPES);
+
+	// Create registry._lovetypes if it doesn't exist yet.
+	if (!lua_istable(L, -1))
+	{
+		lua_newtable(L);
+		lua_replace(L, -2);
+
+		// Create a metatable.
+		lua_newtable(L);
+
+		// metatable.__mode = "v". Weak userdata values.
+		lua_pushliteral(L, "v");
+		lua_setfield(L, -2, "__mode");
+
+		// setmetatable(newtable, metatable)
+		lua_setmetatable(L, -2);
+
+		// registry._lovetypes = newtable
+		lua_setfield(L, LUA_REGISTRYINDEX, "_lovetypes");
+	}
+	else
+		lua_pop(L, 1);
+
 	luaL_newmetatable(L, tname);
 	luaL_newmetatable(L, tname);
 
 
 	// m.__index = m
 	// m.__index = m
@@ -243,7 +338,7 @@ int luax_register_type(lua_State *L, const char *tname, const luaL_Reg *f)
 	lua_setfield(L, -2, "typeOf");
 	lua_setfield(L, -2, "typeOf");
 
 
 	if (f != 0)
 	if (f != 0)
-		luaL_register(L, 0, f);
+		luax_setfuncs(L, f);
 
 
 	lua_pop(L, 1); // Pops metatable.
 	lua_pop(L, 1); // Pops metatable.
 	return 0;
 	return 0;
@@ -283,6 +378,13 @@ int luax_register_searcher(lua_State *L, lua_CFunction f, int pos)
 
 
 	lua_getfield(L, -1, "loaders");
 	lua_getfield(L, -1, "loaders");
 
 
+	// Lua 5.2 renamed package.loaders to package.searchers.
+	if (lua_isnil(L, -1))
+	{
+		lua_pop(L, 1);
+		lua_getfield(L, -1, "searchers");
+	}
+
 	if (lua_isnil(L, -1))
 	if (lua_isnil(L, -1))
 		return luaL_error(L, "Can't register searcher: package.loaders table does not exist.");
 		return luaL_error(L, "Can't register searcher: package.loaders table does not exist.");
 
 
@@ -292,18 +394,74 @@ int luax_register_searcher(lua_State *L, lua_CFunction f, int pos)
 	return 0;
 	return 0;
 }
 }
 
 
-void luax_newtype(lua_State *L, const char *name, bits flags, void *data, bool own)
+void luax_rawnewtype(lua_State *L, const char *name, bits flags, love::Object *data, bool own)
 {
 {
 	Proxy *u = (Proxy *)lua_newuserdata(L, sizeof(Proxy));
 	Proxy *u = (Proxy *)lua_newuserdata(L, sizeof(Proxy));
 
 
-	u->data = data;
+	u->data = (void *) data;
 	u->flags = flags;
 	u->flags = flags;
-	u->own = own;
+	u->retains = own ? 1 : 0;
 
 
 	luaL_newmetatable(L, name);
 	luaL_newmetatable(L, name);
 	lua_setmetatable(L, -2);
 	lua_setmetatable(L, -2);
 }
 }
 
 
+void luax_pushtype(lua_State *L, const char *name, bits flags, love::Object *data, bool own)
+{
+	// Fetch the registry table of instantiated types.
+	luax_getregistry(L, REGISTRY_TYPES);
+
+	// The table might not exist - it should be insisted in luax_register_type.
+	if (!lua_istable(L, -1))
+	{
+		lua_pop(L, 1);
+		return luax_rawnewtype(L, name, flags, data, own);
+	}
+
+	// Get the value of lovetypes[data] on the stack.
+	lua_pushlightuserdata(L, (void *) data);
+	lua_gettable(L, -2);
+
+	// If the Proxy userdata isn't in the instantiated types table yet, add it.
+	if (lua_type(L, -1) != LUA_TUSERDATA)
+	{
+		lua_pop(L, 1);
+
+		luax_rawnewtype(L, name, flags, data, own);
+
+		lua_pushlightuserdata(L, (void *) data);
+		lua_pushvalue(L, -2);
+
+		// lovetypes[data] = Proxy.
+		lua_settable(L, -4);
+
+		// Remove the lovetypes table from the stack.
+		lua_remove(L, -2);
+
+		// The Proxy userdata remains at the top of the stack.
+		return;
+	}
+
+	// Remove the lovetypes table from the stack.
+	lua_remove(L, -2);
+
+	// If the object should be released on GC and we already have a stored
+	// Proxy, we should tell the Proxy that the object was retained again.
+	if (own)
+	{
+		Proxy *p = (Proxy *) lua_touserdata(L, -1);
+
+		thread::EmptyLock lock;
+		if (gcmutex)
+			lock.setLock(gcmutex);
+
+		if (p->retains >= 0)
+			++(p->retains);
+	}
+
+	// Keep the Proxy userdata on the stack.
+}
+
 bool luax_istype(lua_State *L, int idx, love::bits type)
 bool luax_istype(lua_State *L, int idx, love::bits type)
 {
 {
 	if (lua_isuserdata(L, idx) == 0)
 	if (lua_isuserdata(L, idx) == 0)
@@ -331,7 +489,9 @@ int luax_convobj(lua_State *L, int idx, const char *mod, const char *fn)
 	// Convert string to a file.
 	// Convert string to a file.
 	luax_getfunction(L, mod, fn);
 	luax_getfunction(L, mod, fn);
 	lua_pushvalue(L, idx); // The initial argument.
 	lua_pushvalue(L, idx); // The initial argument.
-	lua_call(L, 1, 1); // Call the function, one arg, one return value.
+	lua_call(L, 1, 2); // Call the function, one arg, one return value (plus optional errstring.)
+	luax_assert_nilerror(L, -2); // Make sure the function returned something.
+	lua_pop(L, 1); // Pop the second return value now that we don't need it.
 	lua_replace(L, idx); // Replace the initial argument with the new object.
 	lua_replace(L, idx); // Replace the initial argument with the new object.
 	return 0;
 	return 0;
 }
 }
@@ -343,7 +503,9 @@ int luax_convobj(lua_State *L, int idxs[], int n, const char *mod, const char *f
 	{
 	{
 		lua_pushvalue(L, idxs[i]); // The arguments.
 		lua_pushvalue(L, idxs[i]); // The arguments.
 	}
 	}
-	lua_call(L, n, 1); // Call the function, n args, one return value.
+	lua_call(L, n, 2); // Call the function, n args, one return value (plus optional errstring.)
+	luax_assert_nilerror(L, -2); // Make sure the function returned something.
+	lua_pop(L, 1); // Pop the second return value now that we don't need it.
 	lua_replace(L, idxs[0]); // Replace the initial argument with the new object.
 	lua_replace(L, idxs[0]); // Replace the initial argument with the new object.
 	return 0;
 	return 0;
 }
 }
@@ -372,16 +534,6 @@ int luax_pconvobj(lua_State *L, int idxs[], int n, const char *mod, const char *
 	return ret;
 	return ret;
 }
 }
 
 
-int luax_strtofile(lua_State *L, int idx)
-{
-	return luax_convobj(L, idx, "filesystem", "newFile");
-}
-
-int luax_filetodata(lua_State *L, int idx)
-{
-	return luax_convobj(L, idx, "filesystem", "read");
-}
-
 int luax_insist(lua_State *L, int idx, const char *k)
 int luax_insist(lua_State *L, int idx, const char *k)
 {
 {
 	// Convert to absolute index if necessary.
 	// Convert to absolute index if necessary.
@@ -429,7 +581,20 @@ int luax_insistlove(lua_State *L, const char *k)
 	return 1;
 	return 1;
 }
 }
 
 
-int luax_getregistry(lua_State *L, Registry r)
+int luax_getlove(lua_State *L, const char *k)
+{
+	lua_getglobal(L, "love");
+
+	if (!lua_isnil(L, -1))
+	{
+		lua_getfield(L, -1, k);
+		lua_replace(L, -2);
+	}
+
+	return 1;
+}
+
+int luax_insistregistry(lua_State *L, Registry r)
 {
 {
 	switch (r)
 	switch (r)
 	{
 	{
@@ -437,11 +602,57 @@ int luax_getregistry(lua_State *L, Registry r)
 		return luax_insistlove(L, "_gc");
 		return luax_insistlove(L, "_gc");
 	case REGISTRY_MODULES:
 	case REGISTRY_MODULES:
 		return luax_insistlove(L, "_modules");
 		return luax_insistlove(L, "_modules");
+	case REGISTRY_TYPES:
+		return luax_insist(L, LUA_REGISTRYINDEX, "_lovetypes");
 	default:
 	default:
 		return luaL_error(L, "Attempted to use invalid registry.");
 		return luaL_error(L, "Attempted to use invalid registry.");
 	}
 	}
 }
 }
 
 
+int luax_getregistry(lua_State *L, Registry r)
+{
+	switch (r)
+	{
+	case REGISTRY_GC:
+		return luax_getlove(L, "_gc");
+	case REGISTRY_MODULES:
+		return luax_getlove(L, "_modules");
+	case REGISTRY_TYPES:
+		lua_getfield(L, LUA_REGISTRYINDEX, "_lovetypes");
+		return 1;
+	default:
+		return luaL_error(L, "Attempted to use invalid registry.");
+	}
+}
+
+extern "C" int luax_typerror(lua_State *L, int narg, const char *tname)
+{
+	int argtype = lua_type(L, narg);
+	const char *argtname = 0;
+
+	// We want to use the love type name for userdata, if possible.
+	if (argtype == LUA_TUSERDATA && luaL_getmetafield(L, narg, "__tostring") != 0)
+	{
+		lua_pushvalue(L, narg);
+		if (lua_pcall(L, 1, 1, 0) == 0 && lua_type(L, -1) == LUA_TSTRING)
+		{
+			argtname = lua_tostring(L, -1);
+
+			// Non-love userdata might have a tostring metamethod which doesn't
+			// describe its type, so we only use __tostring for love types.
+			love::Type t;
+			if (!love::getType(argtname, t))
+				argtname = 0;
+		}
+	}
+
+	if (argtname == 0)
+		argtname = lua_typename(L, argtype);
+
+	const char *msg = lua_pushfstring(L, "%s expected, got %s", tname, argtname);
+	return luaL_argerror(L, narg, msg);
+}
+
 StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
 StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
 {
 {
 	{"Invalid", INVALID_ID},
 	{"Invalid", INVALID_ID},
@@ -460,15 +671,26 @@ StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
 
 
 	// Graphics
 	// Graphics
 	{"Drawable", GRAPHICS_DRAWABLE_ID},
 	{"Drawable", GRAPHICS_DRAWABLE_ID},
+	{"Texture", GRAPHICS_TEXTURE_ID},
 	{"Image", GRAPHICS_IMAGE_ID},
 	{"Image", GRAPHICS_IMAGE_ID},
 	{"Quad", GRAPHICS_QUAD_ID},
 	{"Quad", GRAPHICS_QUAD_ID},
 	{"Font", GRAPHICS_FONT_ID},
 	{"Font", GRAPHICS_FONT_ID},
 	{"ParticleSystem", GRAPHICS_PARTICLE_SYSTEM_ID},
 	{"ParticleSystem", GRAPHICS_PARTICLE_SYSTEM_ID},
 	{"SpriteBatch", GRAPHICS_SPRITE_BATCH_ID},
 	{"SpriteBatch", GRAPHICS_SPRITE_BATCH_ID},
 	{"Canvas", GRAPHICS_CANVAS_ID},
 	{"Canvas", GRAPHICS_CANVAS_ID},
+	{"Shader", GRAPHICS_SHADER_ID},
+	{"Mesh", GRAPHICS_MESH_ID},
 
 
 	// Image
 	// Image
 	{"ImageData", IMAGE_IMAGE_DATA_ID},
 	{"ImageData", IMAGE_IMAGE_DATA_ID},
+	{"CompressedData", IMAGE_COMPRESSED_DATA_ID},
+
+	// Joystick
+	{"Joystick", JOYSTICK_JOYSTICK_ID},
+
+	// Math
+	{"RandomGenerator", MATH_RANDOM_GENERATOR_ID},
+	{"BezierCurve", MATH_BEZIER_CURVE_ID},
 
 
 	// Audio
 	// Audio
 	{"Source", AUDIO_SOURCE_ID},
 	{"Source", AUDIO_SOURCE_ID},
@@ -477,13 +699,19 @@ StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
 	{"SoundData", SOUND_SOUND_DATA_ID},
 	{"SoundData", SOUND_SOUND_DATA_ID},
 	{"Decoder", SOUND_DECODER_ID},
 	{"Decoder", SOUND_DECODER_ID},
 
 
+	// Mouse
+	{"Cursor", MOUSE_CURSOR_ID},
+
 	// Physics
 	// Physics
 	{"World", PHYSICS_WORLD_ID},
 	{"World", PHYSICS_WORLD_ID},
 	{"Contact", PHYSICS_CONTACT_ID},
 	{"Contact", PHYSICS_CONTACT_ID},
 	{"Body", PHYSICS_BODY_ID},
 	{"Body", PHYSICS_BODY_ID},
+	{"Fixture", PHYSICS_FIXTURE_ID},
 	{"Shape", PHYSICS_SHAPE_ID},
 	{"Shape", PHYSICS_SHAPE_ID},
 	{"CircleShape", PHYSICS_CIRCLE_SHAPE_ID},
 	{"CircleShape", PHYSICS_CIRCLE_SHAPE_ID},
 	{"PolygonShape", PHYSICS_POLYGON_SHAPE_ID},
 	{"PolygonShape", PHYSICS_POLYGON_SHAPE_ID},
+	{"EdgeShape", PHYSICS_EDGE_SHAPE_ID},
+	{"ChainShape", PHYSICS_CHAIN_SHAPE_ID},
 	{"Joint", PHYSICS_JOINT_ID},
 	{"Joint", PHYSICS_JOINT_ID},
 	{"MouseJoint", PHYSICS_MOUSE_JOINT_ID},
 	{"MouseJoint", PHYSICS_MOUSE_JOINT_ID},
 	{"DistanceJoint", PHYSICS_DISTANCE_JOINT_ID},
 	{"DistanceJoint", PHYSICS_DISTANCE_JOINT_ID},
@@ -491,6 +719,11 @@ StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
 	{"RevoluteJoint", PHYSICS_REVOLUTE_JOINT_ID},
 	{"RevoluteJoint", PHYSICS_REVOLUTE_JOINT_ID},
 	{"PulleyJoint", PHYSICS_PULLEY_JOINT_ID},
 	{"PulleyJoint", PHYSICS_PULLEY_JOINT_ID},
 	{"GearJoint", PHYSICS_GEAR_JOINT_ID},
 	{"GearJoint", PHYSICS_GEAR_JOINT_ID},
+	{"FrictionJoint", PHYSICS_FRICTION_JOINT_ID},
+	{"WeldJoint", PHYSICS_WELD_JOINT_ID},
+	{"RopeJoint", PHYSICS_ROPE_JOINT_ID},
+	{"WheelJoint", PHYSICS_WHEEL_JOINT_ID},
+	{"MotorJoint", PHYSICS_MOTOR_JOINT_ID},
 
 
 	// Thread
 	// Thread
 	{"Thread", THREAD_THREAD_ID},
 	{"Thread", THREAD_THREAD_ID},
@@ -498,12 +731,23 @@ StringMap<Type, TYPE_MAX_ENUM>::Entry typeEntries[] =
 
 
 	// The modules themselves. Only add abstracted modules here.
 	// The modules themselves. Only add abstracted modules here.
 	{"filesystem", MODULE_FILESYSTEM_ID},
 	{"filesystem", MODULE_FILESYSTEM_ID},
+	{"graphics", MODULE_GRAPHICS_ID},
 	{"image", MODULE_IMAGE_ID},
 	{"image", MODULE_IMAGE_ID},
 	{"sound", MODULE_SOUND_ID},
 	{"sound", MODULE_SOUND_ID},
 };
 };
 
 
 StringMap<Type, TYPE_MAX_ENUM> types(typeEntries, sizeof(typeEntries));
 StringMap<Type, TYPE_MAX_ENUM> types(typeEntries, sizeof(typeEntries));
 
 
+bool getType(const char *in, love::Type &out)
+{
+	return types.find(in, out);
+}
+
+bool getType(love::Type in, const char *&out)
+{
+	return types.find(in, out);
+}
+
 Type luax_type(lua_State *L, int idx)
 Type luax_type(lua_State *L, int idx)
 {
 {
 	Type t = INVALID_ID;
 	Type t = INVALID_ID;

+ 150 - 53
src/common/runtime.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -23,9 +23,11 @@
 
 
 // LOVE
 // LOVE
 #include "types.h"
 #include "types.h"
+#include "Object.h"
 
 
 // Lua
 // Lua
 extern "C" {
 extern "C" {
+	#define LUA_COMPAT_ALL
 	#include <lua.h>
 	#include <lua.h>
 	#include <lualib.h>
 	#include <lualib.h>
 	#include <lauxlib.h>
 	#include <lauxlib.h>
@@ -40,16 +42,16 @@ class Reference;
 
 
 // Exposed mutex of the GC
 // Exposed mutex of the GC
 extern void *_gcmutex;
 extern void *_gcmutex;
-extern unsigned int _gcthread;
 
 
 /**
 /**
  * Registries represent special tables which can be accessed with
  * Registries represent special tables which can be accessed with
- * luax_getregistry.
+ * luax_insistregistry and luax_getregistry.
  **/
  **/
 enum Registry
 enum Registry
 {
 {
 	REGISTRY_GC = 1,
 	REGISTRY_GC = 1,
 	REGISTRY_MODULES,
 	REGISTRY_MODULES,
+	REGISTRY_TYPES
 };
 };
 
 
 /**
 /**
@@ -63,11 +65,11 @@ struct Proxy
 	// Holds type information (see types.h).
 	// Holds type information (see types.h).
 	bits flags;
 	bits flags;
 
 
-	// The light userdata.
+	// The light userdata (pointer to the love::Object).
 	void *data;
 	void *data;
 
 
-	// True if Lua should delete on GC.
-	bool own;
+	// The number of times release() should be called on GC.
+	int retains;
 };
 };
 
 
 /**
 /**
@@ -98,7 +100,7 @@ struct WrappedModule
  *
  *
  * In any case, the top stack element is popped, regardless of its type.
  * In any case, the top stack element is popped, regardless of its type.
  **/
  **/
-Reference *luax_refif (lua_State *L, int type);
+Reference *luax_refif(lua_State *L, int type);
 
 
 /**
 /**
  * Prints the current contents of the stack. Only useful for debugging.
  * Prints the current contents of the stack. Only useful for debugging.
@@ -156,7 +158,33 @@ std::string luax_checkstring(lua_State *L, int idx);
  * @param L The Lua state.
  * @param L The Lua state.
  * @param str The string to push.
  * @param str The string to push.
  **/
  **/
-void luax_pushstring(lua_State *L, std::string str);
+void luax_pushstring(lua_State *L, const std::string &str);
+
+
+bool luax_boolflag(lua_State *L, int table_index, const char *key, bool defaultValue);
+int luax_intflag(lua_State *L, int table_index, const char *key, int defaultValue);
+
+/**
+ * Convert the value at the specified index to an Lua number, and then
+ * convert to a float.
+ *
+ * @param L The Lua state.
+ * @param idx The index on the stack.
+ */
+inline float luax_tofloat(lua_State *L, int idx)
+{
+	return static_cast<float>(lua_tonumber(L, idx));
+}
+
+/**
+ * Like luax_tofloat, but checks that the value is a number.
+ *
+ * @see luax_tofloat
+ */
+inline float luax_checkfloat(lua_State *L, int idx)
+{
+	return static_cast<float>(luaL_checknumber(L, idx));
+}
 
 
 /**
 /**
  * Require at least 'min' number of items on the stack.
  * Require at least 'min' number of items on the stack.
@@ -182,6 +210,22 @@ int luax_assert_argc(lua_State *L, int min, int max);
  **/
  **/
 int luax_assert_function(lua_State *L, int idx);
 int luax_assert_function(lua_State *L, int idx);
 
 
+/**
+ * Require that the value at idx is not nil. If it is, the function throws an
+ * error using an optional error string at idx+1.
+ * @param L The Lua state.
+ * @param idx The index on the stack.
+ **/
+int luax_assert_nilerror(lua_State *L, int idx);
+
+/**
+ * Registers all functions in the array l (see luaL_Reg) into the table at the
+ * top of the stack.
+ * Similar to Lua 5.2's luaL_setfuncs without the upvalues, and to Lua 5.1's
+ * luaL_register without the library name.
+ **/
+void luax_setfuncs(lua_State *L, const luaL_Reg *l);
+
 /**
 /**
  * Register a module in the love table. The love table will be created if it does not exist.
  * Register a module in the love table. The love table will be created if it does not exist.
  * @param L The Lua state.
  * @param L The Lua state.
@@ -222,14 +266,29 @@ int luax_table_insert(lua_State *L, int tindex, int vindex, int pos = -1);
 int luax_register_searcher(lua_State *L, lua_CFunction f, int pos = -1);
 int luax_register_searcher(lua_State *L, lua_CFunction f, int pos = -1);
 
 
 /**
 /**
- * Creates a new Lua-accessible object of the given type, and put it on the stack.
+ * Pushes a Lua representation of the given object onto the stack, creating and
+ * storing the Lua representation in a weak table if it doesn't exist yet.
+ * @param L The Lua state.
+ * @param name The name of the type. This must match the name used with luax_register_type.
+ * @param flags The type information of the object.
+ * @param data The pointer to the actual object.
+ * @param own Set this to true (default) if the object should be released upon garbage collection.
+ **/
+void luax_pushtype(lua_State *L, const char *name, bits flags, love::Object *data, bool own = true);
+
+/**
+ * Creates a new Lua representation of the given object *without* checking if it
+ * exists yet, and *without* storing it in a weak table.
+ * This should only be used when performance is an extreme concern and the
+ * object is not ever expected to be pushed to Lua again, as it prevents the
+ * Lua-side objects from working in all cases when used as keys in tables.
  * @param L The Lua state.
  * @param L The Lua state.
- * @param name The name of the type. This must match the used earlier with luax_register_type.
- * @param flags The type information.
+ * @param name The name of the type. This must match the name used with luax_register_type.
+ * @param flags The type information of the object.
  * @param data The pointer to the actual object.
  * @param data The pointer to the actual object.
- * @own Set this to true (default) if the object should be released upon garbage collection.
+ * @param own Set this to true (default) if the object should be released upon garbage collection.
  **/
  **/
-void luax_newtype(lua_State *L, const char *name, bits flags, void *data, bool own = true);
+void luax_rawnewtype(lua_State *L, const char *name, bits flags, love::Object *data, bool own = true);
 
 
 /**
 /**
  * Checks whether the value at idx is a certain type.
  * Checks whether the value at idx is a certain type.
@@ -305,50 +364,30 @@ int luax_insistglobal(lua_State *L, const char *k);
 int luax_insistlove(lua_State *L, const char *k);
 int luax_insistlove(lua_State *L, const char *k);
 
 
 /**
 /**
- * Gets (creates if needed) the specified Registry, and puts it on top
- * of the stack.
- * @param L The Lua state.
- * @param r The Registry to get.
+ * Pushes the table 'k' in the love table onto the stack. Pushes nil if the
+ * table doesn't exist.
+ * @param k The name of the table we want to get.
  **/
  **/
-int luax_getregistry(lua_State *L, Registry r);
-
-Type luax_type(lua_State *L, int idx);
+int luax_getlove(lua_State *L, const char *k);
 
 
 /**
 /**
- * Convert the value at the specified index to an Lua number, and then
- * convert to a float.
- *
+ * Gets (creates if needed) the specified Registry, and pushes it into the
+ * stack.
  * @param L The Lua state.
  * @param L The Lua state.
- * @param idx The index on the stack.
- */
-inline float luax_tofloat(lua_State *L, int idx)
-{
-	return static_cast<float>(lua_tonumber(L, idx));
-}
-
-/**
- * Like luax_tofloat, but checks that the value is a number.
- *
- * @see luax_tofloat
- */
-inline float luax_checkfloat(lua_State *L, int idx)
-{
-	return static_cast<float>(luaL_checknumber(L, idx));
-}
+ * @param r The Registry to get.
+ **/
+int luax_insistregistry(lua_State *L, Registry r);
 
 
 /**
 /**
- * Converts the value at idx to the specified type without checking that
- * this conversion is valid. If the type has been previously verified with
- * luax_istype, then this can be safely used. Otherwise, use luax_checktype.
+ * Gets the specified Registry, and pushes it onto the stack. Pushes nil if the
+ * registry hasn't been created (see luax_insistregistry.)
  * @param L The Lua state.
  * @param L The Lua state.
- * @param idx The index on the stack.
- * @param name The name of the type.
- * @param type The type bit.
+ * @param r The Registry to get.
  **/
  **/
-template <typename T>
-T *luax_totype(lua_State *L, int idx, const char *, love::bits)
-{
-	return (T *)(((Proxy *)lua_touserdata(L, idx))->data);
+int luax_getregistry(lua_State *L, Registry r);
+
+extern "C" { // Also called from luasocket
+	int luax_typerror(lua_State *L, int narg, const char *tname);
 }
 }
 
 
 /**
 /**
@@ -363,12 +402,12 @@ template <typename T>
 T *luax_checktype(lua_State *L, int idx, const char *name, love::bits type)
 T *luax_checktype(lua_State *L, int idx, const char *name, love::bits type)
 {
 {
 	if (lua_isuserdata(L, idx) == 0)
 	if (lua_isuserdata(L, idx) == 0)
-		luaL_error(L, "Incorrect parameter type: expected userdata.");
+		luax_typerror(L, idx, name);
 
 
 	Proxy *u = (Proxy *)lua_touserdata(L, idx);
 	Proxy *u = (Proxy *)lua_touserdata(L, idx);
 
 
 	if ((u->flags & type) != type)
 	if ((u->flags & type) != type)
-		luaL_error(L, "Incorrect parameter type: expected %s", name);
+		luax_typerror(L, idx, name);
 
 
 	return (T *)u->data;
 	return (T *)u->data;
 }
 }
@@ -376,11 +415,11 @@ T *luax_checktype(lua_State *L, int idx, const char *name, love::bits type)
 template <typename T>
 template <typename T>
 T *luax_getmodule(lua_State *L, const char *k, love::bits type)
 T *luax_getmodule(lua_State *L, const char *k, love::bits type)
 {
 {
-	luax_getregistry(L, REGISTRY_MODULES);
+	luax_insistregistry(L, REGISTRY_MODULES);
 	lua_getfield(L, -1, k);
 	lua_getfield(L, -1, k);
 
 
 	if (!lua_isuserdata(L, -1))
 	if (!lua_isuserdata(L, -1))
-		luaL_error(L, "Tried to get nonexisting module %s.", k);
+		luaL_error(L, "Tried to get nonexistant module %s.", k);
 
 
 	Proxy *u = (Proxy *)lua_touserdata(L, -1);
 	Proxy *u = (Proxy *)lua_touserdata(L, -1);
 
 
@@ -392,6 +431,64 @@ T *luax_getmodule(lua_State *L, const char *k, love::bits type)
 	return (T *)u->data;
 	return (T *)u->data;
 }
 }
 
 
+template <typename T>
+T *luax_optmodule(lua_State *L, const char *k, love::bits type)
+{
+	luax_insistregistry(L, REGISTRY_MODULES);
+	lua_getfield(L, -1, k);
+
+	if (!lua_isuserdata(L, -1))
+	{
+		lua_pop(L, 2);
+		return 0;
+	}
+
+	Proxy *u = (Proxy *)lua_touserdata(L, -1);
+
+	if ((u->flags & type) != type)
+		luaL_error(L, "Incorrect module %s", k);
+	
+	lua_pop(L, 2);
+	
+	return (T *) u->data;
+}
+
+/**
+ * Converts the value at idx to the specified type without checking that
+ * this conversion is valid. If the type has been previously verified with
+ * luax_istype, then this can be safely used. Otherwise, use luax_checktype.
+ * @param L The Lua state.
+ * @param idx The index on the stack.
+ * @param name The name of the type.
+ * @param type The type bit.
+ **/
+template <typename T>
+T *luax_totype(lua_State *L, int idx, const char * /* name */, love::bits /* type */)
+{
+	return (T *)(((Proxy *)lua_touserdata(L, idx))->data);
+}
+
+Type luax_type(lua_State *L, int idx);
+
+/**
+ * Macro for converting a LOVE exception into a Lua error.
+ * lua_error (and luaL_error) cannot be called from inside the exception handler
+ * because they use longjmp, which causes undefined behaviour when the
+ * destructor of the exception would have been called.
+ **/
+#define EXCEPT_GUARD(A) \
+{ \
+	bool should_error = false; \
+	try { A } \
+	catch (love::Exception &e) \
+	{ \
+		should_error = true; \
+		lua_pushstring(L, e.what()); \
+	} \
+	if (should_error) \
+		return luaL_error(L, "%s", lua_tostring(L, -1)); \
+}
+
 } // love
 } // love
 
 
 #endif // LOVE_RUNTIME_H
 #endif // LOVE_RUNTIME_H

+ 33 - 7
src/common/types.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -45,7 +45,7 @@ enum Type
 
 
 	// Graphics
 	// Graphics
 	GRAPHICS_DRAWABLE_ID,
 	GRAPHICS_DRAWABLE_ID,
-	GRAPHICS_DRAWQABLE_ID,
+	GRAPHICS_TEXTURE_ID,
 	GRAPHICS_IMAGE_ID,
 	GRAPHICS_IMAGE_ID,
 	GRAPHICS_QUAD_ID,
 	GRAPHICS_QUAD_ID,
 	GRAPHICS_FONT_ID,
 	GRAPHICS_FONT_ID,
@@ -53,10 +53,18 @@ enum Type
 	GRAPHICS_SPRITE_BATCH_ID,
 	GRAPHICS_SPRITE_BATCH_ID,
 	GRAPHICS_CANVAS_ID,
 	GRAPHICS_CANVAS_ID,
 	GRAPHICS_SHADER_ID,
 	GRAPHICS_SHADER_ID,
+	GRAPHICS_MESH_ID,
 
 
 	// Image
 	// Image
 	IMAGE_IMAGE_DATA_ID,
 	IMAGE_IMAGE_DATA_ID,
-	IMAGE_ENCODED_IMAGE_DATA_ID,
+	IMAGE_COMPRESSED_DATA_ID,
+
+	// Joystick
+	JOYSTICK_JOYSTICK_ID,
+
+	// Math
+	MATH_RANDOM_GENERATOR_ID,
+	MATH_BEZIER_CURVE_ID,
 
 
 	// Audio
 	// Audio
 	AUDIO_SOURCE_ID,
 	AUDIO_SOURCE_ID,
@@ -65,6 +73,9 @@ enum Type
 	SOUND_SOUND_DATA_ID,
 	SOUND_SOUND_DATA_ID,
 	SOUND_DECODER_ID,
 	SOUND_DECODER_ID,
 
 
+	// Mouse
+	MOUSE_CURSOR_ID,
+
 	// Physics
 	// Physics
 	PHYSICS_WORLD_ID,
 	PHYSICS_WORLD_ID,
 	PHYSICS_CONTACT_ID,
 	PHYSICS_CONTACT_ID,
@@ -86,6 +97,7 @@ enum Type
 	PHYSICS_WELD_JOINT_ID,
 	PHYSICS_WELD_JOINT_ID,
 	PHYSICS_ROPE_JOINT_ID,
 	PHYSICS_ROPE_JOINT_ID,
 	PHYSICS_WHEEL_JOINT_ID,
 	PHYSICS_WHEEL_JOINT_ID,
+	PHYSICS_MOTOR_JOINT_ID,
 
 
 	// Thread
 	// Thread
 	THREAD_THREAD_ID,
 	THREAD_THREAD_ID,
@@ -93,6 +105,7 @@ enum Type
 
 
 	// The modules themselves. Only add abstracted modules here.
 	// The modules themselves. Only add abstracted modules here.
 	MODULE_FILESYSTEM_ID,
 	MODULE_FILESYSTEM_ID,
+	MODULE_GRAPHICS_ID,
 	MODULE_IMAGE_ID,
 	MODULE_IMAGE_ID,
 	MODULE_SOUND_ID,
 	MODULE_SOUND_ID,
 
 
@@ -117,18 +130,26 @@ const bits FONT_RASTERIZER_T = (bits(1) << FONT_RASTERIZER_ID) | OBJECT_T;
 
 
 // Graphics.
 // Graphics.
 const bits GRAPHICS_DRAWABLE_T = (bits(1) << GRAPHICS_DRAWABLE_ID) | OBJECT_T;
 const bits GRAPHICS_DRAWABLE_T = (bits(1) << GRAPHICS_DRAWABLE_ID) | OBJECT_T;
-const bits GRAPHICS_DRAWQABLE_T = (bits(1) << GRAPHICS_DRAWQABLE_ID) | GRAPHICS_DRAWABLE_T;
-const bits GRAPHICS_IMAGE_T = (bits(1) << GRAPHICS_IMAGE_ID) | GRAPHICS_DRAWQABLE_T;
+const bits GRAPHICS_TEXTURE_T = (bits(1) << GRAPHICS_TEXTURE_ID) | GRAPHICS_DRAWABLE_T;
+const bits GRAPHICS_IMAGE_T = (bits(1) << GRAPHICS_IMAGE_ID) | GRAPHICS_TEXTURE_T;
 const bits GRAPHICS_QUAD_T = (bits(1) << GRAPHICS_QUAD_ID) | OBJECT_T;
 const bits GRAPHICS_QUAD_T = (bits(1) << GRAPHICS_QUAD_ID) | OBJECT_T;
 const bits GRAPHICS_FONT_T = (bits(1) << GRAPHICS_FONT_ID) | OBJECT_T;
 const bits GRAPHICS_FONT_T = (bits(1) << GRAPHICS_FONT_ID) | OBJECT_T;
 const bits GRAPHICS_PARTICLE_SYSTEM_T = (bits(1) << GRAPHICS_PARTICLE_SYSTEM_ID) | GRAPHICS_DRAWABLE_T;
 const bits GRAPHICS_PARTICLE_SYSTEM_T = (bits(1) << GRAPHICS_PARTICLE_SYSTEM_ID) | GRAPHICS_DRAWABLE_T;
 const bits GRAPHICS_SPRITE_BATCH_T = (bits(1) << GRAPHICS_SPRITE_BATCH_ID) | GRAPHICS_DRAWABLE_T;
 const bits GRAPHICS_SPRITE_BATCH_T = (bits(1) << GRAPHICS_SPRITE_BATCH_ID) | GRAPHICS_DRAWABLE_T;
-const bits GRAPHICS_CANVAS_T = (bits(1) << GRAPHICS_CANVAS_ID) | GRAPHICS_DRAWQABLE_T;
+const bits GRAPHICS_CANVAS_T = (bits(1) << GRAPHICS_CANVAS_ID) | GRAPHICS_TEXTURE_T;
 const bits GRAPHICS_SHADER_T = (bits(1) << GRAPHICS_SHADER_ID) | OBJECT_T;
 const bits GRAPHICS_SHADER_T = (bits(1) << GRAPHICS_SHADER_ID) | OBJECT_T;
+const bits GRAPHICS_MESH_T = (bits(1) << GRAPHICS_MESH_ID) | GRAPHICS_DRAWABLE_T;
 
 
 // Image.
 // Image.
 const bits IMAGE_IMAGE_DATA_T = (bits(1) << IMAGE_IMAGE_DATA_ID) | DATA_T;
 const bits IMAGE_IMAGE_DATA_T = (bits(1) << IMAGE_IMAGE_DATA_ID) | DATA_T;
-const bits IMAGE_ENCODED_IMAGE_DATA_T = (bits(1) << IMAGE_ENCODED_IMAGE_DATA_ID) | DATA_T;
+const bits IMAGE_COMPRESSED_DATA_T = (bits(1) << IMAGE_COMPRESSED_DATA_ID) | DATA_T;
+
+// Joystick.
+const bits JOYSTICK_JOYSTICK_T = (bits(1) << JOYSTICK_JOYSTICK_ID) | OBJECT_T;
+
+// Math.
+const bits MATH_RANDOM_GENERATOR_T = (bits(1) << MATH_RANDOM_GENERATOR_ID) | OBJECT_T;
+const bits MATH_BEZIER_CURVE_T = (bits(1) << MATH_BEZIER_CURVE_ID) | OBJECT_T;
 
 
 // Audio.
 // Audio.
 const bits AUDIO_SOURCE_T = (bits(1) << AUDIO_SOURCE_ID) | OBJECT_T;
 const bits AUDIO_SOURCE_T = (bits(1) << AUDIO_SOURCE_ID) | OBJECT_T;
@@ -137,6 +158,9 @@ const bits AUDIO_SOURCE_T = (bits(1) << AUDIO_SOURCE_ID) | OBJECT_T;
 const bits SOUND_SOUND_DATA_T = (bits(1) << SOUND_SOUND_DATA_ID) | DATA_T;
 const bits SOUND_SOUND_DATA_T = (bits(1) << SOUND_SOUND_DATA_ID) | DATA_T;
 const bits SOUND_DECODER_T = bits(1) << SOUND_DECODER_ID;
 const bits SOUND_DECODER_T = bits(1) << SOUND_DECODER_ID;
 
 
+// Mouse.
+const bits MOUSE_CURSOR_T = (bits(1) << MOUSE_CURSOR_ID) | OBJECT_T;
+
 // Physics.
 // Physics.
 const bits PHYSICS_WORLD_T = (bits(1) << PHYSICS_WORLD_ID) | OBJECT_T;
 const bits PHYSICS_WORLD_T = (bits(1) << PHYSICS_WORLD_ID) | OBJECT_T;
 const bits PHYSICS_CONTACT_T = (bits(1) << PHYSICS_CONTACT_ID) | OBJECT_T;
 const bits PHYSICS_CONTACT_T = (bits(1) << PHYSICS_CONTACT_ID) | OBJECT_T;
@@ -158,6 +182,7 @@ const bits PHYSICS_FRICTION_JOINT_T = (bits(1) << PHYSICS_FRICTION_JOINT_ID) | P
 const bits PHYSICS_WELD_JOINT_T = (bits(1) << PHYSICS_WELD_JOINT_ID) | PHYSICS_JOINT_T;
 const bits PHYSICS_WELD_JOINT_T = (bits(1) << PHYSICS_WELD_JOINT_ID) | PHYSICS_JOINT_T;
 const bits PHYSICS_ROPE_JOINT_T = (bits(1) << PHYSICS_ROPE_JOINT_ID) | PHYSICS_JOINT_T;
 const bits PHYSICS_ROPE_JOINT_T = (bits(1) << PHYSICS_ROPE_JOINT_ID) | PHYSICS_JOINT_T;
 const bits PHYSICS_WHEEL_JOINT_T = (bits(1) << PHYSICS_WHEEL_JOINT_ID) | PHYSICS_JOINT_T;
 const bits PHYSICS_WHEEL_JOINT_T = (bits(1) << PHYSICS_WHEEL_JOINT_ID) | PHYSICS_JOINT_T;
+const bits PHYSICS_MOTOR_JOINT_T = (bits(1) << PHYSICS_MOTOR_JOINT_ID) | PHYSICS_JOINT_T;
 
 
 // Thread.
 // Thread.
 const bits THREAD_THREAD_T = (bits(1) << THREAD_THREAD_ID) | OBJECT_T;
 const bits THREAD_THREAD_T = (bits(1) << THREAD_THREAD_ID) | OBJECT_T;
@@ -165,6 +190,7 @@ const bits THREAD_CHANNEL_T = (bits(1) << THREAD_CHANNEL_ID) | OBJECT_T;
 
 
 // Modules.
 // Modules.
 const bits MODULE_FILESYSTEM_T = (bits(1) << MODULE_FILESYSTEM_ID) | MODULE_T;
 const bits MODULE_FILESYSTEM_T = (bits(1) << MODULE_FILESYSTEM_ID) | MODULE_T;
+const bits MODULE_GRAPHICS_T = (bits(1) << MODULE_GRAPHICS_ID) | MODULE_T;
 const bits MODULE_IMAGE_T = (bits(1) << MODULE_IMAGE_ID) | MODULE_T;
 const bits MODULE_IMAGE_T = (bits(1) << MODULE_IMAGE_ID) | MODULE_T;
 const bits MODULE_SOUND_T = (bits(1) << MODULE_SOUND_ID) | MODULE_T;
 const bits MODULE_SOUND_T = (bits(1) << MODULE_SOUND_ID) | MODULE_T;
 
 

+ 1 - 1
src/common/utf8.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 1 - 1
src/common/utf8.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages

+ 4 - 4
src/common/version.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -26,11 +26,11 @@ namespace love
 
 
 // Version stuff.
 // Version stuff.
 const int VERSION_MAJOR = 0;
 const int VERSION_MAJOR = 0;
-const int VERSION_MINOR = 8;
+const int VERSION_MINOR = 9;
 const int VERSION_REV = 0;
 const int VERSION_REV = 0;
-const char *VERSION = "0.8.0";
+const char *VERSION = "0.9.0";
 const char *VERSION_COMPATIBILITY[] =  { VERSION, 0 };
 const char *VERSION_COMPATIBILITY[] =  { VERSION, 0 };
-const char *VERSION_CODENAME = "Rubber Piggy";
+const char *VERSION_CODENAME = "Baby Inspector";
 
 
 } // love
 } // love
 
 

+ 10 - 2
src/common/wrap_Data.cpp

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -28,6 +28,13 @@ Data *luax_checkdata(lua_State *L, int idx)
 	return luax_checktype<Data>(L, idx, "Data", DATA_T);
 	return luax_checktype<Data>(L, idx, "Data", DATA_T);
 }
 }
 
 
+int w_Data_getString(lua_State *L)
+{
+	Data *t = luax_checkdata(L, 1);
+	lua_pushlstring(L, (const char *) t->getData(), (size_t) t->getSize());
+	return 1;
+}
+
 int w_Data_getPointer(lua_State *L)
 int w_Data_getPointer(lua_State *L)
 {
 {
 	Data *t = luax_checkdata(L, 1);
 	Data *t = luax_checkdata(L, 1);
@@ -44,7 +51,8 @@ int w_Data_getSize(lua_State *L)
 
 
 const luaL_Reg w_Data_functions[] =
 const luaL_Reg w_Data_functions[] =
 {
 {
-//	{ "getPointer", w_Data_getPointer },
+	{ "getString", w_Data_getString },
+	{ "getPointer", w_Data_getPointer },
 	{ "getSize", w_Data_getSize },
 	{ "getSize", w_Data_getSize },
 	{ 0, 0 }
 	{ 0, 0 }
 };
 };

+ 2 - 1
src/common/wrap_Data.h

@@ -1,5 +1,5 @@
 /**
 /**
- * Copyright (c) 2006-2013 LOVE Development Team
+ * Copyright (c) 2006-2014 LOVE Development Team
  *
  *
  * This software is provided 'as-is', without any express or implied
  * This software is provided 'as-is', without any express or implied
  * warranty.  In no event will the authors be held liable for any damages
  * warranty.  In no event will the authors be held liable for any damages
@@ -29,6 +29,7 @@ namespace love
 {
 {
 
 
 Data *luax_checkdata(lua_State *L, int idx);
 Data *luax_checkdata(lua_State *L, int idx);
+int w_Data_getString(lua_State *L);
 int w_Data_getPointer(lua_State *L);
 int w_Data_getPointer(lua_State *L);
 int w_Data_getSize(lua_State *L);
 int w_Data_getSize(lua_State *L);
 int w_Data_open(lua_State *L);
 int w_Data_open(lua_State *L);

+ 2 - 1
src/libraries/Box2D/Box2D.h

@@ -56,12 +56,13 @@ For discussion please visit http://box2d.org/forum
 #include <Box2D/Dynamics/Joints/b2DistanceJoint.h>
 #include <Box2D/Dynamics/Joints/b2DistanceJoint.h>
 #include <Box2D/Dynamics/Joints/b2FrictionJoint.h>
 #include <Box2D/Dynamics/Joints/b2FrictionJoint.h>
 #include <Box2D/Dynamics/Joints/b2GearJoint.h>
 #include <Box2D/Dynamics/Joints/b2GearJoint.h>
-#include <Box2D/Dynamics/Joints/b2WheelJoint.h>
+#include <Box2D/Dynamics/Joints/b2MotorJoint.h>
 #include <Box2D/Dynamics/Joints/b2MouseJoint.h>
 #include <Box2D/Dynamics/Joints/b2MouseJoint.h>
 #include <Box2D/Dynamics/Joints/b2PrismaticJoint.h>
 #include <Box2D/Dynamics/Joints/b2PrismaticJoint.h>
 #include <Box2D/Dynamics/Joints/b2PulleyJoint.h>
 #include <Box2D/Dynamics/Joints/b2PulleyJoint.h>
 #include <Box2D/Dynamics/Joints/b2RevoluteJoint.h>
 #include <Box2D/Dynamics/Joints/b2RevoluteJoint.h>
 #include <Box2D/Dynamics/Joints/b2RopeJoint.h>
 #include <Box2D/Dynamics/Joints/b2RopeJoint.h>
 #include <Box2D/Dynamics/Joints/b2WeldJoint.h>
 #include <Box2D/Dynamics/Joints/b2WeldJoint.h>
+#include <Box2D/Dynamics/Joints/b2WheelJoint.h>
 
 
 #endif
 #endif

+ 21 - 2
src/libraries/Box2D/Collision/Shapes/b2ChainShape.cpp

@@ -19,8 +19,7 @@
 #include <Box2D/Collision/Shapes/b2ChainShape.h>
 #include <Box2D/Collision/Shapes/b2ChainShape.h>
 #include <Box2D/Collision/Shapes/b2EdgeShape.h>
 #include <Box2D/Collision/Shapes/b2EdgeShape.h>
 #include <new>
 #include <new>
-#include <cstring>
-using namespace std;
+#include <memory.h>
 
 
 b2ChainShape::~b2ChainShape()
 b2ChainShape::~b2ChainShape()
 {
 {
@@ -33,6 +32,14 @@ void b2ChainShape::CreateLoop(const b2Vec2* vertices, int32 count)
 {
 {
 	b2Assert(m_vertices == NULL && m_count == 0);
 	b2Assert(m_vertices == NULL && m_count == 0);
 	b2Assert(count >= 3);
 	b2Assert(count >= 3);
+	for (int32 i = 1; i < count; ++i)
+	{
+		b2Vec2 v1 = vertices[i-1];
+		b2Vec2 v2 = vertices[i];
+		// If the code crashes here, it means your vertices are too close together.
+		b2Assert(b2DistanceSquared(v1, v2) > b2_linearSlop * b2_linearSlop);
+	}
+
 	m_count = count + 1;
 	m_count = count + 1;
 	m_vertices = (b2Vec2*)b2Alloc(m_count * sizeof(b2Vec2));
 	m_vertices = (b2Vec2*)b2Alloc(m_count * sizeof(b2Vec2));
 	memcpy(m_vertices, vertices, count * sizeof(b2Vec2));
 	memcpy(m_vertices, vertices, count * sizeof(b2Vec2));
@@ -47,11 +54,23 @@ void b2ChainShape::CreateChain(const b2Vec2* vertices, int32 count)
 {
 {
 	b2Assert(m_vertices == NULL && m_count == 0);
 	b2Assert(m_vertices == NULL && m_count == 0);
 	b2Assert(count >= 2);
 	b2Assert(count >= 2);
+	for (int32 i = 1; i < count; ++i)
+	{
+		b2Vec2 v1 = vertices[i-1];
+		b2Vec2 v2 = vertices[i];
+		// If the code crashes here, it means your vertices are too close together.
+		b2Assert(b2DistanceSquared(v1, v2) > b2_linearSlop * b2_linearSlop);
+	}
+
 	m_count = count;
 	m_count = count;
 	m_vertices = (b2Vec2*)b2Alloc(count * sizeof(b2Vec2));
 	m_vertices = (b2Vec2*)b2Alloc(count * sizeof(b2Vec2));
 	memcpy(m_vertices, vertices, m_count * sizeof(b2Vec2));
 	memcpy(m_vertices, vertices, m_count * sizeof(b2Vec2));
+
 	m_hasPrevVertex = false;
 	m_hasPrevVertex = false;
 	m_hasNextVertex = false;
 	m_hasNextVertex = false;
+
+	m_prevVertex.SetZero();
+	m_nextVertex.SetZero();
 }
 }
 
 
 void b2ChainShape::SetPrevVertex(const b2Vec2& prevVertex)
 void b2ChainShape::SetPrevVertex(const b2Vec2& prevVertex)

+ 2 - 2
src/libraries/Box2D/Collision/Shapes/b2ChainShape.h

@@ -95,8 +95,8 @@ inline b2ChainShape::b2ChainShape()
 	m_radius = b2_polygonRadius;
 	m_radius = b2_polygonRadius;
 	m_vertices = NULL;
 	m_vertices = NULL;
 	m_count = 0;
 	m_count = 0;
-	m_hasPrevVertex = NULL;
-	m_hasNextVertex = NULL;
+	m_hasPrevVertex = false;
+	m_hasNextVertex = false;
 }
 }
 
 
 #endif
 #endif

+ 0 - 1
src/libraries/Box2D/Collision/Shapes/b2CircleShape.cpp

@@ -18,7 +18,6 @@
 
 
 #include <Box2D/Collision/Shapes/b2CircleShape.h>
 #include <Box2D/Collision/Shapes/b2CircleShape.h>
 #include <new>
 #include <new>
-using namespace std;
 
 
 b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const
 b2Shape* b2CircleShape::Clone(b2BlockAllocator* allocator) const
 {
 {

+ 2 - 3
src/libraries/Box2D/Collision/Shapes/b2EdgeShape.cpp

@@ -18,7 +18,6 @@
 
 
 #include <Box2D/Collision/Shapes/b2EdgeShape.h>
 #include <Box2D/Collision/Shapes/b2EdgeShape.h>
 #include <new>
 #include <new>
-using namespace std;
 
 
 void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2)
 void b2EdgeShape::Set(const b2Vec2& v1, const b2Vec2& v2)
 {
 {
@@ -105,11 +104,11 @@ bool b2EdgeShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& input,
 	output->fraction = t;
 	output->fraction = t;
 	if (numerator > 0.0f)
 	if (numerator > 0.0f)
 	{
 	{
-		output->normal = -normal;
+		output->normal = -b2Mul(xf.q, normal);
 	}
 	}
 	else
 	else
 	{
 	{
-		output->normal = normal;
+		output->normal = b2Mul(xf.q, normal);
 	}
 	}
 	return true;
 	return true;
 }
 }

+ 139 - 41
src/libraries/Box2D/Collision/Shapes/b2PolygonShape.cpp

@@ -29,7 +29,7 @@ b2Shape* b2PolygonShape::Clone(b2BlockAllocator* allocator) const
 
 
 void b2PolygonShape::SetAsBox(float32 hx, float32 hy)
 void b2PolygonShape::SetAsBox(float32 hx, float32 hy)
 {
 {
-	m_vertexCount = 4;
+	m_count = 4;
 	m_vertices[0].Set(-hx, -hy);
 	m_vertices[0].Set(-hx, -hy);
 	m_vertices[1].Set( hx, -hy);
 	m_vertices[1].Set( hx, -hy);
 	m_vertices[2].Set( hx,  hy);
 	m_vertices[2].Set( hx,  hy);
@@ -43,7 +43,7 @@ void b2PolygonShape::SetAsBox(float32 hx, float32 hy)
 
 
 void b2PolygonShape::SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle)
 void b2PolygonShape::SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle)
 {
 {
-	m_vertexCount = 4;
+	m_count = 4;
 	m_vertices[0].Set(-hx, -hy);
 	m_vertices[0].Set(-hx, -hy);
 	m_vertices[1].Set( hx, -hy);
 	m_vertices[1].Set( hx, -hy);
 	m_vertices[2].Set( hx,  hy);
 	m_vertices[2].Set( hx,  hy);
@@ -59,7 +59,7 @@ void b2PolygonShape::SetAsBox(float32 hx, float32 hy, const b2Vec2& center, floa
 	xf.q.Set(angle);
 	xf.q.Set(angle);
 
 
 	// Transform vertices and normals.
 	// Transform vertices and normals.
-	for (int32 i = 0; i < m_vertexCount; ++i)
+	for (int32 i = 0; i < m_count; ++i)
 	{
 	{
 		m_vertices[i] = b2Mul(xf, m_vertices[i]);
 		m_vertices[i] = b2Mul(xf, m_vertices[i]);
 		m_normals[i] = b2Mul(xf.q, m_normals[i]);
 		m_normals[i] = b2Mul(xf.q, m_normals[i]);
@@ -120,61 +120,131 @@ static b2Vec2 ComputeCentroid(const b2Vec2* vs, int32 count)
 void b2PolygonShape::Set(const b2Vec2* vertices, int32 count)
 void b2PolygonShape::Set(const b2Vec2* vertices, int32 count)
 {
 {
 	b2Assert(3 <= count && count <= b2_maxPolygonVertices);
 	b2Assert(3 <= count && count <= b2_maxPolygonVertices);
-	m_vertexCount = count;
+	if (count < 3)
+	{
+		SetAsBox(1.0f, 1.0f);
+		return;
+	}
+	
+	int32 n = b2Min(count, b2_maxPolygonVertices);
 
 
-	// Copy vertices.
-	for (int32 i = 0; i < m_vertexCount; ++i)
+	// Perform welding and copy vertices into local buffer.
+	b2Vec2 ps[b2_maxPolygonVertices];
+	int32 tempCount = 0;
+	for (int32 i = 0; i < n; ++i)
 	{
 	{
-		m_vertices[i] = vertices[i];
+		b2Vec2 v = vertices[i];
+
+		bool unique = true;
+		for (int32 j = 0; j < tempCount; ++j)
+		{
+			if (b2DistanceSquared(v, ps[j]) < 0.5f * b2_linearSlop)
+			{
+				unique = false;
+				break;
+			}
+		}
+
+		if (unique)
+		{
+			ps[tempCount++] = v;
+		}
 	}
 	}
 
 
-	// Compute normals. Ensure the edges have non-zero length.
-	for (int32 i = 0; i < m_vertexCount; ++i)
+	n = tempCount;
+	if (n < 3)
 	{
 	{
-		int32 i1 = i;
-		int32 i2 = i + 1 < m_vertexCount ? i + 1 : 0;
-		b2Vec2 edge = m_vertices[i2] - m_vertices[i1];
-		b2Assert(edge.LengthSquared() > b2_epsilon * b2_epsilon);
-		m_normals[i] = b2Cross(edge, 1.0f);
-		m_normals[i].Normalize();
+		// Polygon is degenerate.
+		b2Assert(false);
+		SetAsBox(1.0f, 1.0f);
+		return;
 	}
 	}
 
 
-#ifdef _DEBUG
-	// Ensure the polygon is convex and the interior
-	// is to the left of each edge.
-	for (int32 i = 0; i < m_vertexCount; ++i)
+	// Create the convex hull using the Gift wrapping algorithm
+	// http://en.wikipedia.org/wiki/Gift_wrapping_algorithm
+
+	// Find the right most point on the hull
+	int32 i0 = 0;
+	float32 x0 = ps[0].x;
+	for (int32 i = 1; i < n; ++i)
 	{
 	{
-		int32 i1 = i;
-		int32 i2 = i + 1 < m_vertexCount ? i + 1 : 0;
-		b2Vec2 edge = m_vertices[i2] - m_vertices[i1];
+		float32 x = ps[i].x;
+		if (x > x0 || (x == x0 && ps[i].y < ps[i0].y))
+		{
+			i0 = i;
+			x0 = x;
+		}
+	}
+
+	int32 hull[b2_maxPolygonVertices];
+	int32 m = 0;
+	int32 ih = i0;
+
+	for (;;)
+	{
+		hull[m] = ih;
 
 
-		for (int32 j = 0; j < m_vertexCount; ++j)
+		int32 ie = 0;
+		for (int32 j = 1; j < n; ++j)
 		{
 		{
-			// Don't check vertices on the current edge.
-			if (j == i1 || j == i2)
+			if (ie == ih)
 			{
 			{
+				ie = j;
 				continue;
 				continue;
 			}
 			}
-			
-			b2Vec2 r = m_vertices[j] - m_vertices[i1];
 
 
-			// If this crashes, your polygon is non-convex, has colinear edges,
-			// or the winding order is wrong.
-			float32 s = b2Cross(edge, r);
-			b2Assert(s > 0.0f && "ERROR: Please ensure your polygon is convex and has a CCW winding order");
+			b2Vec2 r = ps[ie] - ps[hull[m]];
+			b2Vec2 v = ps[j] - ps[hull[m]];
+			float32 c = b2Cross(r, v);
+			if (c < 0.0f)
+			{
+				ie = j;
+			}
+
+			// Collinearity check
+			if (c == 0.0f && v.LengthSquared() > r.LengthSquared())
+			{
+				ie = j;
+			}
+		}
+
+		++m;
+		ih = ie;
+
+		if (ie == i0)
+		{
+			break;
 		}
 		}
 	}
 	}
-#endif
+	
+	m_count = m;
+
+	// Copy vertices.
+	for (int32 i = 0; i < m; ++i)
+	{
+		m_vertices[i] = ps[hull[i]];
+	}
+
+	// Compute normals. Ensure the edges have non-zero length.
+	for (int32 i = 0; i < m; ++i)
+	{
+		int32 i1 = i;
+		int32 i2 = i + 1 < m ? i + 1 : 0;
+		b2Vec2 edge = m_vertices[i2] - m_vertices[i1];
+		b2Assert(edge.LengthSquared() > b2_epsilon * b2_epsilon);
+		m_normals[i] = b2Cross(edge, 1.0f);
+		m_normals[i].Normalize();
+	}
 
 
 	// Compute the polygon centroid.
 	// Compute the polygon centroid.
-	m_centroid = ComputeCentroid(m_vertices, m_vertexCount);
+	m_centroid = ComputeCentroid(m_vertices, m);
 }
 }
 
 
 bool b2PolygonShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const
 bool b2PolygonShape::TestPoint(const b2Transform& xf, const b2Vec2& p) const
 {
 {
 	b2Vec2 pLocal = b2MulT(xf.q, p - xf.p);
 	b2Vec2 pLocal = b2MulT(xf.q, p - xf.p);
 
 
-	for (int32 i = 0; i < m_vertexCount; ++i)
+	for (int32 i = 0; i < m_count; ++i)
 	{
 	{
 		float32 dot = b2Dot(m_normals[i], pLocal - m_vertices[i]);
 		float32 dot = b2Dot(m_normals[i], pLocal - m_vertices[i]);
 		if (dot > 0.0f)
 		if (dot > 0.0f)
@@ -200,7 +270,7 @@ bool b2PolygonShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& inpu
 
 
 	int32 index = -1;
 	int32 index = -1;
 
 
-	for (int32 i = 0; i < m_vertexCount; ++i)
+	for (int32 i = 0; i < m_count; ++i)
 	{
 	{
 		// p = p1 + a * d
 		// p = p1 + a * d
 		// dot(normal, p - v) = 0
 		// dot(normal, p - v) = 0
@@ -265,7 +335,7 @@ void b2PolygonShape::ComputeAABB(b2AABB* aabb, const b2Transform& xf, int32 chil
 	b2Vec2 lower = b2Mul(xf, m_vertices[0]);
 	b2Vec2 lower = b2Mul(xf, m_vertices[0]);
 	b2Vec2 upper = lower;
 	b2Vec2 upper = lower;
 
 
-	for (int32 i = 1; i < m_vertexCount; ++i)
+	for (int32 i = 1; i < m_count; ++i)
 	{
 	{
 		b2Vec2 v = b2Mul(xf, m_vertices[i]);
 		b2Vec2 v = b2Mul(xf, m_vertices[i]);
 		lower = b2Min(lower, v);
 		lower = b2Min(lower, v);
@@ -303,7 +373,7 @@ void b2PolygonShape::ComputeMass(b2MassData* massData, float32 density) const
 	//
 	//
 	// The rest of the derivation is handled by computer algebra.
 	// The rest of the derivation is handled by computer algebra.
 
 
-	b2Assert(m_vertexCount >= 3);
+	b2Assert(m_count >= 3);
 
 
 	b2Vec2 center; center.Set(0.0f, 0.0f);
 	b2Vec2 center; center.Set(0.0f, 0.0f);
 	float32 area = 0.0f;
 	float32 area = 0.0f;
@@ -314,19 +384,19 @@ void b2PolygonShape::ComputeMass(b2MassData* massData, float32 density) const
 	b2Vec2 s(0.0f, 0.0f);
 	b2Vec2 s(0.0f, 0.0f);
 
 
 	// This code would put the reference point inside the polygon.
 	// This code would put the reference point inside the polygon.
-	for (int32 i = 0; i < m_vertexCount; ++i)
+	for (int32 i = 0; i < m_count; ++i)
 	{
 	{
 		s += m_vertices[i];
 		s += m_vertices[i];
 	}
 	}
-	s *= 1.0f / m_vertexCount;
+	s *= 1.0f / m_count;
 
 
 	const float32 k_inv3 = 1.0f / 3.0f;
 	const float32 k_inv3 = 1.0f / 3.0f;
 
 
-	for (int32 i = 0; i < m_vertexCount; ++i)
+	for (int32 i = 0; i < m_count; ++i)
 	{
 	{
 		// Triangle vertices.
 		// Triangle vertices.
 		b2Vec2 e1 = m_vertices[i] - s;
 		b2Vec2 e1 = m_vertices[i] - s;
-		b2Vec2 e2 = i + 1 < m_vertexCount ? m_vertices[i+1] - s : m_vertices[0] - s;
+		b2Vec2 e2 = i + 1 < m_count ? m_vertices[i+1] - s : m_vertices[0] - s;
 
 
 		float32 D = b2Cross(e1, e2);
 		float32 D = b2Cross(e1, e2);
 
 
@@ -359,3 +429,31 @@ void b2PolygonShape::ComputeMass(b2MassData* massData, float32 density) const
 	// Shift to center of mass then to original body origin.
 	// Shift to center of mass then to original body origin.
 	massData->I += massData->mass * (b2Dot(massData->center, massData->center) - b2Dot(center, center));
 	massData->I += massData->mass * (b2Dot(massData->center, massData->center) - b2Dot(center, center));
 }
 }
+
+bool b2PolygonShape::Validate() const
+{
+	for (int32 i = 0; i < m_count; ++i)
+	{
+		int32 i1 = i;
+		int32 i2 = i < m_count - 1 ? i1 + 1 : 0;
+		b2Vec2 p = m_vertices[i1];
+		b2Vec2 e = m_vertices[i2] - p;
+
+		for (int32 j = 0; j < m_count; ++j)
+		{
+			if (j == i1 || j == i2)
+			{
+				continue;
+			}
+
+			b2Vec2 v = m_vertices[j] - p;
+			float32 c = b2Cross(e, v);
+			if (c < 0.0f)
+			{
+				return false;
+			}
+		}
+	}
+
+	return true;
+}

+ 14 - 8
src/libraries/Box2D/Collision/Shapes/b2PolygonShape.h

@@ -36,12 +36,14 @@ public:
 	/// @see b2Shape::GetChildCount
 	/// @see b2Shape::GetChildCount
 	int32 GetChildCount() const;
 	int32 GetChildCount() const;
 
 
-	/// Copy vertices. This assumes the vertices define a convex polygon.
-	/// It is assumed that the exterior is the the right of each edge.
+	/// Create a convex hull from the given array of local points.
 	/// The count must be in the range [3, b2_maxPolygonVertices].
 	/// The count must be in the range [3, b2_maxPolygonVertices].
-	void Set(const b2Vec2* vertices, int32 vertexCount);
+	/// @warning the points may be re-ordered, even if they form a convex polygon
+	/// @warning collinear points are handled but not removed. Collinear points
+	/// may lead to poor stacking behavior.
+	void Set(const b2Vec2* points, int32 count);
 
 
-	/// Build vertices to represent an axis-aligned box.
+	/// Build vertices to represent an axis-aligned box centered on the local origin.
 	/// @param hx the half-width.
 	/// @param hx the half-width.
 	/// @param hy the half-height.
 	/// @param hy the half-height.
 	void SetAsBox(float32 hx, float32 hy);
 	void SetAsBox(float32 hx, float32 hy);
@@ -67,28 +69,32 @@ public:
 	void ComputeMass(b2MassData* massData, float32 density) const;
 	void ComputeMass(b2MassData* massData, float32 density) const;
 
 
 	/// Get the vertex count.
 	/// Get the vertex count.
-	int32 GetVertexCount() const { return m_vertexCount; }
+	int32 GetVertexCount() const { return m_count; }
 
 
 	/// Get a vertex by index.
 	/// Get a vertex by index.
 	const b2Vec2& GetVertex(int32 index) const;
 	const b2Vec2& GetVertex(int32 index) const;
 
 
+	/// Validate convexity. This is a very time consuming operation.
+	/// @returns true if valid
+	bool Validate() const;
+
 	b2Vec2 m_centroid;
 	b2Vec2 m_centroid;
 	b2Vec2 m_vertices[b2_maxPolygonVertices];
 	b2Vec2 m_vertices[b2_maxPolygonVertices];
 	b2Vec2 m_normals[b2_maxPolygonVertices];
 	b2Vec2 m_normals[b2_maxPolygonVertices];
-	int32 m_vertexCount;
+	int32 m_count;
 };
 };
 
 
 inline b2PolygonShape::b2PolygonShape()
 inline b2PolygonShape::b2PolygonShape()
 {
 {
 	m_type = e_polygon;
 	m_type = e_polygon;
 	m_radius = b2_polygonRadius;
 	m_radius = b2_polygonRadius;
-	m_vertexCount = 0;
+	m_count = 0;
 	m_centroid.SetZero();
 	m_centroid.SetZero();
 }
 }
 
 
 inline const b2Vec2& b2PolygonShape::GetVertex(int32 index) const
 inline const b2Vec2& b2PolygonShape::GetVertex(int32 index) const
 {
 {
-	b2Assert(0 <= index && index < m_vertexCount);
+	b2Assert(0 <= index && index < m_count);
 	return m_vertices[index];
 	return m_vertices[index];
 }
 }
 
 

+ 1 - 3
src/libraries/Box2D/Collision/b2BroadPhase.cpp

@@ -17,8 +17,7 @@
 */
 */
 
 
 #include <Box2D/Collision/b2BroadPhase.h>
 #include <Box2D/Collision/b2BroadPhase.h>
-#include <cstring>
-using namespace std;
+#include <memory.h>
 
 
 b2BroadPhase::b2BroadPhase()
 b2BroadPhase::b2BroadPhase()
 {
 {
@@ -90,7 +89,6 @@ void b2BroadPhase::UnBufferMove(int32 proxyId)
 		if (m_moveBuffer[i] == proxyId)
 		if (m_moveBuffer[i] == proxyId)
 		{
 		{
 			m_moveBuffer[i] = e_nullProxy;
 			m_moveBuffer[i] = e_nullProxy;
-			return;
 		}
 		}
 	}
 	}
 }
 }

+ 10 - 1
src/libraries/Box2D/Collision/b2BroadPhase.h

@@ -28,7 +28,6 @@ struct b2Pair
 {
 {
 	int32 proxyIdA;
 	int32 proxyIdA;
 	int32 proxyIdB;
 	int32 proxyIdB;
-	int32 next;
 };
 };
 
 
 /// The broad-phase is used for computing pairs and performing volume queries and ray casts.
 /// The broad-phase is used for computing pairs and performing volume queries and ray casts.
@@ -100,6 +99,11 @@ public:
 	/// Get the quality metric of the embedded tree.
 	/// Get the quality metric of the embedded tree.
 	float32 GetTreeQuality() const;
 	float32 GetTreeQuality() const;
 
 
+	/// Shift the world origin. Useful for large worlds.
+	/// The shift formula is: position -= newOrigin
+	/// @param newOrigin the new origin with respect to the old origin
+	void ShiftOrigin(const b2Vec2& newOrigin);
+
 private:
 private:
 
 
 	friend class b2DynamicTree;
 	friend class b2DynamicTree;
@@ -245,4 +249,9 @@ inline void b2BroadPhase::RayCast(T* callback, const b2RayCastInput& input) cons
 	m_tree.RayCast(callback, input);
 	m_tree.RayCast(callback, input);
 }
 }
 
 
+inline void b2BroadPhase::ShiftOrigin(const b2Vec2& newOrigin)
+{
+	m_tree.ShiftOrigin(newOrigin);
+}
+
 #endif
 #endif

+ 1 - 1
src/libraries/Box2D/Collision/b2CollideCircle.cpp

@@ -63,7 +63,7 @@ void b2CollidePolygonAndCircle(
 	int32 normalIndex = 0;
 	int32 normalIndex = 0;
 	float32 separation = -b2_maxFloat;
 	float32 separation = -b2_maxFloat;
 	float32 radius = polygonA->m_radius + circleB->m_radius;
 	float32 radius = polygonA->m_radius + circleB->m_radius;
-	int32 vertexCount = polygonA->m_vertexCount;
+	int32 vertexCount = polygonA->m_count;
 	const b2Vec2* vertices = polygonA->m_vertices;
 	const b2Vec2* vertices = polygonA->m_vertices;
 	const b2Vec2* normals = polygonA->m_normals;
 	const b2Vec2* normals = polygonA->m_normals;
 
 

+ 6 - 6
src/libraries/Box2D/Collision/b2CollideEdge.cpp

@@ -425,8 +425,8 @@ void b2EPCollider::Collide(b2Manifold* manifold, const b2EdgeShape* edgeA, const
 	}
 	}
 	
 	
 	// Get polygonB in frameA
 	// Get polygonB in frameA
-	m_polygonB.count = polygonB->m_vertexCount;
-	for (int32 i = 0; i < polygonB->m_vertexCount; ++i)
+	m_polygonB.count = polygonB->m_count;
+	for (int32 i = 0; i < polygonB->m_count; ++i)
 	{
 	{
 		m_polygonB.vertices[i] = b2Mul(m_xf, polygonB->m_vertices[i]);
 		m_polygonB.vertices[i] = b2Mul(m_xf, polygonB->m_vertices[i]);
 		m_polygonB.normals[i] = b2Mul(m_xf.q, polygonB->m_normals[i]);
 		m_polygonB.normals[i] = b2Mul(m_xf.q, polygonB->m_normals[i]);
@@ -497,13 +497,13 @@ void b2EPCollider::Collide(b2Manifold* manifold, const b2EdgeShape* edgeA, const
 		
 		
 		ie[0].v = m_polygonB.vertices[i1];
 		ie[0].v = m_polygonB.vertices[i1];
 		ie[0].id.cf.indexA = 0;
 		ie[0].id.cf.indexA = 0;
-		ie[0].id.cf.indexB = i1;
+		ie[0].id.cf.indexB = static_cast<uint8>(i1);
 		ie[0].id.cf.typeA = b2ContactFeature::e_face;
 		ie[0].id.cf.typeA = b2ContactFeature::e_face;
 		ie[0].id.cf.typeB = b2ContactFeature::e_vertex;
 		ie[0].id.cf.typeB = b2ContactFeature::e_vertex;
 		
 		
 		ie[1].v = m_polygonB.vertices[i2];
 		ie[1].v = m_polygonB.vertices[i2];
 		ie[1].id.cf.indexA = 0;
 		ie[1].id.cf.indexA = 0;
-		ie[1].id.cf.indexB = i2;
+		ie[1].id.cf.indexB = static_cast<uint8>(i2);
 		ie[1].id.cf.typeA = b2ContactFeature::e_face;
 		ie[1].id.cf.typeA = b2ContactFeature::e_face;
 		ie[1].id.cf.typeB = b2ContactFeature::e_vertex;
 		ie[1].id.cf.typeB = b2ContactFeature::e_vertex;
 		
 		
@@ -530,13 +530,13 @@ void b2EPCollider::Collide(b2Manifold* manifold, const b2EdgeShape* edgeA, const
 		
 		
 		ie[0].v = m_v1;
 		ie[0].v = m_v1;
 		ie[0].id.cf.indexA = 0;
 		ie[0].id.cf.indexA = 0;
-		ie[0].id.cf.indexB = primaryAxis.index;
+		ie[0].id.cf.indexB = static_cast<uint8>(primaryAxis.index);
 		ie[0].id.cf.typeA = b2ContactFeature::e_vertex;
 		ie[0].id.cf.typeA = b2ContactFeature::e_vertex;
 		ie[0].id.cf.typeB = b2ContactFeature::e_face;
 		ie[0].id.cf.typeB = b2ContactFeature::e_face;
 		
 		
 		ie[1].v = m_v2;
 		ie[1].v = m_v2;
 		ie[1].id.cf.indexA = 0;
 		ie[1].id.cf.indexA = 0;
-		ie[1].id.cf.indexB = primaryAxis.index;		
+		ie[1].id.cf.indexB = static_cast<uint8>(primaryAxis.index);		
 		ie[1].id.cf.typeA = b2ContactFeature::e_vertex;
 		ie[1].id.cf.typeA = b2ContactFeature::e_vertex;
 		ie[1].id.cf.typeB = b2ContactFeature::e_face;
 		ie[1].id.cf.typeB = b2ContactFeature::e_face;
 		
 		

+ 32 - 110
src/libraries/Box2D/Collision/b2CollidePolygon.cpp

@@ -19,123 +19,46 @@
 #include <Box2D/Collision/b2Collision.h>
 #include <Box2D/Collision/b2Collision.h>
 #include <Box2D/Collision/Shapes/b2PolygonShape.h>
 #include <Box2D/Collision/Shapes/b2PolygonShape.h>
 
 
-// Find the separation between poly1 and poly2 for a give edge normal on poly1.
-static float32 b2EdgeSeparation(const b2PolygonShape* poly1, const b2Transform& xf1, int32 edge1,
-							  const b2PolygonShape* poly2, const b2Transform& xf2)
-{
-	const b2Vec2* vertices1 = poly1->m_vertices;
-	const b2Vec2* normals1 = poly1->m_normals;
-
-	int32 count2 = poly2->m_vertexCount;
-	const b2Vec2* vertices2 = poly2->m_vertices;
-
-	b2Assert(0 <= edge1 && edge1 < poly1->m_vertexCount);
-
-	// Convert normal from poly1's frame into poly2's frame.
-	b2Vec2 normal1World = b2Mul(xf1.q, normals1[edge1]);
-	b2Vec2 normal1 = b2MulT(xf2.q, normal1World);
-
-	// Find support vertex on poly2 for -normal.
-	int32 index = 0;
-	float32 minDot = b2_maxFloat;
-
-	for (int32 i = 0; i < count2; ++i)
-	{
-		float32 dot = b2Dot(vertices2[i], normal1);
-		if (dot < minDot)
-		{
-			minDot = dot;
-			index = i;
-		}
-	}
-
-	b2Vec2 v1 = b2Mul(xf1, vertices1[edge1]);
-	b2Vec2 v2 = b2Mul(xf2, vertices2[index]);
-	float32 separation = b2Dot(v2 - v1, normal1World);
-	return separation;
-}
-
 // Find the max separation between poly1 and poly2 using edge normals from poly1.
 // Find the max separation between poly1 and poly2 using edge normals from poly1.
 static float32 b2FindMaxSeparation(int32* edgeIndex,
 static float32 b2FindMaxSeparation(int32* edgeIndex,
 								 const b2PolygonShape* poly1, const b2Transform& xf1,
 								 const b2PolygonShape* poly1, const b2Transform& xf1,
 								 const b2PolygonShape* poly2, const b2Transform& xf2)
 								 const b2PolygonShape* poly2, const b2Transform& xf2)
 {
 {
-	int32 count1 = poly1->m_vertexCount;
-	const b2Vec2* normals1 = poly1->m_normals;
-
-	// Vector pointing from the centroid of poly1 to the centroid of poly2.
-	b2Vec2 d = b2Mul(xf2, poly2->m_centroid) - b2Mul(xf1, poly1->m_centroid);
-	b2Vec2 dLocal1 = b2MulT(xf1.q, d);
-
-	// Find edge normal on poly1 that has the largest projection onto d.
-	int32 edge = 0;
-	float32 maxDot = -b2_maxFloat;
+	int32 count1 = poly1->m_count;
+	int32 count2 = poly2->m_count;
+	const b2Vec2* n1s = poly1->m_normals;
+	const b2Vec2* v1s = poly1->m_vertices;
+	const b2Vec2* v2s = poly2->m_vertices;
+	b2Transform xf = b2MulT(xf2, xf1);
+
+	int32 bestIndex = 0;
+	float32 maxSeparation = -b2_maxFloat;
 	for (int32 i = 0; i < count1; ++i)
 	for (int32 i = 0; i < count1; ++i)
 	{
 	{
-		float32 dot = b2Dot(normals1[i], dLocal1);
-		if (dot > maxDot)
-		{
-			maxDot = dot;
-			edge = i;
-		}
-	}
-
-	// Get the separation for the edge normal.
-	float32 s = b2EdgeSeparation(poly1, xf1, edge, poly2, xf2);
-
-	// Check the separation for the previous edge normal.
-	int32 prevEdge = edge - 1 >= 0 ? edge - 1 : count1 - 1;
-	float32 sPrev = b2EdgeSeparation(poly1, xf1, prevEdge, poly2, xf2);
-
-	// Check the separation for the next edge normal.
-	int32 nextEdge = edge + 1 < count1 ? edge + 1 : 0;
-	float32 sNext = b2EdgeSeparation(poly1, xf1, nextEdge, poly2, xf2);
-
-	// Find the best edge and the search direction.
-	int32 bestEdge;
-	float32 bestSeparation;
-	int32 increment;
-	if (sPrev > s && sPrev > sNext)
-	{
-		increment = -1;
-		bestEdge = prevEdge;
-		bestSeparation = sPrev;
-	}
-	else if (sNext > s)
-	{
-		increment = 1;
-		bestEdge = nextEdge;
-		bestSeparation = sNext;
-	}
-	else
-	{
-		*edgeIndex = edge;
-		return s;
-	}
+		// Get poly1 normal in frame2.
+		b2Vec2 n = b2Mul(xf.q, n1s[i]);
+		b2Vec2 v1 = b2Mul(xf, v1s[i]);
 
 
-	// Perform a local search for the best edge normal.
-	for ( ; ; )
-	{
-		if (increment == -1)
-			edge = bestEdge - 1 >= 0 ? bestEdge - 1 : count1 - 1;
-		else
-			edge = bestEdge + 1 < count1 ? bestEdge + 1 : 0;
-
-		s = b2EdgeSeparation(poly1, xf1, edge, poly2, xf2);
-
-		if (s > bestSeparation)
+		// Find deepest point for normal i.
+		float32 si = b2_maxFloat;
+		for (int32 j = 0; j < count2; ++j)
 		{
 		{
-			bestEdge = edge;
-			bestSeparation = s;
+			float32 sij = b2Dot(n, v2s[j] - v1);
+			if (sij < si)
+			{
+				si = sij;
+			}
 		}
 		}
-		else
+
+		if (si > maxSeparation)
 		{
 		{
-			break;
+			maxSeparation = si;
+			bestIndex = i;
 		}
 		}
 	}
 	}
 
 
-	*edgeIndex = bestEdge;
-	return bestSeparation;
+	*edgeIndex = bestIndex;
+	return maxSeparation;
 }
 }
 
 
 static void b2FindIncidentEdge(b2ClipVertex c[2],
 static void b2FindIncidentEdge(b2ClipVertex c[2],
@@ -144,11 +67,11 @@ static void b2FindIncidentEdge(b2ClipVertex c[2],
 {
 {
 	const b2Vec2* normals1 = poly1->m_normals;
 	const b2Vec2* normals1 = poly1->m_normals;
 
 
-	int32 count2 = poly2->m_vertexCount;
+	int32 count2 = poly2->m_count;
 	const b2Vec2* vertices2 = poly2->m_vertices;
 	const b2Vec2* vertices2 = poly2->m_vertices;
 	const b2Vec2* normals2 = poly2->m_normals;
 	const b2Vec2* normals2 = poly2->m_normals;
 
 
-	b2Assert(0 <= edge1 && edge1 < poly1->m_vertexCount);
+	b2Assert(0 <= edge1 && edge1 < poly1->m_count);
 
 
 	// Get the normal of the reference edge in poly2's frame.
 	// Get the normal of the reference edge in poly2's frame.
 	b2Vec2 normal1 = b2MulT(xf2.q, b2Mul(xf1.q, normals1[edge1]));
 	b2Vec2 normal1 = b2MulT(xf2.q, b2Mul(xf1.q, normals1[edge1]));
@@ -210,12 +133,11 @@ void b2CollidePolygons(b2Manifold* manifold,
 	const b2PolygonShape* poly1;	// reference polygon
 	const b2PolygonShape* poly1;	// reference polygon
 	const b2PolygonShape* poly2;	// incident polygon
 	const b2PolygonShape* poly2;	// incident polygon
 	b2Transform xf1, xf2;
 	b2Transform xf1, xf2;
-	int32 edge1;		// reference edge
+	int32 edge1;					// reference edge
 	uint8 flip;
 	uint8 flip;
-	const float32 k_relativeTol = 0.98f;
-	const float32 k_absoluteTol = 0.001f;
+	const float32 k_tol = 0.1f * b2_linearSlop;
 
 
-	if (separationB > k_relativeTol * separationA + k_absoluteTol)
+	if (separationB > separationA + k_tol)
 	{
 	{
 		poly1 = polyB;
 		poly1 = polyB;
 		poly2 = polyA;
 		poly2 = polyA;
@@ -239,7 +161,7 @@ void b2CollidePolygons(b2Manifold* manifold,
 	b2ClipVertex incidentEdge[2];
 	b2ClipVertex incidentEdge[2];
 	b2FindIncidentEdge(incidentEdge, poly1, xf1, edge1, poly2, xf2);
 	b2FindIncidentEdge(incidentEdge, poly1, xf1, edge1, poly2, xf2);
 
 
-	int32 count1 = poly1->m_vertexCount;
+	int32 count1 = poly1->m_count;
 	const b2Vec2* vertices1 = poly1->m_vertices;
 	const b2Vec2* vertices1 = poly1->m_vertices;
 
 
 	int32 iv1 = edge1;
 	int32 iv1 = edge1;

+ 4 - 1
src/libraries/Box2D/Collision/b2Collision.cpp

@@ -44,6 +44,7 @@ void b2WorldManifold::Initialize(const b2Manifold* manifold,
 			b2Vec2 cA = pointA + radiusA * normal;
 			b2Vec2 cA = pointA + radiusA * normal;
 			b2Vec2 cB = pointB - radiusB * normal;
 			b2Vec2 cB = pointB - radiusB * normal;
 			points[0] = 0.5f * (cA + cB);
 			points[0] = 0.5f * (cA + cB);
+			separations[0] = b2Dot(cB - cA, normal);
 		}
 		}
 		break;
 		break;
 
 
@@ -58,6 +59,7 @@ void b2WorldManifold::Initialize(const b2Manifold* manifold,
 				b2Vec2 cA = clipPoint + (radiusA - b2Dot(clipPoint - planePoint, normal)) * normal;
 				b2Vec2 cA = clipPoint + (radiusA - b2Dot(clipPoint - planePoint, normal)) * normal;
 				b2Vec2 cB = clipPoint - radiusB * normal;
 				b2Vec2 cB = clipPoint - radiusB * normal;
 				points[i] = 0.5f * (cA + cB);
 				points[i] = 0.5f * (cA + cB);
+				separations[i] = b2Dot(cB - cA, normal);
 			}
 			}
 		}
 		}
 		break;
 		break;
@@ -73,6 +75,7 @@ void b2WorldManifold::Initialize(const b2Manifold* manifold,
 				b2Vec2 cB = clipPoint + (radiusB - b2Dot(clipPoint - planePoint, normal)) * normal;
 				b2Vec2 cB = clipPoint + (radiusB - b2Dot(clipPoint - planePoint, normal)) * normal;
 				b2Vec2 cA = clipPoint - radiusA * normal;
 				b2Vec2 cA = clipPoint - radiusA * normal;
 				points[i] = 0.5f * (cA + cB);
 				points[i] = 0.5f * (cA + cB);
+				separations[i] = b2Dot(cA - cB, normal);
 			}
 			}
 
 
 			// Ensure normal points from A to B.
 			// Ensure normal points from A to B.
@@ -217,7 +220,7 @@ int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2],
 		vOut[numOut].v = vIn[0].v + interp * (vIn[1].v - vIn[0].v);
 		vOut[numOut].v = vIn[0].v + interp * (vIn[1].v - vIn[0].v);
 
 
 		// VertexA is hitting edgeB.
 		// VertexA is hitting edgeB.
-		vOut[numOut].id.cf.indexA = vertexIndexA;
+		vOut[numOut].id.cf.indexA = static_cast<uint8>(vertexIndexA);
 		vOut[numOut].id.cf.indexB = vIn[0].id.cf.indexB;
 		vOut[numOut].id.cf.indexB = vIn[0].id.cf.indexB;
 		vOut[numOut].id.cf.typeA = b2ContactFeature::e_vertex;
 		vOut[numOut].id.cf.typeA = b2ContactFeature::e_vertex;
 		vOut[numOut].id.cf.typeB = b2ContactFeature::e_face;
 		vOut[numOut].id.cf.typeB = b2ContactFeature::e_face;

+ 4 - 3
src/libraries/Box2D/Collision/b2Collision.h

@@ -20,7 +20,7 @@
 #define B2_COLLISION_H
 #define B2_COLLISION_H
 
 
 #include <Box2D/Common/b2Math.h>
 #include <Box2D/Common/b2Math.h>
-#include <climits>
+#include <limits.h>
 
 
 /// @file
 /// @file
 /// Structures and functions used for computing contact points, distance
 /// Structures and functions used for computing contact points, distance
@@ -117,8 +117,9 @@ struct b2WorldManifold
 					const b2Transform& xfA, float32 radiusA,
 					const b2Transform& xfA, float32 radiusA,
 					const b2Transform& xfB, float32 radiusB);
 					const b2Transform& xfB, float32 radiusB);
 
 
-	b2Vec2 normal;							///< world vector pointing from A to B
-	b2Vec2 points[b2_maxManifoldPoints];	///< world contact point (point of intersection)
+	b2Vec2 normal;								///< world vector pointing from A to B
+	b2Vec2 points[b2_maxManifoldPoints];		///< world contact point (point of intersection)
+	float32 separations[b2_maxManifoldPoints];	///< a negative value indicates overlap, in meters
 };
 };
 
 
 /// This is used for determining the state of contact points.
 /// This is used for determining the state of contact points.

+ 8 - 8
src/libraries/Box2D/Collision/b2Distance.cpp

@@ -31,7 +31,7 @@ void b2DistanceProxy::Set(const b2Shape* shape, int32 index)
 	{
 	{
 	case b2Shape::e_circle:
 	case b2Shape::e_circle:
 		{
 		{
-			const b2CircleShape* circle = (b2CircleShape*)shape;
+			const b2CircleShape* circle = static_cast<const b2CircleShape*>(shape);
 			m_vertices = &circle->m_p;
 			m_vertices = &circle->m_p;
 			m_count = 1;
 			m_count = 1;
 			m_radius = circle->m_radius;
 			m_radius = circle->m_radius;
@@ -40,16 +40,16 @@ void b2DistanceProxy::Set(const b2Shape* shape, int32 index)
 
 
 	case b2Shape::e_polygon:
 	case b2Shape::e_polygon:
 		{
 		{
-			const b2PolygonShape* polygon = (b2PolygonShape*)shape;
+			const b2PolygonShape* polygon = static_cast<const b2PolygonShape*>(shape);
 			m_vertices = polygon->m_vertices;
 			m_vertices = polygon->m_vertices;
-			m_count = polygon->m_vertexCount;
+			m_count = polygon->m_count;
 			m_radius = polygon->m_radius;
 			m_radius = polygon->m_radius;
 		}
 		}
 		break;
 		break;
 
 
 	case b2Shape::e_chain:
 	case b2Shape::e_chain:
 		{
 		{
-			const b2ChainShape* chain = (b2ChainShape*)shape;
+			const b2ChainShape* chain = static_cast<const b2ChainShape*>(shape);
 			b2Assert(0 <= index && index < chain->m_count);
 			b2Assert(0 <= index && index < chain->m_count);
 
 
 			m_buffer[0] = chain->m_vertices[index];
 			m_buffer[0] = chain->m_vertices[index];
@@ -70,7 +70,7 @@ void b2DistanceProxy::Set(const b2Shape* shape, int32 index)
 
 
 	case b2Shape::e_edge:
 	case b2Shape::e_edge:
 		{
 		{
-			const b2EdgeShape* edge = (b2EdgeShape*)shape;
+			const b2EdgeShape* edge = static_cast<const b2EdgeShape*>(shape);
 			m_vertices = &edge->m_vertex1;
 			m_vertices = &edge->m_vertex1;
 			m_count = 2;
 			m_count = 2;
 			m_radius = edge->m_radius;
 			m_radius = edge->m_radius;
@@ -141,6 +141,7 @@ struct b2Simplex
 			v->wA = b2Mul(transformA, wALocal);
 			v->wA = b2Mul(transformA, wALocal);
 			v->wB = b2Mul(transformB, wBLocal);
 			v->wB = b2Mul(transformB, wBLocal);
 			v->w = v->wB - v->wA;
 			v->w = v->wB - v->wA;
+			v->a = 1.0f;
 			m_count = 1;
 			m_count = 1;
 		}
 		}
 	}
 	}
@@ -244,7 +245,7 @@ struct b2Simplex
 		{
 		{
 		case 0:
 		case 0:
 			b2Assert(false);
 			b2Assert(false);
-			return 0.0;
+			return 0.0f;
 
 
 		case 1:
 		case 1:
 			return 0.0f;
 			return 0.0f;
@@ -465,8 +466,7 @@ void b2Distance(b2DistanceOutput* output,
 	int32 saveA[3], saveB[3];
 	int32 saveA[3], saveB[3];
 	int32 saveCount = 0;
 	int32 saveCount = 0;
 
 
-	b2Vec2 closestPoint = simplex.GetClosestPoint();
-	float32 distanceSqr1 = closestPoint.LengthSquared();
+	float32 distanceSqr1 = b2_maxFloat;
 	float32 distanceSqr2 = distanceSqr1;
 	float32 distanceSqr2 = distanceSqr1;
 
 
 	// Main iteration loop.
 	// Main iteration loop.

Some files were not shown because too many files changed in this diff