Browse Source

Build type information on first use (load-time), instead of using a hardcoded list

--HG--
branch : dynamiccore2
Bart van Strien 8 years ago
parent
commit
c761202486
100 changed files with 462 additions and 463 deletions
  1. 2 0
      src/common/Data.h
  2. 1 0
      src/common/Module.cpp
  3. 2 0
      src/common/Module.h
  4. 2 0
      src/common/Object.cpp
  5. 3 0
      src/common/Object.h
  6. 2 0
      src/common/Stream.h
  7. 8 8
      src/common/Variant.cpp
  8. 2 2
      src/common/Variant.h
  9. 18 17
      src/common/runtime.cpp
  10. 18 18
      src/common/runtime.h
  11. 59 101
      src/common/types.cpp
  12. 20 97
      src/common/types.h
  13. 2 2
      src/common/wrap_Data.cpp
  14. 5 3
      src/modules/audio/Source.cpp
  15. 3 1
      src/modules/audio/Source.h
  16. 18 18
      src/modules/audio/openal/Source.cpp
  17. 13 13
      src/modules/audio/wrap_Audio.cpp
  18. 5 5
      src/modules/audio/wrap_Source.cpp
  19. 8 8
      src/modules/event/sdl/Event.cpp
  20. 1 1
      src/modules/event/wrap_Event.cpp
  21. 2 0
      src/modules/filesystem/DroppedFile.cpp
  22. 2 0
      src/modules/filesystem/DroppedFile.h
  23. 2 0
      src/modules/filesystem/File.cpp
  24. 2 0
      src/modules/filesystem/File.h
  25. 2 0
      src/modules/filesystem/FileData.cpp
  26. 2 0
      src/modules/filesystem/FileData.h
  27. 2 0
      src/modules/filesystem/Filesystem.h
  28. 2 2
      src/modules/filesystem/wrap_DroppedFile.cpp
  29. 5 5
      src/modules/filesystem/wrap_File.cpp
  30. 2 2
      src/modules/filesystem/wrap_FileData.cpp
  31. 13 13
      src/modules/filesystem/wrap_Filesystem.cpp
  32. 2 0
      src/modules/font/GlyphData.cpp
  33. 2 0
      src/modules/font/GlyphData.h
  34. 2 0
      src/modules/font/Rasterizer.cpp
  35. 2 0
      src/modules/font/Rasterizer.h
  36. 11 11
      src/modules/font/wrap_Font.cpp
  37. 2 2
      src/modules/font/wrap_GlyphData.cpp
  38. 3 3
      src/modules/font/wrap_Rasterizer.cpp
  39. 2 0
      src/modules/graphics/Drawable.h
  40. 2 0
      src/modules/graphics/Graphics.cpp
  41. 2 0
      src/modules/graphics/Graphics.h
  42. 2 0
      src/modules/graphics/ParticleSystem.cpp
  43. 3 0
      src/modules/graphics/ParticleSystem.h
  44. 2 0
      src/modules/graphics/Quad.cpp
  45. 2 0
      src/modules/graphics/Quad.h
  46. 2 0
      src/modules/graphics/Texture.cpp
  47. 2 0
      src/modules/graphics/Texture.h
  48. 1 0
      src/modules/graphics/opengl/Canvas.cpp
  49. 2 0
      src/modules/graphics/opengl/Canvas.h
  50. 8 6
      src/modules/graphics/opengl/Font.cpp
  51. 3 1
      src/modules/graphics/opengl/Font.h
  52. 2 0
      src/modules/graphics/opengl/Image.cpp
  53. 2 0
      src/modules/graphics/opengl/Image.h
  54. 2 0
      src/modules/graphics/opengl/Mesh.cpp
  55. 2 0
      src/modules/graphics/opengl/Mesh.h
  56. 1 0
      src/modules/graphics/opengl/Shader.cpp
  57. 2 0
      src/modules/graphics/opengl/Shader.h
  58. 2 0
      src/modules/graphics/opengl/SpriteBatch.cpp
  59. 2 0
      src/modules/graphics/opengl/SpriteBatch.h
  60. 2 0
      src/modules/graphics/opengl/Text.cpp
  61. 2 0
      src/modules/graphics/opengl/Text.h
  62. 2 0
      src/modules/graphics/opengl/Video.cpp
  63. 2 0
      src/modules/graphics/opengl/Video.h
  64. 4 4
      src/modules/graphics/opengl/wrap_Canvas.cpp
  65. 2 2
      src/modules/graphics/opengl/wrap_Font.cpp
  66. 38 38
      src/modules/graphics/opengl/wrap_Graphics.cpp
  67. 4 4
      src/modules/graphics/opengl/wrap_Image.cpp
  68. 6 6
      src/modules/graphics/opengl/wrap_Mesh.cpp
  69. 8 8
      src/modules/graphics/opengl/wrap_ParticleSystem.cpp
  70. 2 2
      src/modules/graphics/opengl/wrap_Shader.cpp
  71. 7 7
      src/modules/graphics/opengl/wrap_SpriteBatch.cpp
  72. 4 4
      src/modules/graphics/opengl/wrap_Text.cpp
  73. 6 6
      src/modules/graphics/opengl/wrap_Video.cpp
  74. 2 2
      src/modules/graphics/wrap_Quad.cpp
  75. 2 2
      src/modules/graphics/wrap_Texture.cpp
  76. 2 0
      src/modules/image/CompressedImageData.cpp
  77. 2 0
      src/modules/image/CompressedImageData.h
  78. 2 0
      src/modules/image/Image.h
  79. 2 0
      src/modules/image/ImageData.cpp
  80. 2 0
      src/modules/image/ImageData.h
  81. 2 2
      src/modules/image/wrap_CompressedImageData.cpp
  82. 4 4
      src/modules/image/wrap_Image.cpp
  83. 4 4
      src/modules/image/wrap_ImageData.cpp
  84. 2 0
      src/modules/joystick/Joystick.cpp
  85. 2 0
      src/modules/joystick/Joystick.h
  86. 2 2
      src/modules/joystick/wrap_Joystick.cpp
  87. 2 2
      src/modules/joystick/wrap_JoystickModule.cpp
  88. 1 1
      src/modules/keyboard/wrap_Keyboard.cpp
  89. 2 0
      src/modules/math/BezierCurve.cpp
  90. 2 0
      src/modules/math/BezierCurve.h
  91. 2 0
      src/modules/math/CompressedData.cpp
  92. 2 0
      src/modules/math/CompressedData.h
  93. 2 0
      src/modules/math/RandomGenerator.cpp
  94. 2 0
      src/modules/math/RandomGenerator.h
  95. 4 4
      src/modules/math/wrap_BezierCurve.cpp
  96. 2 2
      src/modules/math/wrap_CompressedData.cpp
  97. 14 14
      src/modules/math/wrap_Math.cpp
  98. 4 4
      src/modules/math/wrap_RandomGenerator.cpp
  99. 2 0
      src/modules/mouse/Cursor.cpp
  100. 2 0
      src/modules/mouse/Cursor.h

+ 2 - 0
src/common/Data.h

@@ -38,6 +38,8 @@ class Data : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	/**
 	/**
 	 * Destructor.
 	 * Destructor.
 	 **/
 	 **/

+ 1 - 0
src/common/Module.cpp

@@ -58,6 +58,7 @@ namespace
 namespace love
 namespace love
 {
 {
 
 
+love::Type Module::type(&Object::type);
 Module *Module::instances[] = {};
 Module *Module::instances[] = {};
 
 
 Module::~Module()
 Module::~Module()

+ 2 - 0
src/common/Module.h

@@ -34,6 +34,8 @@ class Module : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	enum ModuleType
 	enum ModuleType
 	{
 	{
 		M_AUDIO,
 		M_AUDIO,

+ 2 - 0
src/common/Object.cpp

@@ -24,6 +24,8 @@
 namespace love
 namespace love
 {
 {
 
 
+love::Type Object::type({});
+
 Object::Object()
 Object::Object()
 	: count(1)
 	: count(1)
 {
 {

+ 3 - 0
src/common/Object.h

@@ -22,6 +22,7 @@
 #define LOVE_OBJECT_H
 #define LOVE_OBJECT_H
 
 
 #include <atomic>
 #include <atomic>
+#include "types.h"
 
 
 namespace love
 namespace love
 {
 {
@@ -38,6 +39,8 @@ class Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	/**
 	/**
 	 * Constructor. Sets reference count to one.
 	 * Constructor. Sets reference count to one.
 	 **/
 	 **/

+ 2 - 0
src/common/Stream.h

@@ -31,6 +31,8 @@ namespace love
 class Stream : public Object
 class Stream : public Object
 {
 {
 public:
 public:
+	static love::Type type;
+
 	virtual ~Stream() {}
 	virtual ~Stream() {}
 
 
 	// getData and getSize are assumed to talk about
 	// getData and getSize are assumed to talk about

+ 8 - 8
src/common/Variant.cpp

@@ -24,19 +24,19 @@
 namespace love
 namespace love
 {
 {
 
 
-static love::Type extractudatatype(lua_State *L, int idx)
+static love::Type *extractudatatype(lua_State *L, int idx)
 {
 {
 	Proxy *u = (Proxy *)lua_touserdata(L, idx);
 	Proxy *u = (Proxy *)lua_touserdata(L, idx);
 
 
-	if (u == nullptr || u->type <= INVALID_ID || u->type >= TYPE_MAX_ENUM)
-		return INVALID_ID;
+	if (u == nullptr || u->type == nullptr)
+		return nullptr;
 
 
 	// We could get rid of the dynamic_cast for more performance, but it would
 	// We could get rid of the dynamic_cast for more performance, but it would
 	// be less safe...
 	// be less safe...
 	if (dynamic_cast<Object *>(u->object) != nullptr)
 	if (dynamic_cast<Object *>(u->object) != nullptr)
 		return u->type;
 		return u->type;
 
 
-	return INVALID_ID;
+	return nullptr;
 }
 }
 
 
 Variant::Variant()
 Variant::Variant()
@@ -77,11 +77,11 @@ Variant::Variant(void *userdata)
 	data.userdata = userdata;
 	data.userdata = userdata;
 }
 }
 
 
-Variant::Variant(love::Type udatatype, void *userdata)
+Variant::Variant(love::Type *udatatype, void *userdata)
 	: type(FUSERDATA)
 	: type(FUSERDATA)
 	, udatatype(udatatype)
 	, udatatype(udatatype)
 {
 {
-	if (udatatype != INVALID_ID)
+	if (udatatype != nullptr)
 	{
 	{
 		Proxy *p = (Proxy *) userdata;
 		Proxy *p = (Proxy *) userdata;
 		data.userdata = p->object;
 		data.userdata = p->object;
@@ -243,8 +243,8 @@ void Variant::toLua(lua_State *L) const
 		lua_pushlightuserdata(L, data.userdata);
 		lua_pushlightuserdata(L, data.userdata);
 		break;
 		break;
 	case FUSERDATA:
 	case FUSERDATA:
-		if (udatatype != INVALID_ID)
-			luax_pushtype(L, udatatype, (love::Object *) data.userdata);
+		if (udatatype != nullptr)
+			luax_pushtype(L, *udatatype, (love::Object *) data.userdata);
 		else
 		else
 			lua_pushlightuserdata(L, data.userdata);
 			lua_pushlightuserdata(L, data.userdata);
 		// I know this is not the same
 		// I know this is not the same

+ 2 - 2
src/common/Variant.h

@@ -53,7 +53,7 @@ public:
 	Variant(double number);
 	Variant(double number);
 	Variant(const char *string, size_t len);
 	Variant(const char *string, size_t len);
 	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);
 	Variant(std::vector<std::pair<Variant, Variant>> *table);
 	Variant(const Variant &v);
 	Variant(const Variant &v);
 	Variant(Variant &&v);
 	Variant(Variant &&v);
@@ -101,7 +101,7 @@ private:
 	static const int MAX_SMALL_STRING_LENGTH = 15;
 	static const int MAX_SMALL_STRING_LENGTH = 15;
 
 
 	Type type;
 	Type type;
-	love::Type udatatype;
+	love::Type *udatatype;
 
 
 	union Data
 	union Data
 	{
 	{

+ 18 - 17
src/common/runtime.cpp

@@ -67,8 +67,9 @@ static int w__type(lua_State *L)
 static int w__typeOf(lua_State *L)
 static int w__typeOf(lua_State *L)
 {
 {
 	Proxy *p = (Proxy *)lua_touserdata(L, 1);
 	Proxy *p = (Proxy *)lua_touserdata(L, 1);
-	Type t = luax_type(L, 2);
-	luax_pushboolean(L, typeFlags[p->type][t]);
+	//Type t = luax_type(L, 2);
+	love::Type &t = Object::type; // FIXME
+	luax_pushboolean(L, p->type->isa(t));
 	return 1;
 	return 1;
 }
 }
 
 
@@ -248,7 +249,7 @@ int luax_require(lua_State *L, const char *name)
 
 
 int luax_register_module(lua_State *L, const WrappedModule &m)
 int luax_register_module(lua_State *L, const WrappedModule &m)
 {
 {
-	love::addTypeName(m.type, m.name);
+	love::addTypeName(m.type->getId(), m.name);
 
 
 	// Put a reference to the C++ module in Lua.
 	// Put a reference to the C++ module in Lua.
 	luax_insistregistry(L, REGISTRY_MODULES);
 	luax_insistregistry(L, REGISTRY_MODULES);
@@ -304,9 +305,9 @@ int luax_preload(lua_State *L, lua_CFunction f, const char *name)
 	return 0;
 	return 0;
 }
 }
 
 
-int luax_register_type(lua_State *L, love::Type type, const char *name, ...)
+int luax_register_type(lua_State *L, love::Type &type, const char *name, ...)
 {
 {
-	love::addTypeName(type, name);
+	love::addTypeName(type.getId(), name);
 
 
 	// Get the place for storing and re-using instantiated love types.
 	// Get the place for storing and re-using instantiated love types.
 	luax_getregistry(L, REGISTRY_OBJECTS);
 	luax_getregistry(L, REGISTRY_OBJECTS);
@@ -375,10 +376,10 @@ int luax_register_type(lua_State *L, love::Type type, const char *name, ...)
 	return 0;
 	return 0;
 }
 }
 
 
-void luax_gettypemetatable(lua_State *L, love::Type type)
+void luax_gettypemetatable(lua_State *L, love::Type &type)
 {
 {
 	const char *name = nullptr;
 	const char *name = nullptr;
-	if (getTypeName(type, name))
+	if (getTypeName(type.getId(), name))
 		lua_getfield(L, LUA_REGISTRYINDEX, name);
 		lua_getfield(L, LUA_REGISTRYINDEX, name);
 	else
 	else
 		lua_pushnil(L);
 		lua_pushnil(L);
@@ -437,23 +438,23 @@ int luax_register_searcher(lua_State *L, lua_CFunction f, int pos)
 	return 0;
 	return 0;
 }
 }
 
 
-void luax_rawnewtype(lua_State *L, love::Type type, love::Object *object)
+void luax_rawnewtype(lua_State *L, love::Type &type, love::Object *object)
 {
 {
 	Proxy *u = (Proxy *)lua_newuserdata(L, sizeof(Proxy));
 	Proxy *u = (Proxy *)lua_newuserdata(L, sizeof(Proxy));
 
 
 	object->retain();
 	object->retain();
 
 
 	u->object = object;
 	u->object = object;
-	u->type = type;
+	u->type = &type;
 
 
 	const char *name = "Invalid";
 	const char *name = "Invalid";
-	getTypeName(type, name);
+	getTypeName(type.getId(), name);
 
 
 	luaL_newmetatable(L, name);
 	luaL_newmetatable(L, name);
 	lua_setmetatable(L, -2);
 	lua_setmetatable(L, -2);
 }
 }
 
 
-void luax_pushtype(lua_State *L, love::Type type, love::Object *object)
+void luax_pushtype(lua_State *L, love::Type &type, love::Object *object)
 {
 {
 	if (object == nullptr)
 	if (object == nullptr)
 	{
 	{
@@ -495,15 +496,15 @@ void luax_pushtype(lua_State *L, love::Type type, love::Object *object)
 	// Keep the Proxy userdata on the stack.
 	// Keep the Proxy userdata on the stack.
 }
 }
 
 
-bool luax_istype(lua_State *L, int idx, love::Type type)
+bool luax_istype(lua_State *L, int idx, love::Type &type)
 {
 {
 	if (lua_type(L, idx) != LUA_TUSERDATA)
 	if (lua_type(L, idx) != LUA_TUSERDATA)
 		return false;
 		return false;
 
 
 	Proxy *p = (Proxy *) lua_touserdata(L, idx);
 	Proxy *p = (Proxy *) lua_touserdata(L, idx);
 
 
-	if (p->type > INVALID_ID && p->type < TYPE_MAX_ENUM)
-		return typeFlags[p->type][type];
+	if (p->type != nullptr)
+		return p->type->isa(type);
 	else
 	else
 		return false;
 		return false;
 }
 }
@@ -717,7 +718,7 @@ extern "C" int luax_typerror(lua_State *L, int narg, const char *tname)
 
 
 			// Non-love userdata might have a type metamethod which doesn't
 			// Non-love userdata might have a type metamethod which doesn't
 			// describe its type properly, so we only use it for love types.
 			// describe its type properly, so we only use it for love types.
-			love::Type t;
+			uint32_t t;
 			if (!love::getTypeName(argtname, t))
 			if (!love::getTypeName(argtname, t))
 				argtname = 0;
 				argtname = 0;
 		}
 		}
@@ -752,9 +753,9 @@ void luax_register(lua_State *L, const char *name, const luaL_Reg *l)
 	}
 	}
 }
 }
 
 
-Type luax_type(lua_State *L, int idx)
+uint32_t luax_type(lua_State *L, int idx)
 {
 {
-	Type t = INVALID_ID;
+	uint32_t t = 0;
 	getTypeName(luaL_checkstring(L, idx), t);
 	getTypeName(luaL_checkstring(L, idx), t);
 	return t;
 	return t;
 }
 }

+ 18 - 18
src/common/runtime.h

@@ -62,7 +62,7 @@ enum Registry
 struct Proxy
 struct Proxy
 {
 {
 	// Holds type information (see types.h).
 	// Holds type information (see types.h).
-	Type type;
+	love::Type *type;
 
 
 	// Pointer to the actual object.
 	// Pointer to the actual object.
 	Object *object;
 	Object *object;
@@ -80,7 +80,7 @@ struct WrappedModule
 	const char *name;
 	const char *name;
 
 
 	// The type of this module.
 	// The type of this module.
-	love::Type type;
+	love::Type *type;
 
 
 	// The functions of the module (last element {0,0}).
 	// The functions of the module (last element {0,0}).
 	const luaL_Reg *functions;
 	const luaL_Reg *functions;
@@ -250,12 +250,12 @@ int luax_preload(lua_State *L, lua_CFunction f, const char *name);
  * @param name The type's human-readable name
  * @param name The type's human-readable name
  * @param ... The list of lists of member functions for the type. (of type luaL_Reg*)
  * @param ... The list of lists of member functions for the type. (of type luaL_Reg*)
  **/
  **/
-int luax_register_type(lua_State *L, love::Type type, const char *name, ...);
+int luax_register_type(lua_State *L, love::Type &type, const char *name, ...);
 
 
 /**
 /**
  * Pushes the metatable of the specified type onto the stack.
  * Pushes the metatable of the specified type onto the stack.
 **/
 **/
-void luax_gettypemetatable(lua_State *L, love::Type type);
+void luax_gettypemetatable(lua_State *L, love::Type &type);
 
 
 /**
 /**
  * Do a table.insert from C
  * Do a table.insert from C
@@ -283,7 +283,7 @@ int luax_register_searcher(lua_State *L, lua_CFunction f, int pos = -1);
  * @param type The type information of the object.
  * @param type The type information of the object.
  * @param object The pointer to the actual object.
  * @param object The pointer to the actual object.
  **/
  **/
-void luax_pushtype(lua_State *L, const love::Type type, love::Object *object);
+void luax_pushtype(lua_State *L, love::Type &type, love::Object *object);
 
 
 /**
 /**
  * Creates a new Lua representation of the given object *without* checking if it
  * Creates a new Lua representation of the given object *without* checking if it
@@ -296,7 +296,7 @@ void luax_pushtype(lua_State *L, const love::Type type, love::Object *object);
  * @param type The type information of the object.
  * @param type The type information of the object.
  * @param object The pointer to the actual object.
  * @param object The pointer to the actual object.
  **/
  **/
-void luax_rawnewtype(lua_State *L, love::Type type, love::Object *object);
+void luax_rawnewtype(lua_State *L, love::Type &type, love::Object *object);
 
 
 /**
 /**
  * Checks whether the value at idx is a certain type.
  * Checks whether the value at idx is a certain type.
@@ -305,7 +305,7 @@ void luax_rawnewtype(lua_State *L, love::Type type, love::Object *object);
  * @param type The type to check for.
  * @param type The type to check for.
  * @return True if the value is Proxy of the specified type, false otherwise.
  * @return True if the value is Proxy of the specified type, false otherwise.
  **/
  **/
-bool luax_istype(lua_State *L, int idx, love::Type type);
+bool luax_istype(lua_State *L, int idx, love::Type &type);
 
 
 /**
 /**
  * Gets the function love.module.function and puts it on top of the stack (alone). If the
  * Gets the function love.module.function and puts it on top of the stack (alone). If the
@@ -434,21 +434,21 @@ extern "C" { // Called by enet and luasocket
  * @param type The type bit.
  * @param type The type bit.
  **/
  **/
 template <typename T>
 template <typename T>
-T *luax_checktype(lua_State *L, int idx, love::Type type)
+T *luax_checktype(lua_State *L, int idx, love::Type &type)
 {
 {
 	if (lua_type(L, idx) != LUA_TUSERDATA)
 	if (lua_type(L, idx) != LUA_TUSERDATA)
 	{
 	{
 		const char *name = "Invalid";
 		const char *name = "Invalid";
-		getTypeName(type, name);
+		getTypeName(type.getId(), name);
 		luax_typerror(L, idx, name);
 		luax_typerror(L, idx, name);
 	}
 	}
 
 
 	Proxy *u = (Proxy *)lua_touserdata(L, idx);
 	Proxy *u = (Proxy *)lua_touserdata(L, idx);
 
 
-	if (u->type <= INVALID_ID || u->type >= TYPE_MAX_ENUM || !typeFlags[u->type][type])
+	if (u->type == nullptr || !u->type->isa(type))
 	{
 	{
 		const char *name = "Invalid";
 		const char *name = "Invalid";
-		getTypeName(type, name);
+		getTypeName(type.getId(), name);
 		luax_typerror(L, idx, name);
 		luax_typerror(L, idx, name);
 	}
 	}
 
 
@@ -459,10 +459,10 @@ T *luax_checktype(lua_State *L, int idx, love::Type type)
 }
 }
 
 
 template <typename T>
 template <typename T>
-T *luax_getmodule(lua_State *L, love::Type type)
+T *luax_getmodule(lua_State *L, love::Type &type)
 {
 {
 	const char *name = "Invalid";
 	const char *name = "Invalid";
-	getTypeName(type, name);
+	getTypeName(type.getId(), name);
 
 
 	luax_insistregistry(L, REGISTRY_MODULES);
 	luax_insistregistry(L, REGISTRY_MODULES);
 	lua_getfield(L, -1, name);
 	lua_getfield(L, -1, name);
@@ -472,7 +472,7 @@ T *luax_getmodule(lua_State *L, love::Type type)
 
 
 	Proxy *u = (Proxy *)lua_touserdata(L, -1);
 	Proxy *u = (Proxy *)lua_touserdata(L, -1);
 
 
-	if (u->type <= INVALID_ID || u->type >= TYPE_MAX_ENUM || !typeFlags[u->type][type])
+	if (u->type == nullptr || !u->type->isa(type))
 		luaL_error(L, "Incorrect module %s", name);
 		luaL_error(L, "Incorrect module %s", name);
 
 
 	lua_pop(L, 2);
 	lua_pop(L, 2);
@@ -481,10 +481,10 @@ T *luax_getmodule(lua_State *L, love::Type type)
 }
 }
 
 
 template <typename T>
 template <typename T>
-T *luax_optmodule(lua_State *L, love::Type type)
+T *luax_optmodule(lua_State *L, love::Type &type)
 {
 {
 	const char *name = "Invalid";
 	const char *name = "Invalid";
-	getTypeName(type, name);
+	getTypeName(type.getId(), name);
 
 
 	luax_insistregistry(L, REGISTRY_MODULES);
 	luax_insistregistry(L, REGISTRY_MODULES);
 	lua_getfield(L, -1, name);
 	lua_getfield(L, -1, name);
@@ -497,7 +497,7 @@ T *luax_optmodule(lua_State *L, love::Type type)
 
 
 	Proxy *u = (Proxy *)lua_touserdata(L, -1);
 	Proxy *u = (Proxy *)lua_touserdata(L, -1);
 
 
-	if (!typeFlags[u->type][type])
+	if (!u->type->isa(type))
 		luaL_error(L, "Incorrect module %s", name);
 		luaL_error(L, "Incorrect module %s", name);
 
 
 	lua_pop(L, 2);
 	lua_pop(L, 2);
@@ -524,7 +524,7 @@ T *luax_totype(lua_State *L, int idx, love::Type /*type*/)
 	return o;
 	return o;
 }
 }
 
 
-Type luax_type(lua_State *L, int idx);
+uint32_t luax_type(lua_State *L, int idx);
 
 
 /**
 /**
  * Converts any exceptions thrown by the passed lambda function into a Lua error.
  * Converts any exceptions thrown by the passed lambda function into a Lua error.

+ 59 - 101
src/common/types.cpp

@@ -24,120 +24,78 @@
 namespace love
 namespace love
 {
 {
 
 
-static const TypeBits *createTypeFlags()
-{
-	static TypeBits b[TYPE_MAX_ENUM];
-	TypeBits one = TypeBits(1);
-
-	b[INVALID_ID] = one << INVALID_ID;
-
-	b[OBJECT_ID] = one << OBJECT_ID;
-	b[DATA_ID] = (one << DATA_ID) | b[OBJECT_ID];
-	b[MODULE_ID] = (one << MODULE_ID) | b[OBJECT_ID];
-	b[STREAM_ID] = (one << STREAM_ID) | b[OBJECT_ID];
-
-	// Filesystem.
-	b[FILESYSTEM_FILE_ID] = (one << FILESYSTEM_FILE_ID) | b[OBJECT_ID];
-	b[FILESYSTEM_DROPPED_FILE_ID] = (one << FILESYSTEM_DROPPED_FILE_ID) | b[FILESYSTEM_FILE_ID];
-	b[FILESYSTEM_FILE_DATA_ID] = (one << FILESYSTEM_FILE_DATA_ID) | b[DATA_ID];
-
-	b[FONT_GLYPH_DATA_ID] = (one << FONT_GLYPH_DATA_ID) | b[DATA_ID];
-	b[FONT_RASTERIZER_ID] = (one << FONT_RASTERIZER_ID) | b[OBJECT_ID];
-
-	// Graphics.
-	b[GRAPHICS_DRAWABLE_ID] = (one << GRAPHICS_DRAWABLE_ID) | b[OBJECT_ID];
-	b[GRAPHICS_TEXTURE_ID] = (one << GRAPHICS_TEXTURE_ID) | b[GRAPHICS_DRAWABLE_ID];
-	b[GRAPHICS_IMAGE_ID] = (one << GRAPHICS_IMAGE_ID) | b[GRAPHICS_TEXTURE_ID];
-	b[GRAPHICS_QUAD_ID] = (one << GRAPHICS_QUAD_ID) | b[OBJECT_ID];
-	b[GRAPHICS_FONT_ID] = (one << GRAPHICS_FONT_ID) | b[OBJECT_ID];
-	b[GRAPHICS_PARTICLE_SYSTEM_ID] = (one << GRAPHICS_PARTICLE_SYSTEM_ID) | b[GRAPHICS_DRAWABLE_ID];
-	b[GRAPHICS_SPRITE_BATCH_ID] = (one << GRAPHICS_SPRITE_BATCH_ID) | b[GRAPHICS_DRAWABLE_ID];
-	b[GRAPHICS_CANVAS_ID] = (one << GRAPHICS_CANVAS_ID) | b[GRAPHICS_TEXTURE_ID];
-	b[GRAPHICS_SHADER_ID] = (one << GRAPHICS_SHADER_ID) | b[OBJECT_ID];
-	b[GRAPHICS_MESH_ID] = (one << GRAPHICS_MESH_ID) | b[GRAPHICS_DRAWABLE_ID];
-	b[GRAPHICS_TEXT_ID] = (one << GRAPHICS_TEXT_ID) | b[GRAPHICS_DRAWABLE_ID];
-	b[GRAPHICS_VIDEO_ID] = (one << GRAPHICS_VIDEO_ID) | b[GRAPHICS_DRAWABLE_ID];
-
-	// Image.
-	b[IMAGE_IMAGE_DATA_ID] = (one << IMAGE_IMAGE_DATA_ID) | b[DATA_ID];
-	b[IMAGE_COMPRESSED_IMAGE_DATA_ID] = (one << IMAGE_COMPRESSED_IMAGE_DATA_ID) | b[DATA_ID];
-
-	// Joystick.
-	b[JOYSTICK_JOYSTICK_ID] = (one << JOYSTICK_JOYSTICK_ID) | b[OBJECT_ID];
-
-	// Math.
-	b[MATH_RANDOM_GENERATOR_ID] = (one << MATH_RANDOM_GENERATOR_ID) | b[OBJECT_ID];
-	b[MATH_BEZIER_CURVE_ID] = (one << MATH_BEZIER_CURVE_ID) | b[OBJECT_ID];
-	b[MATH_COMPRESSED_DATA_ID] = (one <<MATH_COMPRESSED_DATA_ID) | b[DATA_ID];
-
-	// Audio.
-	b[AUDIO_SOURCE_ID] = (one << AUDIO_SOURCE_ID) | b[OBJECT_ID];
-
-	// Sound.
-	b[SOUND_SOUND_DATA_ID] = (one << SOUND_SOUND_DATA_ID) | b[DATA_ID];
-	b[SOUND_DECODER_ID] = one << SOUND_DECODER_ID;
-
-	// Mouse.
-	b[MOUSE_CURSOR_ID] = (one << MOUSE_CURSOR_ID) | b[OBJECT_ID];
-
-	// Physics.
-	b[PHYSICS_WORLD_ID] = (one << PHYSICS_WORLD_ID) | b[OBJECT_ID];
-	b[PHYSICS_CONTACT_ID] = (one << PHYSICS_CONTACT_ID) | b[OBJECT_ID];
-	b[PHYSICS_BODY_ID] = (one << PHYSICS_BODY_ID) | b[OBJECT_ID];
-	b[PHYSICS_FIXTURE_ID] = (one << PHYSICS_FIXTURE_ID) | b[OBJECT_ID];
-	b[PHYSICS_SHAPE_ID] = (one << PHYSICS_SHAPE_ID) | b[OBJECT_ID];
-	b[PHYSICS_CIRCLE_SHAPE_ID] = (one << PHYSICS_CIRCLE_SHAPE_ID) | b[PHYSICS_SHAPE_ID];
-	b[PHYSICS_POLYGON_SHAPE_ID] = (one << PHYSICS_POLYGON_SHAPE_ID) | b[PHYSICS_SHAPE_ID];
-	b[PHYSICS_EDGE_SHAPE_ID] = (one << PHYSICS_EDGE_SHAPE_ID) | b[PHYSICS_SHAPE_ID];
-	b[PHYSICS_CHAIN_SHAPE_ID] = (one << PHYSICS_CHAIN_SHAPE_ID) | b[PHYSICS_SHAPE_ID];
-	b[PHYSICS_JOINT_ID] = (one << PHYSICS_JOINT_ID) | b[OBJECT_ID];
-	b[PHYSICS_MOUSE_JOINT_ID] = (one << PHYSICS_MOUSE_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_DISTANCE_JOINT_ID] = (one << PHYSICS_DISTANCE_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_PRISMATIC_JOINT_ID] = (one << PHYSICS_PRISMATIC_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_REVOLUTE_JOINT_ID] = (one << PHYSICS_REVOLUTE_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_PULLEY_JOINT_ID] = (one << PHYSICS_PULLEY_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_GEAR_JOINT_ID] = (one << PHYSICS_GEAR_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_FRICTION_JOINT_ID] = (one << PHYSICS_FRICTION_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_WELD_JOINT_ID] = (one << PHYSICS_WELD_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_ROPE_JOINT_ID] = (one << PHYSICS_ROPE_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_WHEEL_JOINT_ID] = (one << PHYSICS_WHEEL_JOINT_ID) | b[PHYSICS_JOINT_ID];
-	b[PHYSICS_MOTOR_JOINT_ID] = (one << PHYSICS_MOTOR_JOINT_ID) | b[PHYSICS_JOINT_ID];
-
-	// Thread.
-	b[THREAD_THREAD_ID] = (one << THREAD_THREAD_ID) | b[OBJECT_ID];
-	b[THREAD_CHANNEL_ID] = (one << THREAD_CHANNEL_ID) | b[OBJECT_ID];
-
-	// Video
-	b[VIDEO_VIDEO_STREAM_ID] = (one << VIDEO_VIDEO_STREAM_ID) | b[STREAM_ID];
-
-	// Modules.
-	b[MODULE_FILESYSTEM_ID] = (one << MODULE_FILESYSTEM_ID) | b[MODULE_ID];
-	b[MODULE_GRAPHICS_ID] = (one << MODULE_GRAPHICS_ID) | b[MODULE_ID];
-	b[MODULE_IMAGE_ID] = (one << MODULE_IMAGE_ID) | b[MODULE_ID];
-	b[MODULE_SOUND_ID] = (one << MODULE_SOUND_ID) | b[MODULE_ID];
-
-	return b;
-}
-
-const TypeBits *typeFlags = createTypeFlags();
+static StringMap<uint32_t, love::Type::MAX_TYPES> types(nullptr, 0);
 
 
-static StringMap<Type, TYPE_MAX_ENUM> types(nullptr, 0);
-
-void addTypeName(Type type, const char *name)
+void addTypeName(uint32_t type, const char *name)
 {
 {
 	const char *n;
 	const char *n;
 	if (!types.find(type, n))
 	if (!types.find(type, n))
 		types.add(name, type);
 		types.add(name, type);
 }
 }
 
 
-bool getTypeName(const char *in, love::Type &out)
+bool getTypeName(const char *in, uint32_t &out)
 {
 {
 	return types.find(in, out);
 	return types.find(in, out);
 }
 }
 
 
-bool getTypeName(love::Type in, const char *&out)
+bool getTypeName(uint32_t in, const char *&out)
 {
 {
 	return types.find(in, out);
 	return types.find(in, out);
 }
 }
 
 
+uint32_t love::Type::nextId = 1;
+
+Type::Type(Type *parent)
+	: inited(false)
+	, parent(parent)
+{
+}
+
+void love::Type::init()
+{
+	id = nextId++;
+	bits[id] = true;
+	inited = true;
+
+	if (!parent)
+		return;
+	if (!parent->inited)
+		parent->init();
+	bits |= parent->bits;
+}
+
+uint32_t love::Type::getId()
+{
+	if (!inited)
+		init();
+	return id;
+}
+
+bool love::Type::isa(const uint32_t &other)
+{
+	if (!inited)
+		init();
+	return bits[other];
+}
+
+bool love::Type::isa(love::Type &other)
+{
+	if (!other.inited)
+		other.init();
+	return isa(other.id);
+}
+
 } // love
 } // love
+
+// FIXME: Move this to the relevant files
+#include "Data.h"
+#include "Stream.h"
+#include "graphics/Drawable.h"
+#include "filesystem/Filesystem.h"
+#include "image/Image.h"
+
+love::Type love::Data::type(&Object::type);
+love::Type love::Stream::type(&Object::type);
+love::Type love::graphics::Drawable::type(&Object::type);
+love::Type love::filesystem::Filesystem::type(&Module::type);
+love::Type love::image::Image::type(&Module::type);

+ 20 - 97
src/common/types.h

@@ -23,115 +23,38 @@
 
 
 // STD
 // STD
 #include <bitset>
 #include <bitset>
+#include <vector>
 
 
 namespace love
 namespace love
 {
 {
 
 
-enum Type
-{
-	INVALID_ID = 0,
-	// Cross-module types.
-	OBJECT_ID,
-	DATA_ID,
-	MODULE_ID,
-	STREAM_ID,
-
-	// Filesystem.
-	FILESYSTEM_FILE_ID,
-	FILESYSTEM_DROPPED_FILE_ID,
-	FILESYSTEM_FILE_DATA_ID,
-
-	// Font
-	FONT_GLYPH_DATA_ID,
-	FONT_RASTERIZER_ID,
-
-	// Graphics
-	GRAPHICS_DRAWABLE_ID,
-	GRAPHICS_TEXTURE_ID,
-	GRAPHICS_IMAGE_ID,
-	GRAPHICS_QUAD_ID,
-	GRAPHICS_FONT_ID,
-	GRAPHICS_PARTICLE_SYSTEM_ID,
-	GRAPHICS_SPRITE_BATCH_ID,
-	GRAPHICS_CANVAS_ID,
-	GRAPHICS_SHADER_ID,
-	GRAPHICS_MESH_ID,
-	GRAPHICS_TEXT_ID,
-	GRAPHICS_VIDEO_ID,
-
-	// Image
-	IMAGE_IMAGE_DATA_ID,
-	IMAGE_COMPRESSED_IMAGE_DATA_ID,
-
-	// Joystick
-	JOYSTICK_JOYSTICK_ID,
-
-	// Math
-	MATH_RANDOM_GENERATOR_ID,
-	MATH_BEZIER_CURVE_ID,
-	MATH_COMPRESSED_DATA_ID,
-
-	// Audio
-	AUDIO_SOURCE_ID,
+void addTypeName(uint32_t type, const char *name);
+bool getTypeName(const char *in, uint32_t &out);
+bool getTypeName(uint32_t in, const char *&out);
 
 
-	// Sound
-	SOUND_SOUND_DATA_ID,
-	SOUND_DECODER_ID,
-
-	// Mouse
-	MOUSE_CURSOR_ID,
+class Type
+{
+public:
+	static const uint32_t MAX_TYPES = 128;
 
 
-	// Physics
-	PHYSICS_WORLD_ID,
-	PHYSICS_CONTACT_ID,
-	PHYSICS_BODY_ID,
-	PHYSICS_FIXTURE_ID,
-	PHYSICS_SHAPE_ID,
-	PHYSICS_CIRCLE_SHAPE_ID,
-	PHYSICS_POLYGON_SHAPE_ID,
-	PHYSICS_EDGE_SHAPE_ID,
-	PHYSICS_CHAIN_SHAPE_ID,
-	PHYSICS_JOINT_ID,
-	PHYSICS_MOUSE_JOINT_ID,
-	PHYSICS_DISTANCE_JOINT_ID,
-	PHYSICS_PRISMATIC_JOINT_ID,
-	PHYSICS_REVOLUTE_JOINT_ID,
-	PHYSICS_PULLEY_JOINT_ID,
-	PHYSICS_GEAR_JOINT_ID,
-	PHYSICS_FRICTION_JOINT_ID,
-	PHYSICS_WELD_JOINT_ID,
-	PHYSICS_ROPE_JOINT_ID,
-	PHYSICS_WHEEL_JOINT_ID,
-	PHYSICS_MOTOR_JOINT_ID,
+	// TODO: Type-checking templated constructor
+	Type(Type *parent);
 
 
-	// Thread
-	THREAD_THREAD_ID,
-	THREAD_CHANNEL_ID,
+	uint32_t getId();
+	bool isa(const uint32_t &other);
+	bool isa(Type &other);
 
 
-	// Video
-	VIDEO_VIDEO_STREAM_ID,
+private:
+	static uint32_t nextId;
+	void init();
 
 
-	// The modules themselves. Only add abstracted modules here.
-	MODULE_FILESYSTEM_ID,
-	MODULE_GRAPHICS_ID,
-	MODULE_IMAGE_ID,
-	MODULE_SOUND_ID,
+	bool inited;
+	Type *parent;
 
 
-	// Count the number of bits needed.
-	TYPE_MAX_ENUM
+	uint32_t id;
+	std::bitset<MAX_TYPES> bits;
 };
 };
 
 
-typedef std::bitset<TYPE_MAX_ENUM> TypeBits;
-
-/**
- * Array of length TYPE_MAX_ENUM containing the flags for each love Type.
- **/
-extern const TypeBits *typeFlags;
-
-void addTypeName(Type type, const char *name);
-bool getTypeName(const char *in, Type &out);
-bool getTypeName(Type in, const char *&out);
-
 } // love
 } // love
 
 
 #endif // LOVE_TYPES_H
 #endif // LOVE_TYPES_H

+ 2 - 2
src/common/wrap_Data.cpp

@@ -25,7 +25,7 @@ namespace love
 
 
 Data *luax_checkdata(lua_State *L, int idx)
 Data *luax_checkdata(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Data>(L, idx, DATA_ID);
+	return luax_checktype<Data>(L, idx, Data::type);
 }
 }
 
 
 int w_Data_getString(lua_State *L)
 int w_Data_getString(lua_State *L)
@@ -59,7 +59,7 @@ const luaL_Reg w_Data_functions[] =
 
 
 int w_Data_open(lua_State *L)
 int w_Data_open(lua_State *L)
 {
 {
-	luax_register_type(L, DATA_ID, "Data", w_Data_functions, nullptr);
+	luax_register_type(L, Data::type, "Data", w_Data_functions, nullptr);
 	return 0;
 	return 0;
 }
 }
 
 

+ 5 - 3
src/modules/audio/Source.cpp

@@ -25,8 +25,10 @@ namespace love
 namespace audio
 namespace audio
 {
 {
 
 
-Source::Source(Type type)
-	: type(type)
+love::Type Source::type(&Object::type);
+
+Source::Source(Type sourceType)
+	: sourceType(sourceType)
 {
 {
 }
 }
 
 
@@ -36,7 +38,7 @@ Source::~Source()
 
 
 Source::Type Source::getType() const
 Source::Type Source::getType() const
 {
 {
-	return type;
+	return sourceType;
 }
 }
 
 
 bool Source::getConstant(const char *in, Type &out)
 bool Source::getConstant(const char *in, Type &out)

+ 3 - 1
src/modules/audio/Source.h

@@ -34,6 +34,8 @@ class Source : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	enum Type
 	enum Type
 	{
 	{
 		TYPE_STATIC,
 		TYPE_STATIC,
@@ -114,7 +116,7 @@ public:
 
 
 protected:
 protected:
 
 
-	Type type;
+	Type sourceType;
 
 
 private:
 private:
 
 

+ 18 - 18
src/modules/audio/openal/Source.cpp

@@ -178,7 +178,7 @@ Source::Source(Pool *pool, int sampleRate, int bitDepth, int channels)
 }
 }
 
 
 Source::Source(const Source &s)
 Source::Source(const Source &s)
-	: love::audio::Source(s.type)
+	: love::audio::Source(s.sourceType)
 	, pool(s.pool)
 	, pool(s.pool)
 	, valid(false)
 	, valid(false)
 	, staticBuffer(s.staticBuffer)
 	, staticBuffer(s.staticBuffer)
@@ -199,14 +199,14 @@ Source::Source(const Source &s)
 	, bitDepth(s.bitDepth)
 	, bitDepth(s.bitDepth)
 	, decoder(nullptr)
 	, decoder(nullptr)
 	, toLoop(0)
 	, toLoop(0)
-	, unusedBufferTop(s.type == TYPE_STREAM ? MAX_BUFFERS - 1 : -1)
+	, unusedBufferTop(s.sourceType == TYPE_STREAM ? MAX_BUFFERS - 1 : -1)
 {
 {
-	if (type == TYPE_STREAM)
+	if (sourceType == TYPE_STREAM)
 	{
 	{
 		if (s.decoder.get())
 		if (s.decoder.get())
 			decoder.set(s.decoder->clone(), Acquire::NORETAIN);
 			decoder.set(s.decoder->clone(), Acquire::NORETAIN);
 	}
 	}
-	if (type != TYPE_STATIC)
+	if (sourceType != TYPE_STATIC)
 	{
 	{
 		alGenBuffers(MAX_BUFFERS, streamBuffers);
 		alGenBuffers(MAX_BUFFERS, streamBuffers);
 		for (unsigned int i = 0; i < MAX_BUFFERS; i++)
 		for (unsigned int i = 0; i < MAX_BUFFERS; i++)
@@ -223,7 +223,7 @@ Source::~Source()
 	if (valid)
 	if (valid)
 		pool->stop(this);
 		pool->stop(this);
 
 
-	if (type != TYPE_STATIC)
+	if (sourceType != TYPE_STATIC)
 		alDeleteBuffers(MAX_BUFFERS, streamBuffers);
 		alDeleteBuffers(MAX_BUFFERS, streamBuffers);
 }
 }
 
 
@@ -264,7 +264,7 @@ bool Source::isFinished() const
 	if (!valid)
 	if (!valid)
 		return false;
 		return false;
 
 
-	if (type == TYPE_STREAM && (isLooping() || !decoder->isFinished()))
+	if (sourceType == TYPE_STREAM && (isLooping() || !decoder->isFinished()))
 		return false;
 		return false;
 
 
 	ALenum state;
 	ALenum state;
@@ -277,7 +277,7 @@ bool Source::update()
 	if (!valid)
 	if (!valid)
 		return false;
 		return false;
 
 
-	switch (type)
+	switch (sourceType)
 	{
 	{
 		case TYPE_STATIC:
 		case TYPE_STATIC:
 			// Looping mode could have changed.
 			// Looping mode could have changed.
@@ -401,7 +401,7 @@ void Source::seekAtomic(float offset, void *unit)
 		break;
 		break;
 	}
 	}
 
 
-	switch (type)
+	switch (sourceType)
 	{
 	{
 		case TYPE_STATIC:
 		case TYPE_STATIC:
 			alSourcef(source, AL_SAMPLE_OFFSET, offsetSamples);
 			alSourcef(source, AL_SAMPLE_OFFSET, offsetSamples);
@@ -494,7 +494,7 @@ double Source::getDurationAtomic(void *vunit)
 {
 {
 	Unit unit = *(Unit *) vunit;
 	Unit unit = *(Unit *) vunit;
 
 
-	switch (type)
+	switch (sourceType)
 	{
 	{
 		case TYPE_STATIC:
 		case TYPE_STATIC:
 		{
 		{
@@ -649,10 +649,10 @@ bool Source::isRelative() const
 
 
 void Source::setLooping(bool enable)
 void Source::setLooping(bool enable)
 {
 {
-	if (type == TYPE_QUEUE)
+	if (sourceType == TYPE_QUEUE)
 		throw QueueLoopingException();
 		throw QueueLoopingException();
 
 
-	if (valid && type == TYPE_STATIC)
+	if (valid && sourceType == TYPE_STATIC)
 		alSourcei(source, AL_LOOPING, enable ? AL_TRUE : AL_FALSE);
 		alSourcei(source, AL_LOOPING, enable ? AL_TRUE : AL_FALSE);
 
 
 	looping = enable;
 	looping = enable;
@@ -665,7 +665,7 @@ bool Source::isLooping() const
 
 
 bool Source::queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels)
 bool Source::queue(void *data, size_t length, int dataSampleRate, int dataBitDepth, int dataChannels)
 {
 {
-	if (type != TYPE_QUEUE)
+	if (sourceType != TYPE_QUEUE)
 		throw QueueTypeMismatchException();
 		throw QueueTypeMismatchException();
 
 
 	if (dataSampleRate != sampleRate || dataBitDepth != bitDepth || dataChannels != channels )
 	if (dataSampleRate != sampleRate || dataBitDepth != bitDepth || dataChannels != channels )
@@ -709,7 +709,7 @@ bool Source::queueAtomic(void *data, ALsizei length)
 
 
 int Source::getFreeBufferCount() const
 int Source::getFreeBufferCount() const
 {
 {
-	switch (type) //why not :^)
+	switch (sourceType) //why not :^)
 	{
 	{
 		case TYPE_STATIC: 
 		case TYPE_STATIC: 
 			return 0;
 			return 0;
@@ -730,7 +730,7 @@ void Source::prepareAtomic()
 	// of the new one.
 	// of the new one.
 	reset();
 	reset();
 
 
-	switch (type)
+	switch (sourceType)
 	{
 	{
 		case TYPE_STATIC:
 		case TYPE_STATIC:
 			alSourcei(source, AL_BUFFER, staticBuffer->getBuffer());
 			alSourcei(source, AL_BUFFER, staticBuffer->getBuffer());
@@ -771,7 +771,7 @@ void Source::prepareAtomic()
 
 
 void Source::teardownAtomic()
 void Source::teardownAtomic()
 {
 {
-	switch (type)
+	switch (sourceType)
 	{
 	{
 		case TYPE_STATIC:
 		case TYPE_STATIC:
 			alSourcef(source, AL_SAMPLE_OFFSET, 0);
 			alSourcef(source, AL_SAMPLE_OFFSET, 0);
@@ -839,7 +839,7 @@ bool Source::playAtomic(ALuint source)
 	valid = true; //if it fails it will be set to false again
 	valid = true; //if it fails it will be set to false again
 	//but this prevents a horrible, horrible bug
 	//but this prevents a horrible, horrible bug
 
 
-	if (type != TYPE_STREAM)
+	if (sourceType != TYPE_STREAM)
 		offsetSamples = offsetSeconds = 0;
 		offsetSamples = offsetSeconds = 0;
 
 
 	return success;
 	return success;
@@ -891,7 +891,7 @@ bool Source::playAtomic(const std::vector<love::audio::Source*> &sources, const
 		Source *source = (Source*) _source;
 		Source *source = (Source*) _source;
 		source->valid = source->valid || success;
 		source->valid = source->valid || success;
 
 
-		if (success && source->type != TYPE_STREAM)
+		if (success && source->sourceType != TYPE_STREAM)
 			source->offsetSamples = source->offsetSeconds = 0;
 			source->offsetSamples = source->offsetSeconds = 0;
 	}
 	}
 
 
@@ -952,7 +952,7 @@ void Source::reset()
 	alSourcef(source, AL_REFERENCE_DISTANCE, referenceDistance);
 	alSourcef(source, AL_REFERENCE_DISTANCE, referenceDistance);
 	alSourcef(source, AL_ROLLOFF_FACTOR, rolloffFactor);
 	alSourcef(source, AL_ROLLOFF_FACTOR, rolloffFactor);
 	alSourcef(source, AL_MAX_DISTANCE, maxDistance);
 	alSourcef(source, AL_MAX_DISTANCE, maxDistance);
-	alSourcei(source, AL_LOOPING, (type == TYPE_STATIC) && isLooping() ? AL_TRUE : AL_FALSE);
+	alSourcei(source, AL_LOOPING, (sourceType == TYPE_STATIC) && isLooping() ? AL_TRUE : AL_FALSE);
 	alSourcei(source, AL_SOURCE_RELATIVE, relative ? AL_TRUE : AL_FALSE);
 	alSourcei(source, AL_SOURCE_RELATIVE, relative ? AL_TRUE : AL_FALSE);
 	alSourcei(source, AL_CONE_INNER_ANGLE, cone.innerAngle);
 	alSourcei(source, AL_CONE_INNER_ANGLE, cone.innerAngle);
 	alSourcei(source, AL_CONE_OUTER_ANGLE, cone.outerAngle);
 	alSourcei(source, AL_CONE_OUTER_ANGLE, cone.outerAngle);

+ 13 - 13
src/modules/audio/wrap_Audio.cpp

@@ -46,31 +46,31 @@ int w_newSource(lua_State *L)
 {
 {
 	Source::Type stype = Source::TYPE_STREAM;
 	Source::Type stype = Source::TYPE_STREAM;
 
 
-	if (!luax_istype(L, 1, SOUND_SOUND_DATA_ID) && !luax_istype(L, 1, SOUND_DECODER_ID))
+	if (!luax_istype(L, 1, love::sound::SoundData::type) && !luax_istype(L, 1, love::sound::Decoder::type))
 	{
 	{
 		const char *stypestr = luaL_checkstring(L, 2);
 		const char *stypestr = luaL_checkstring(L, 2);
 		if (stypestr && !Source::getConstant(stypestr, stype))
 		if (stypestr && !Source::getConstant(stypestr, stype))
 			return luaL_error(L, "Invalid source type: %s", stypestr);
 			return luaL_error(L, "Invalid source type: %s", stypestr);
 	}
 	}
 
 
-	if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_ID) || luax_istype(L, 1, FILESYSTEM_FILE_DATA_ID))
+	if (lua_isstring(L, 1) || luax_istype(L, 1, love::filesystem::File::type) || luax_istype(L, 1, love::filesystem::FileData::type))
 		luax_convobj(L, 1, "sound", "newDecoder");
 		luax_convobj(L, 1, "sound", "newDecoder");
 
 
-	if (stype == Source::TYPE_STATIC && luax_istype(L, 1, SOUND_DECODER_ID))
+	if (stype == Source::TYPE_STATIC && luax_istype(L, 1, love::sound::Decoder::type))
 		luax_convobj(L, 1, "sound", "newSoundData");
 		luax_convobj(L, 1, "sound", "newSoundData");
 
 
 	Source *t = nullptr;
 	Source *t = nullptr;
 
 
 	luax_catchexcept(L, [&]() {
 	luax_catchexcept(L, [&]() {
-		if (luax_istype(L, 1, SOUND_SOUND_DATA_ID))
-			t = instance()->newSource(luax_totype<love::sound::SoundData>(L, 1, SOUND_SOUND_DATA_ID));
-		else if (luax_istype(L, 1, SOUND_DECODER_ID))
-			t = instance()->newSource(luax_totype<love::sound::Decoder>(L, 1, SOUND_DECODER_ID));
+		if (luax_istype(L, 1, love::sound::SoundData::type))
+			t = instance()->newSource(luax_totype<love::sound::SoundData>(L, 1, love::sound::SoundData::type));
+		else if (luax_istype(L, 1, love::sound::Decoder::type))
+			t = instance()->newSource(luax_totype<love::sound::Decoder>(L, 1, love::sound::Decoder::type));
 	});
 	});
 
 
 	if (t != nullptr)
 	if (t != nullptr)
 	{
 	{
-		luax_pushtype(L, AUDIO_SOURCE_ID, t);
+		luax_pushtype(L, love::audio::Source::type, t);
 		t->release();
 		t->release();
 		return 1;
 		return 1;
 	}
 	}
@@ -88,7 +88,7 @@ int w_newQueueableSource(lua_State *L)
 
 
 	if (t != nullptr)
 	if (t != nullptr)
 	{
 	{
-		luax_pushtype(L, AUDIO_SOURCE_ID, t);
+		luax_pushtype(L, love::audio::Source::type, t);
 		t->release();
 		t->release();
 		return 1;
 		return 1;
 	}
 	}
@@ -150,7 +150,7 @@ int w_pause(lua_State *L)
 		lua_createtable(L, (int) sources.size(), 0);
 		lua_createtable(L, (int) sources.size(), 0);
 		for (int i = 0; i < (int) sources.size(); i++)
 		for (int i = 0; i < (int) sources.size(); i++)
 		{
 		{
-			luax_pushtype(L, AUDIO_SOURCE_ID, sources[i]);
+			luax_pushtype(L, love::audio::Source::type, sources[i]);
 			lua_rawseti(L, -2, i+1);
 			lua_rawseti(L, -2, i+1);
 		}
 		}
 		return 1;
 		return 1;
@@ -270,7 +270,7 @@ int w_getRecordedData(lua_State *L)
 		lua_pushnil(L);
 		lua_pushnil(L);
 	else
 	else
 	{
 	{
-		luax_pushtype(L, SOUND_SOUND_DATA_ID, sd);
+		luax_pushtype(L, love::sound::SoundData::type, sd);
 		sd->release();
 		sd->release();
 	}
 	}
 	return 1;
 	return 1;
@@ -285,7 +285,7 @@ int w_stopRecording(lua_State *L)
 			lua_pushnil(L);
 			lua_pushnil(L);
 		else
 		else
 		{
 		{
-			luax_pushtype(L, SOUND_SOUND_DATA_ID, sd);
+			luax_pushtype(L, love::sound::SoundData::type, sd);
 			sd->release();
 			sd->release();
 		}
 		}
 		return 1;
 		return 1;
@@ -395,7 +395,7 @@ extern "C" int luaopen_love_audio(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = instance;
 	w.module = instance;
 	w.name = "audio";
 	w.name = "audio";
-	w.type = MODULE_ID;
+	w.type = &Module::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = types;
 	w.types = types;
 
 

+ 5 - 5
src/modules/audio/wrap_Source.cpp

@@ -30,7 +30,7 @@ namespace audio
 
 
 Source *luax_checksource(lua_State *L, int idx)
 Source *luax_checksource(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Source>(L, idx, AUDIO_SOURCE_ID);
+	return luax_checktype<Source>(L, idx, love::audio::Source::type);
 }
 }
 
 
 int w_Source_clone(lua_State *L)
 int w_Source_clone(lua_State *L)
@@ -38,7 +38,7 @@ int w_Source_clone(lua_State *L)
 	Source *t = luax_checksource(L, 1);
 	Source *t = luax_checksource(L, 1);
 	Source *clone = nullptr;
 	Source *clone = nullptr;
 	luax_catchexcept(L, [&](){ clone = t->clone(); });
 	luax_catchexcept(L, [&](){ clone = t->clone(); });
-	luax_pushtype(L, AUDIO_SOURCE_ID, clone);
+	luax_pushtype(L, love::audio::Source::type, clone);
 	clone->release();
 	clone->release();
 	return 1;
 	return 1;
 }
 }
@@ -342,9 +342,9 @@ int w_Source_queue(lua_State *L)
 	Source *t = luax_checksource(L, 1);
 	Source *t = luax_checksource(L, 1);
 	bool success;
 	bool success;
 
 
-	if (luax_istype(L, 2, SOUND_SOUND_DATA_ID))
+	if (luax_istype(L, 2, love::sound::SoundData::type))
 	{
 	{
-		auto s = luax_totype<love::sound::SoundData>(L, 2, SOUND_SOUND_DATA_ID);
+		auto s = luax_totype<love::sound::SoundData>(L, 2, love::sound::SoundData::type);
 
 
 		int offset = 0;
 		int offset = 0;
 		size_t length = s->getSize();
 		size_t length = s->getSize();
@@ -450,7 +450,7 @@ static const luaL_Reg w_Source_functions[] =
 
 
 extern "C" int luaopen_source(lua_State *L)
 extern "C" int luaopen_source(lua_State *L)
 {
 {
-	return luax_register_type(L, AUDIO_SOURCE_ID, "Source", w_Source_functions, nullptr);
+	return luax_register_type(L, love::audio::Source::type, "Source", w_Source_functions, nullptr);
 }
 }
 
 
 } // audio
 } // audio

+ 8 - 8
src/modules/event/sdl/Event.cpp

@@ -364,7 +364,7 @@ Message *Event::convert(const SDL_Event &e) const
 			{
 			{
 				Proxy proxy;
 				Proxy proxy;
 				proxy.object = new love::filesystem::DroppedFile(e.drop.file);
 				proxy.object = new love::filesystem::DroppedFile(e.drop.file);
-				proxy.type = FILESYSTEM_DROPPED_FILE_ID;
+				proxy.type = &love::filesystem::DroppedFile::type;
 				vargs.emplace_back(proxy.type, &proxy);
 				vargs.emplace_back(proxy.type, &proxy);
 				msg = new Message("filedropped", vargs);
 				msg = new Message("filedropped", vargs);
 				proxy.object->release();
 				proxy.object->release();
@@ -407,7 +407,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
 	{
 	{
 	case SDL_JOYBUTTONDOWN:
 	case SDL_JOYBUTTONDOWN:
 	case SDL_JOYBUTTONUP:
 	case SDL_JOYBUTTONUP:
-		proxy.type = JOYSTICK_JOYSTICK_ID;
+		proxy.type = &love::joystick::Joystick::type;
 		proxy.object = joymodule->getJoystickFromID(e.jbutton.which);
 		proxy.object = joymodule->getJoystickFromID(e.jbutton.which);
 		if (!proxy.object)
 		if (!proxy.object)
 			break;
 			break;
@@ -420,7 +420,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
 		break;
 		break;
 	case SDL_JOYAXISMOTION:
 	case SDL_JOYAXISMOTION:
 		{
 		{
-			proxy.type = JOYSTICK_JOYSTICK_ID;
+			proxy.type = &love::joystick::Joystick::type;
 			proxy.object = joymodule->getJoystickFromID(e.jaxis.which);
 			proxy.object = joymodule->getJoystickFromID(e.jaxis.which);
 			if (!proxy.object)
 			if (!proxy.object)
 				break;
 				break;
@@ -436,7 +436,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
 		if (!joystick::sdl::Joystick::getConstant(e.jhat.value, hat) || !joystick::Joystick::getConstant(hat, txt))
 		if (!joystick::sdl::Joystick::getConstant(e.jhat.value, hat) || !joystick::Joystick::getConstant(hat, txt))
 			break;
 			break;
 
 
-		proxy.type = JOYSTICK_JOYSTICK_ID;
+		proxy.type = &love::joystick::Joystick::type;
 		proxy.object = joymodule->getJoystickFromID(e.jhat.which);
 		proxy.object = joymodule->getJoystickFromID(e.jhat.which);
 		if (!proxy.object)
 		if (!proxy.object)
 			break;
 			break;
@@ -454,7 +454,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
 		if (!joystick::Joystick::getConstant(padbutton, txt))
 		if (!joystick::Joystick::getConstant(padbutton, txt))
 			break;
 			break;
 
 
-		proxy.type = JOYSTICK_JOYSTICK_ID;
+		proxy.type = &love::joystick::Joystick::type;
 		proxy.object = joymodule->getJoystickFromID(e.cbutton.which);
 		proxy.object = joymodule->getJoystickFromID(e.cbutton.which);
 		if (!proxy.object)
 		if (!proxy.object)
 			break;
 			break;
@@ -470,7 +470,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
 			if (!joystick::Joystick::getConstant(padaxis, txt))
 			if (!joystick::Joystick::getConstant(padaxis, txt))
 				break;
 				break;
 
 
-			proxy.type = JOYSTICK_JOYSTICK_ID;
+			proxy.type = &love::joystick::Joystick::type;
 			proxy.object = joymodule->getJoystickFromID(e.caxis.which);
 			proxy.object = joymodule->getJoystickFromID(e.caxis.which);
 			if (!proxy.object)
 			if (!proxy.object)
 				break;
 				break;
@@ -486,7 +486,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
 	case SDL_JOYDEVICEADDED:
 	case SDL_JOYDEVICEADDED:
 		// jdevice.which is the joystick device index.
 		// jdevice.which is the joystick device index.
 		proxy.object = joymodule->addJoystick(e.jdevice.which);
 		proxy.object = joymodule->addJoystick(e.jdevice.which);
-		proxy.type = JOYSTICK_JOYSTICK_ID;
+		proxy.type = &love::joystick::Joystick::type;
 		if (proxy.object)
 		if (proxy.object)
 		{
 		{
 			vargs.emplace_back(proxy.type, (void *) &proxy);
 			vargs.emplace_back(proxy.type, (void *) &proxy);
@@ -496,7 +496,7 @@ Message *Event::convertJoystickEvent(const SDL_Event &e) const
 	case SDL_JOYDEVICEREMOVED:
 	case SDL_JOYDEVICEREMOVED:
 		// jdevice.which is the joystick instance ID now.
 		// jdevice.which is the joystick instance ID now.
 		proxy.object = joymodule->getJoystickFromID(e.jdevice.which);
 		proxy.object = joymodule->getJoystickFromID(e.jdevice.which);
-		proxy.type = JOYSTICK_JOYSTICK_ID;
+		proxy.type = &love::joystick::Joystick::type;
 		if (proxy.object)
 		if (proxy.object)
 		{
 		{
 			joymodule->removeJoystick((joystick::Joystick *) proxy.object);
 			joymodule->removeJoystick((joystick::Joystick *) proxy.object);

+ 1 - 1
src/modules/event/wrap_Event.cpp

@@ -127,7 +127,7 @@ extern "C" int luaopen_love_event(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = instance;
 	w.module = instance;
 	w.name = "event";
 	w.name = "event";
-	w.type = MODULE_ID;
+	w.type = &Module::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = nullptr;
 	w.types = nullptr;
 
 

+ 2 - 0
src/modules/filesystem/DroppedFile.cpp

@@ -37,6 +37,8 @@ namespace love
 namespace filesystem
 namespace filesystem
 {
 {
 
 
+love::Type DroppedFile::type(&File::type);
+
 DroppedFile::DroppedFile(const std::string &filename)
 DroppedFile::DroppedFile(const std::string &filename)
 	: filename(filename)
 	: filename(filename)
 	, file(nullptr)
 	, file(nullptr)

+ 2 - 0
src/modules/filesystem/DroppedFile.h

@@ -41,6 +41,8 @@ class DroppedFile : public File
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	DroppedFile(const std::string &filename);
 	DroppedFile(const std::string &filename);
 	virtual ~DroppedFile();
 	virtual ~DroppedFile();
 
 

+ 2 - 0
src/modules/filesystem/File.cpp

@@ -25,6 +25,8 @@ namespace love
 namespace filesystem
 namespace filesystem
 {
 {
 
 
+love::Type File::type(&Object::type);
+
 File::~File()
 File::~File()
 {
 {
 }
 }

+ 2 - 0
src/modules/filesystem/File.h

@@ -44,6 +44,8 @@ class File : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	/**
 	/**
 	 * File open mode.
 	 * File open mode.
 	 **/
 	 **/

+ 2 - 0
src/modules/filesystem/FileData.cpp

@@ -29,6 +29,8 @@ namespace love
 namespace filesystem
 namespace filesystem
 {
 {
 
 
+love::Type FileData::type(&Data::type);
+
 FileData::FileData(uint64 size, const std::string &filename)
 FileData::FileData(uint64 size, const std::string &filename)
 	: data(nullptr)
 	: data(nullptr)
 	, size((size_t) size)
 	, size((size_t) size)

+ 2 - 0
src/modules/filesystem/FileData.h

@@ -37,6 +37,8 @@ class FileData : public Data
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	FileData(uint64 size, const std::string &filename);
 	FileData(uint64 size, const std::string &filename);
 
 
 	virtual ~FileData();
 	virtual ~FileData();

+ 2 - 0
src/modules/filesystem/Filesystem.h

@@ -61,6 +61,8 @@ class Filesystem : public Module
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	Filesystem();
 	Filesystem();
 	virtual ~Filesystem();
 	virtual ~Filesystem();
 
 

+ 2 - 2
src/modules/filesystem/wrap_DroppedFile.cpp

@@ -28,12 +28,12 @@ namespace filesystem
 
 
 DroppedFile *luax_checkdroppedfile(lua_State *L, int idx)
 DroppedFile *luax_checkdroppedfile(lua_State *L, int idx)
 {
 {
-	return luax_checktype<DroppedFile>(L, idx, FILESYSTEM_DROPPED_FILE_ID);
+	return luax_checktype<DroppedFile>(L, idx, DroppedFile::type);
 }
 }
 
 
 extern "C" int luaopen_droppedfile(lua_State *L)
 extern "C" int luaopen_droppedfile(lua_State *L)
 {
 {
-	return luax_register_type(L, FILESYSTEM_DROPPED_FILE_ID, "DroppedFile", w_File_functions, nullptr);
+	return luax_register_type(L, DroppedFile::type, "DroppedFile", w_File_functions, nullptr);
 }
 }
 
 
 } // filesystem
 } // filesystem

+ 5 - 5
src/modules/filesystem/wrap_File.cpp

@@ -43,7 +43,7 @@ int luax_ioError(lua_State *L, const char *fmt, ...)
 
 
 File *luax_checkfile(lua_State *L, int idx)
 File *luax_checkfile(lua_State *L, int idx)
 {
 {
-	return luax_checktype<File>(L, idx, FILESYSTEM_FILE_ID);
+	return luax_checktype<File>(L, idx, love::filesystem::File::type);
 }
 }
 
 
 int w_File_getSize(lua_State *L)
 int w_File_getSize(lua_State *L)
@@ -148,11 +148,11 @@ int w_File_write(lua_State *L)
 			return luax_ioError(L, "%s", e.what());
 			return luax_ioError(L, "%s", e.what());
 		}
 		}
 	}
 	}
-	else if (luax_istype(L, 2, DATA_ID))
+	else if (luax_istype(L, 2, love::Data::type))
 	{
 	{
 		try
 		try
 		{
 		{
-			love::Data *data = luax_totype<love::Data>(L, 2, DATA_ID);
+			love::Data *data = luax_totype<love::Data>(L, 2, love::Data::type);
 			result = file->write(data, luaL_optinteger(L, 3, data->getSize()));
 			result = file->write(data, luaL_optinteger(L, 3, data->getSize()));
 		}
 		}
 		catch (love::Exception &e)
 		catch (love::Exception &e)
@@ -227,7 +227,7 @@ int w_File_lines_i(lua_State *L)
 	int linesize = 0;
 	int linesize = 0;
 	bool newline = false;
 	bool newline = false;
 
 
-	File *file = luax_checktype<File>(L, lua_upvalueindex(1), FILESYSTEM_FILE_ID);
+	File *file = luax_checktype<File>(L, lua_upvalueindex(1), File::type);
 
 
 	// Only accept read mode at this point.
 	// Only accept read mode at this point.
 	if (file->getMode() != File::MODE_READ)
 	if (file->getMode() != File::MODE_READ)
@@ -435,7 +435,7 @@ const luaL_Reg w_File_functions[] =
 
 
 extern "C" int luaopen_file(lua_State *L)
 extern "C" int luaopen_file(lua_State *L)
 {
 {
-	return luax_register_type(L, FILESYSTEM_FILE_ID, "File", w_File_functions, nullptr);
+	return luax_register_type(L, File::type, "File", w_File_functions, nullptr);
 }
 }
 
 
 } // filesystem
 } // filesystem

+ 2 - 2
src/modules/filesystem/wrap_FileData.cpp

@@ -29,7 +29,7 @@ namespace filesystem
 
 
 FileData *luax_checkfiledata(lua_State *L, int idx)
 FileData *luax_checkfiledata(lua_State *L, int idx)
 {
 {
-	return luax_checktype<FileData>(L, idx, FILESYSTEM_FILE_DATA_ID);
+	return luax_checktype<FileData>(L, idx, FileData::type);
 }
 }
 
 
 int w_FileData_getFilename(lua_State *L)
 int w_FileData_getFilename(lua_State *L)
@@ -56,7 +56,7 @@ static const luaL_Reg w_FileData_functions[] =
 
 
 extern "C" int luaopen_filedata(lua_State *L)
 extern "C" int luaopen_filedata(lua_State *L)
 {
 {
-	return luax_register_type(L, FILESYSTEM_FILE_DATA_ID, "FileData", w_Data_functions, w_FileData_functions, nullptr);
+	return luax_register_type(L, FileData::type, "FileData", w_Data_functions, w_FileData_functions, nullptr);
 }
 }
 
 
 } // filesystem
 } // filesystem

+ 13 - 13
src/modules/filesystem/wrap_Filesystem.cpp

@@ -113,9 +113,9 @@ int w_mount(lua_State *L)
 {
 {
 	std::string archive;
 	std::string archive;
 
 
-	if (luax_istype(L, 1, FILESYSTEM_DROPPED_FILE_ID))
+	if (luax_istype(L, 1, DroppedFile::type))
 	{
 	{
-		DroppedFile *file = luax_totype<DroppedFile>(L, 1, FILESYSTEM_DROPPED_FILE_ID);
+		DroppedFile *file = luax_totype<DroppedFile>(L, 1, DroppedFile::type);
 		archive = file->getFilename();
 		archive = file->getFilename();
 	}
 	}
 	else
 	else
@@ -166,7 +166,7 @@ int w_newFile(lua_State *L)
 		}
 		}
 	}
 	}
 
 
-	luax_pushtype(L, FILESYSTEM_FILE_ID, t);
+	luax_pushtype(L, File::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -190,12 +190,12 @@ FileData *luax_getfiledata(lua_State *L, int idx)
 	FileData *data = nullptr;
 	FileData *data = nullptr;
 	File *file = nullptr;
 	File *file = nullptr;
 
 
-	if (lua_isstring(L, idx) || luax_istype(L, idx, FILESYSTEM_FILE_ID))
+	if (lua_isstring(L, idx) || luax_istype(L, idx, File::type))
 	{
 	{
 		file = luax_getfile(L, idx);
 		file = luax_getfile(L, idx);
 		file->retain();
 		file->retain();
 	}
 	}
-	else if (luax_istype(L, idx, FILESYSTEM_FILE_DATA_ID))
+	else if (luax_istype(L, idx, FileData::type))
 	{
 	{
 		data = luax_checkfiledata(L, idx);
 		data = luax_checkfiledata(L, idx);
 		data->retain();
 		data->retain();
@@ -220,7 +220,7 @@ FileData *luax_getfiledata(lua_State *L, int idx)
 
 
 bool luax_cangetfiledata(lua_State *L, int idx)
 bool luax_cangetfiledata(lua_State *L, int idx)
 {
 {
-	return lua_isstring(L, idx) || luax_istype(L, idx, FILESYSTEM_FILE_ID) || luax_istype(L, idx, FILESYSTEM_FILE_DATA_ID);
+	return lua_isstring(L, idx) || luax_istype(L, idx, File::type) || luax_istype(L, idx, FileData::type);
 }
 }
 
 
 int w_newFileData(lua_State *L)
 int w_newFileData(lua_State *L)
@@ -233,7 +233,7 @@ int w_newFileData(lua_State *L)
 			luax_convobj(L, 1, "filesystem", "newFile");
 			luax_convobj(L, 1, "filesystem", "newFile");
 
 
 		// Get FileData from the File.
 		// Get FileData from the File.
-		if (luax_istype(L, 1, FILESYSTEM_FILE_ID))
+		if (luax_istype(L, 1, File::type))
 		{
 		{
 			File *file = luax_checkfile(L, 1);
 			File *file = luax_checkfile(L, 1);
 
 
@@ -246,7 +246,7 @@ int w_newFileData(lua_State *L)
 			{
 			{
 				return luax_ioError(L, "%s", e.what());
 				return luax_ioError(L, "%s", e.what());
 			}
 			}
-			luax_pushtype(L, FILESYSTEM_FILE_DATA_ID, data);
+			luax_pushtype(L, FileData::type, data);
 			return 1;
 			return 1;
 		}
 		}
 		else
 		else
@@ -260,7 +260,7 @@ int w_newFileData(lua_State *L)
 	FileData *t = nullptr;
 	FileData *t = nullptr;
 	luax_catchexcept(L, [&](){ t = instance()->newFileData(str, length, filename); });
 	luax_catchexcept(L, [&](){ t = instance()->newFileData(str, length, filename); });
 
 
-	luax_pushtype(L, FILESYSTEM_FILE_DATA_ID, t);
+	luax_pushtype(L, FileData::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -398,9 +398,9 @@ static int w_write_or_append(lua_State *L, File::Mode mode)
 	const char *input = 0;
 	const char *input = 0;
 	size_t len = 0;
 	size_t len = 0;
 
 
-	if (luax_istype(L, 2, DATA_ID))
+	if (luax_istype(L, 2, love::Data::type))
 	{
 	{
-		love::Data *data = luax_totype<love::Data>(L, 2, DATA_ID);
+		love::Data *data = luax_totype<love::Data>(L, 2, love::Data::type);
 		input = (const char *) data->getData();
 		input = (const char *) data->getData();
 		len = data->getSize();
 		len = data->getSize();
 	}
 	}
@@ -474,7 +474,7 @@ int w_lines(lua_State *L)
 			return luaL_error(L, "Could not open file.");
 			return luaL_error(L, "Could not open file.");
 		}
 		}
 
 
-		luax_pushtype(L, FILESYSTEM_FILE_ID, file);
+		luax_pushtype(L, File::type, file);
 		file->release();
 		file->release();
 	}
 	}
 	else
 	else
@@ -810,7 +810,7 @@ extern "C" int luaopen_love_filesystem(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = instance;
 	w.module = instance;
 	w.name = "filesystem";
 	w.name = "filesystem";
-	w.type = MODULE_FILESYSTEM_ID;
+	w.type = &Filesystem::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = types;
 	w.types = types;
 
 

+ 2 - 0
src/modules/font/GlyphData.cpp

@@ -33,6 +33,8 @@ namespace love
 namespace font
 namespace font
 {
 {
 
 
+love::Type GlyphData::type(&Data::type);
+
 GlyphData::GlyphData(uint32 glyph, GlyphMetrics glyphMetrics, GlyphData::Format f)
 GlyphData::GlyphData(uint32 glyph, GlyphMetrics glyphMetrics, GlyphData::Format f)
 	: glyph(glyph)
 	: glyph(glyph)
 	, metrics(glyphMetrics)
 	, metrics(glyphMetrics)

+ 2 - 0
src/modules/font/GlyphData.h

@@ -55,6 +55,8 @@ class GlyphData : public Data
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	enum Format
 	enum Format
 	{
 	{
 		FORMAT_LUMINANCE_ALPHA,
 		FORMAT_LUMINANCE_ALPHA,

+ 2 - 0
src/modules/font/Rasterizer.cpp

@@ -29,6 +29,8 @@ namespace love
 namespace font
 namespace font
 {
 {
 
 
+love::Type Rasterizer::type(&Object::type);
+
 Rasterizer::~Rasterizer()
 Rasterizer::~Rasterizer()
 {
 {
 }
 }

+ 2 - 0
src/modules/font/Rasterizer.h

@@ -49,6 +49,8 @@ class Rasterizer : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	virtual ~Rasterizer();
 	virtual ~Rasterizer();
 
 
 	/**
 	/**

+ 11 - 11
src/modules/font/wrap_Font.cpp

@@ -53,7 +53,7 @@ int w_newRasterizer(lua_State *L)
 			[&](bool) { d->release(); }
 			[&](bool) { d->release(); }
 		);
 		);
 
 
-		luax_pushtype(L, FONT_RASTERIZER_ID, t);
+		luax_pushtype(L, Rasterizer::type, t);
 		t->release();
 		t->release();
 		return 1;
 		return 1;
 	}
 	}
@@ -84,7 +84,7 @@ int w_newTrueTypeRasterizer(lua_State *L)
 	{
 	{
 		love::Data *d = nullptr;
 		love::Data *d = nullptr;
 
 
-		if (luax_istype(L, 1, DATA_ID))
+		if (luax_istype(L, 1, love::Data::type))
 		{
 		{
 			d = luax_checkdata(L, 1);
 			d = luax_checkdata(L, 1);
 			d->retain();
 			d->retain();
@@ -104,14 +104,14 @@ int w_newTrueTypeRasterizer(lua_State *L)
 		);
 		);
 	}
 	}
 
 
-	luax_pushtype(L, FONT_RASTERIZER_ID, t);
+	luax_pushtype(L, Rasterizer::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
 
 
 static void convimagedata(lua_State *L, int idx)
 static void convimagedata(lua_State *L, int idx)
 {
 {
-	if (lua_type(L, 1) == LUA_TSTRING || luax_istype(L, idx, FILESYSTEM_FILE_ID) || luax_istype(L, idx, FILESYSTEM_FILE_DATA_ID))
+	if (lua_type(L, 1) == LUA_TSTRING || luax_istype(L, idx, love::filesystem::File::type) || luax_istype(L, idx, love::filesystem::FileData::type))
 		luax_convobj(L, idx, "image", "newImageData");
 		luax_convobj(L, idx, "image", "newImageData");
 }
 }
 
 
@@ -129,7 +129,7 @@ int w_newBMFontRasterizer(lua_State *L)
 			lua_rawgeti(L, 2, i);
 			lua_rawgeti(L, 2, i);
 
 
 			convimagedata(L, -1);
 			convimagedata(L, -1);
-			image::ImageData *id = luax_checktype<image::ImageData>(L, -1, IMAGE_IMAGE_DATA_ID);
+			image::ImageData *id = luax_checktype<image::ImageData>(L, -1, image::ImageData::type);
 			images.push_back(id);
 			images.push_back(id);
 			id->retain();
 			id->retain();
 
 
@@ -141,7 +141,7 @@ int w_newBMFontRasterizer(lua_State *L)
 		for (int i = 2; i <= lua_gettop(L); i++)
 		for (int i = 2; i <= lua_gettop(L); i++)
 		{
 		{
 			convimagedata(L, i);
 			convimagedata(L, i);
-			image::ImageData *id = luax_checktype<image::ImageData>(L, i, IMAGE_IMAGE_DATA_ID);
+			image::ImageData *id = luax_checktype<image::ImageData>(L, i, image::ImageData::type);
 			images.push_back(id);
 			images.push_back(id);
 			id->retain();
 			id->retain();
 		}
 		}
@@ -152,7 +152,7 @@ int w_newBMFontRasterizer(lua_State *L)
 		[&](bool) { d->release(); for (auto id : images) id->release(); }
 		[&](bool) { d->release(); for (auto id : images) id->release(); }
 	);
 	);
 
 
-	luax_pushtype(L, FONT_RASTERIZER_ID, t);
+	luax_pushtype(L, Rasterizer::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -163,13 +163,13 @@ int w_newImageRasterizer(lua_State *L)
 
 
 	convimagedata(L, 1);
 	convimagedata(L, 1);
 
 
-	image::ImageData *d = luax_checktype<image::ImageData>(L, 1, IMAGE_IMAGE_DATA_ID);
+	image::ImageData *d = luax_checktype<image::ImageData>(L, 1, image::ImageData::type);
 	std::string glyphs = luax_checkstring(L, 2);
 	std::string glyphs = luax_checkstring(L, 2);
 	int extraspacing = (int) luaL_optnumber(L, 3, 0);
 	int extraspacing = (int) luaL_optnumber(L, 3, 0);
 
 
 	luax_catchexcept(L, [&](){ t = instance()->newImageRasterizer(d, glyphs, extraspacing); });
 	luax_catchexcept(L, [&](){ t = instance()->newImageRasterizer(d, glyphs, extraspacing); });
 
 
-	luax_pushtype(L, FONT_RASTERIZER_ID, t);
+	luax_pushtype(L, Rasterizer::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -191,7 +191,7 @@ int w_newGlyphData(lua_State *L)
 		t = instance()->newGlyphData(r, g);
 		t = instance()->newGlyphData(r, g);
 	}
 	}
 
 
-	luax_pushtype(L, FONT_GLYPH_DATA_ID, t);
+	luax_pushtype(L, GlyphData::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -227,7 +227,7 @@ extern "C" int luaopen_love_font(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = instance;
 	w.module = instance;
 	w.name = "font";
 	w.name = "font";
-	w.type = MODULE_ID;
+	w.type = &Module::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = types;
 	w.types = types;
 
 

+ 2 - 2
src/modules/font/wrap_GlyphData.cpp

@@ -27,7 +27,7 @@ namespace font
 
 
 GlyphData *luax_checkglyphdata(lua_State *L, int idx)
 GlyphData *luax_checkglyphdata(lua_State *L, int idx)
 {
 {
-	return luax_checktype<GlyphData>(L, idx, FONT_GLYPH_DATA_ID);
+	return luax_checktype<GlyphData>(L, idx, GlyphData::type);
 }
 }
 
 
 int w_GlyphData_getWidth(lua_State *L)
 int w_GlyphData_getWidth(lua_State *L)
@@ -131,7 +131,7 @@ const luaL_Reg w_GlyphData_functions[] =
 
 
 extern "C" int luaopen_glyphdata(lua_State *L)
 extern "C" int luaopen_glyphdata(lua_State *L)
 {
 {
-	return luax_register_type(L, FONT_GLYPH_DATA_ID, "GlyphData", w_Data_functions, w_GlyphData_functions, nullptr);
+	return luax_register_type(L, GlyphData::type, "GlyphData", w_Data_functions, w_GlyphData_functions, nullptr);
 }
 }
 
 
 } // font
 } // font

+ 3 - 3
src/modules/font/wrap_Rasterizer.cpp

@@ -29,7 +29,7 @@ namespace font
 
 
 Rasterizer *luax_checkrasterizer(lua_State *L, int idx)
 Rasterizer *luax_checkrasterizer(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Rasterizer>(L, idx, FONT_RASTERIZER_ID);
+	return luax_checktype<Rasterizer>(L, idx, Rasterizer::type);
 }
 }
 
 
 int w_Rasterizer_getHeight(lua_State *L)
 int w_Rasterizer_getHeight(lua_State *L)
@@ -86,7 +86,7 @@ int w_Rasterizer_getGlyphData(lua_State *L)
 		}
 		}
 	});
 	});
 
 
-	luax_pushtype(L, FONT_GLYPH_DATA_ID, g);
+	luax_pushtype(L, GlyphData::type, g);
 	g->release();
 	g->release();
 	return 1;
 	return 1;
 }
 }
@@ -139,7 +139,7 @@ const luaL_Reg w_Rasterizer_functions[] =
 
 
 extern "C" int luaopen_rasterizer(lua_State *L)
 extern "C" int luaopen_rasterizer(lua_State *L)
 {
 {
-	return luax_register_type(L, FONT_RASTERIZER_ID, "Rasterizer", w_Rasterizer_functions, nullptr);
+	return luax_register_type(L, Rasterizer::type, "Rasterizer", w_Rasterizer_functions, nullptr);
 }
 }
 
 
 } // font
 } // font

+ 2 - 0
src/modules/graphics/Drawable.h

@@ -38,6 +38,8 @@ class Drawable : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	/**
 	/**
 	 * Destructor.
 	 * Destructor.
 	 **/
 	 **/

+ 2 - 0
src/modules/graphics/Graphics.cpp

@@ -58,6 +58,8 @@ void unGammaCorrectColor(Colorf &c)
 	}
 	}
 }
 }
 
 
+love::Type Graphics::type(&Module::type);
+
 Graphics::~Graphics()
 Graphics::~Graphics()
 {
 {
 }
 }

+ 2 - 0
src/modules/graphics/Graphics.h

@@ -63,6 +63,8 @@ class Graphics : public Module
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	enum DrawMode
 	enum DrawMode
 	{
 	{
 		DRAW_LINE,
 		DRAW_LINE,

+ 2 - 0
src/modules/graphics/ParticleSystem.cpp

@@ -50,6 +50,8 @@ float calculate_variation(float inner, float outer, float var)
 
 
 } // anonymous namespace
 } // anonymous namespace
 
 
+love::Type ParticleSystem::type(&Drawable::type);
+
 ParticleSystem::ParticleSystem(Texture *texture, uint32 size)
 ParticleSystem::ParticleSystem(Texture *texture, uint32 size)
 	: pMem(nullptr)
 	: pMem(nullptr)
 	, pFree(nullptr)
 	, pFree(nullptr)

+ 3 - 0
src/modules/graphics/ParticleSystem.h

@@ -45,6 +45,9 @@ namespace graphics
 class ParticleSystem : public Drawable
 class ParticleSystem : public Drawable
 {
 {
 public:
 public:
+
+	static love::Type type;
+
 	/**
 	/**
 	 * Type of distribution new particles are drawn from: None, uniform, normal, ellipse.
 	 * Type of distribution new particles are drawn from: None, uniform, normal, ellipse.
 	 */
 	 */

+ 2 - 0
src/modules/graphics/Quad.cpp

@@ -29,6 +29,8 @@ namespace love
 namespace graphics
 namespace graphics
 {
 {
 
 
+love::Type Quad::type(&Object::type);
+
 Quad::Quad(const Quad::Viewport &v, double sw, double sh)
 Quad::Quad(const Quad::Viewport &v, double sw, double sh)
 	: sw(sw)
 	: sw(sw)
 	, sh(sh)
 	, sh(sh)

+ 2 - 0
src/modules/graphics/Quad.h

@@ -34,6 +34,8 @@ class Quad : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	struct Viewport
 	struct Viewport
 	{
 	{
 		double x, y;
 		double x, y;

+ 2 - 0
src/modules/graphics/Texture.cpp

@@ -25,6 +25,8 @@ namespace love
 namespace graphics
 namespace graphics
 {
 {
 
 
+love::Type Texture::type(&Drawable::type);
+
 Texture::Filter Texture::defaultFilter;
 Texture::Filter Texture::defaultFilter;
 
 
 Texture::Texture()
 Texture::Texture()

+ 2 - 0
src/modules/graphics/Texture.h

@@ -40,6 +40,8 @@ class Texture : public Drawable
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	enum WrapMode
 	enum WrapMode
 	{
 	{
 		WRAP_CLAMP,
 		WRAP_CLAMP,

+ 1 - 0
src/modules/graphics/opengl/Canvas.cpp

@@ -88,6 +88,7 @@ static GLenum createMSAABuffer(int width, int height, int &samples, GLenum iform
 	return status;
 	return status;
 }
 }
 
 
+love::Type Canvas::type(&Texture::type);
 Canvas *Canvas::current = nullptr;
 Canvas *Canvas::current = nullptr;
 OpenGL::Viewport Canvas::systemViewport = OpenGL::Viewport();
 OpenGL::Viewport Canvas::systemViewport = OpenGL::Viewport();
 bool Canvas::screenHasSRGB = false;
 bool Canvas::screenHasSRGB = false;

+ 2 - 0
src/modules/graphics/opengl/Canvas.h

@@ -43,6 +43,8 @@ class Canvas : public Texture, public Volatile
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	// Different Canvas render target formats.
 	// Different Canvas render target formats.
 	enum Format
 	enum Format
 	{
 	{

+ 8 - 6
src/modules/graphics/opengl/Font.cpp

@@ -39,6 +39,8 @@ namespace graphics
 namespace opengl
 namespace opengl
 {
 {
 
 
+love::Type Font::type(&Object::type);
+
 static inline uint16 normToUint16(double n)
 static inline uint16 normToUint16(double n)
 {
 {
 	return (uint16) (n * LOVE_UINT16_MAX);
 	return (uint16) (n * LOVE_UINT16_MAX);
@@ -77,7 +79,7 @@ Font::Font(love::font::Rasterizer *r, const Texture::Filter &filter)
 	}
 	}
 
 
 	love::font::GlyphData *gd = r->getGlyphData(32); // Space character.
 	love::font::GlyphData *gd = r->getGlyphData(32); // Space character.
-	type = (gd->getFormat() == font::GlyphData::FORMAT_LUMINANCE_ALPHA) ? FONT_TRUETYPE : FONT_IMAGE;
+	fontType = (gd->getFormat() == font::GlyphData::FORMAT_LUMINANCE_ALPHA) ? FONT_TRUETYPE : FONT_IMAGE;
 	gd->release();
 	gd->release();
 
 
 	if (!r->hasGlyph(9)) // No tab character in the Rasterizer.
 	if (!r->hasGlyph(9)) // No tab character in the Rasterizer.
@@ -142,7 +144,7 @@ void Font::createTexture()
 {
 {
 	OpenGL::TempDebugGroup debuggroup("Font create texture");
 	OpenGL::TempDebugGroup debuggroup("Font create texture");
 
 
-	size_t bpp = type == FONT_TRUETYPE ? 2 : 4;
+	size_t bpp = fontType == FONT_TRUETYPE ? 2 : 4;
 
 
 	size_t prevmemsize = textureMemorySize;
 	size_t prevmemsize = textureMemorySize;
 	if (prevmemsize > 0)
 	if (prevmemsize > 0)
@@ -177,7 +179,7 @@ void Font::createTexture()
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
 
 	GLenum internalformat = GL_RGBA;
 	GLenum internalformat = GL_RGBA;
-	GLenum format = getTextureFormat(type, &internalformat);
+	GLenum format = getTextureFormat(fontType, &internalformat);
 
 
 	// Initialize the texture with transparent black.
 	// Initialize the texture with transparent black.
 	std::vector<GLubyte> emptydata(size.width * size.height * bpp, 0);
 	std::vector<GLubyte> emptydata(size.width * size.height * bpp, 0);
@@ -285,7 +287,7 @@ const Font::Glyph &Font::addGlyph(uint32 glyph)
 	// don't waste space for empty glyphs. also fixes a divide by zero bug with ATI drivers
 	// don't waste space for empty glyphs. also fixes a divide by zero bug with ATI drivers
 	if (w > 0 && h > 0)
 	if (w > 0 && h > 0)
 	{
 	{
-		GLenum format = getTextureFormat(type);
+		GLenum format = getTextureFormat(fontType);
 		g.texture = textures.back();
 		g.texture = textures.back();
 
 
 		gl.bindTextureToUnit(g.texture, 0, false);
 		gl.bindTextureToUnit(g.texture, 0, false);
@@ -1021,7 +1023,7 @@ int Font::getDescent() const
 float Font::getBaseline() const
 float Font::getBaseline() const
 {
 {
 	// 1.25 is magic line height for true type fonts
 	// 1.25 is magic line height for true type fonts
-	return (type == FONT_TRUETYPE) ? floorf(getHeight() / 1.25f + 0.5f) : 0.0f;
+	return (fontType == FONT_TRUETYPE) ? floorf(getHeight() / 1.25f + 0.5f) : 0.0f;
 }
 }
 
 
 bool Font::hasGlyph(uint32 glyph) const
 bool Font::hasGlyph(uint32 glyph) const
@@ -1065,7 +1067,7 @@ void Font::setFallbacks(const std::vector<Font *> &fallbacks)
 {
 {
 	for (const Font *f : fallbacks)
 	for (const Font *f : fallbacks)
 	{
 	{
-		if (f->type != this->type)
+		if (f->fontType != this->fontType)
 			throw love::Exception("Font fallbacks must be of the same font type.");
 			throw love::Exception("Font fallbacks must be of the same font type.");
 	}
 	}
 
 

+ 3 - 1
src/modules/graphics/opengl/Font.h

@@ -50,6 +50,8 @@ class Font : public Object, public Volatile
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	typedef std::vector<uint32> Codepoints;
 	typedef std::vector<uint32> Codepoints;
 
 
 	enum AlignMode
 	enum AlignMode
@@ -235,7 +237,7 @@ private:
 	// map of left/right glyph pairs to horizontal kerning.
 	// map of left/right glyph pairs to horizontal kerning.
 	std::unordered_map<uint64, float> kerning;
 	std::unordered_map<uint64, float> kerning;
 
 
-	FontType type;
+	FontType fontType;
 	Texture::Filter filter;
 	Texture::Filter filter;
 
 
 	int textureX, textureY;
 	int textureX, textureY;

+ 2 - 0
src/modules/graphics/opengl/Image.cpp

@@ -43,6 +43,8 @@ namespace graphics
 namespace opengl
 namespace opengl
 {
 {
 
 
+love::Type Image::type(&Texture::type);
+
 int Image::imageCount = 0;
 int Image::imageCount = 0;
 
 
 float Image::maxMipmapSharpness = 0.0f;
 float Image::maxMipmapSharpness = 0.0f;

+ 2 - 0
src/modules/graphics/opengl/Image.h

@@ -52,6 +52,8 @@ class Image : public Texture, public Volatile
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	enum FlagType
 	enum FlagType
 	{
 	{
 		FLAG_TYPE_MIPMAPS,
 		FLAG_TYPE_MIPMAPS,

+ 2 - 0
src/modules/graphics/opengl/Mesh.cpp

@@ -58,6 +58,8 @@ static std::vector<Mesh::AttribFormat> getDefaultVertexFormat()
 	return vertexformat;
 	return vertexformat;
 }
 }
 
 
+love::Type Mesh::type(&Drawable::type);
+
 Mesh::Mesh(const std::vector<AttribFormat> &vertexformat, const void *data, size_t datasize, DrawMode drawmode, Usage usage)
 Mesh::Mesh(const std::vector<AttribFormat> &vertexformat, const void *data, size_t datasize, DrawMode drawmode, Usage usage)
 	: vertexFormat(vertexformat)
 	: vertexFormat(vertexformat)
 	, vbo(nullptr)
 	, vbo(nullptr)

+ 2 - 0
src/modules/graphics/opengl/Mesh.h

@@ -50,6 +50,8 @@ class Mesh : public Drawable
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	// The expected usage pattern of the Mesh's vertex data.
 	// The expected usage pattern of the Mesh's vertex data.
 	enum Usage
 	enum Usage
 	{
 	{

+ 1 - 0
src/modules/graphics/opengl/Shader.cpp

@@ -62,6 +62,7 @@ namespace
 } // anonymous namespace
 } // anonymous namespace
 
 
 
 
+love::Type Shader::type(&Object::type);
 Shader *Shader::current = nullptr;
 Shader *Shader::current = nullptr;
 Shader *Shader::defaultShader = nullptr;
 Shader *Shader::defaultShader = nullptr;
 Shader *Shader::defaultVideoShader = nullptr;
 Shader *Shader::defaultVideoShader = nullptr;

+ 2 - 0
src/modules/graphics/opengl/Shader.h

@@ -48,6 +48,8 @@ class Shader : public Object, public Volatile
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	enum ShaderStage
 	enum ShaderStage
 	{
 	{
 		STAGE_VERTEX,
 		STAGE_VERTEX,

+ 2 - 0
src/modules/graphics/opengl/SpriteBatch.cpp

@@ -41,6 +41,8 @@ namespace graphics
 namespace opengl
 namespace opengl
 {
 {
 
 
+love::Type SpriteBatch::type(&Drawable::type);
+
 SpriteBatch::SpriteBatch(Texture *texture, int size, Mesh::Usage usage)
 SpriteBatch::SpriteBatch(Texture *texture, int size, Mesh::Usage usage)
 	: texture(texture)
 	: texture(texture)
 	, size(size)
 	, size(size)

+ 2 - 0
src/modules/graphics/opengl/SpriteBatch.h

@@ -52,6 +52,8 @@ class SpriteBatch : public Drawable
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	SpriteBatch(Texture *texture, int size, Mesh::Usage usage);
 	SpriteBatch(Texture *texture, int size, Mesh::Usage usage);
 	virtual ~SpriteBatch();
 	virtual ~SpriteBatch();
 
 

+ 2 - 0
src/modules/graphics/opengl/Text.cpp

@@ -30,6 +30,8 @@ namespace graphics
 namespace opengl
 namespace opengl
 {
 {
 
 
+love::Type Text::type(&Drawable::type);
+
 Text::Text(Font *font, const std::vector<Font::ColoredString> &text)
 Text::Text(Font *font, const std::vector<Font::ColoredString> &text)
 	: font(font)
 	: font(font)
 	, vbo(nullptr)
 	, vbo(nullptr)

+ 2 - 0
src/modules/graphics/opengl/Text.h

@@ -38,6 +38,8 @@ class Text : public Drawable
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	Text(Font *font, const std::vector<Font::ColoredString> &text = {});
 	Text(Font *font, const std::vector<Font::ColoredString> &text = {});
 	virtual ~Text();
 	virtual ~Text();
 
 

+ 2 - 0
src/modules/graphics/opengl/Video.cpp

@@ -30,6 +30,8 @@ namespace graphics
 namespace opengl
 namespace opengl
 {
 {
 
 
+love::Type Video::type(&Drawable::type);
+
 Video::Video(love::video::VideoStream *stream)
 Video::Video(love::video::VideoStream *stream)
 	: stream(stream)
 	: stream(stream)
 	, filter(Texture::getDefaultFilter())
 	, filter(Texture::getDefaultFilter())

+ 2 - 0
src/modules/graphics/opengl/Video.h

@@ -40,6 +40,8 @@ class Video : public Drawable, public Volatile
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	Video(love::video::VideoStream *stream);
 	Video(love::video::VideoStream *stream);
 	~Video();
 	~Video();
 
 

+ 4 - 4
src/modules/graphics/opengl/wrap_Canvas.cpp

@@ -30,7 +30,7 @@ namespace opengl
 
 
 Canvas *luax_checkcanvas(lua_State *L, int idx)
 Canvas *luax_checkcanvas(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Canvas>(L, idx, GRAPHICS_CANVAS_ID);
+	return luax_checktype<Canvas>(L, idx, Canvas::type);
 }
 }
 
 
 int w_Canvas_renderTo(lua_State *L)
 int w_Canvas_renderTo(lua_State *L)
@@ -68,7 +68,7 @@ int w_Canvas_renderTo(lua_State *L)
 int w_Canvas_newImageData(lua_State *L)
 int w_Canvas_newImageData(lua_State *L)
 {
 {
 	Canvas *canvas = luax_checkcanvas(L, 1);
 	Canvas *canvas = luax_checkcanvas(L, 1);
-	love::image::Image *image = luax_getmodule<love::image::Image>(L, MODULE_IMAGE_ID);
+	love::image::Image *image = luax_getmodule<love::image::Image>(L, love::image::Image::type);
 	int x = (int) luaL_optnumber(L, 2, 0);
 	int x = (int) luaL_optnumber(L, 2, 0);
 	int y = (int) luaL_optnumber(L, 3, 0);
 	int y = (int) luaL_optnumber(L, 3, 0);
 	int w = (int) luaL_optnumber(L, 4, canvas->getWidth());
 	int w = (int) luaL_optnumber(L, 4, canvas->getWidth());
@@ -77,7 +77,7 @@ int w_Canvas_newImageData(lua_State *L)
 	love::image::ImageData *img = nullptr;
 	love::image::ImageData *img = nullptr;
 	luax_catchexcept(L, [&](){ img = canvas->newImageData(image, x, y, w, h); });
 	luax_catchexcept(L, [&](){ img = canvas->newImageData(image, x, y, w, h); });
 
 
-	luax_pushtype(L, IMAGE_IMAGE_DATA_ID, img);
+	luax_pushtype(L, love::image::ImageData::type, img);
 	img->release();
 	img->release();
 	return 1;
 	return 1;
 }
 }
@@ -112,7 +112,7 @@ static const luaL_Reg w_Canvas_functions[] =
 
 
 extern "C" int luaopen_canvas(lua_State *L)
 extern "C" int luaopen_canvas(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_CANVAS_ID, "Canvas", w_Texture_functions, w_Canvas_functions, nullptr);
+	return luax_register_type(L, Canvas::type, "Canvas", w_Texture_functions, w_Canvas_functions, nullptr);
 }
 }
 
 
 } // opengl
 } // opengl

+ 2 - 2
src/modules/graphics/opengl/wrap_Font.cpp

@@ -35,7 +35,7 @@ namespace opengl
 
 
 Font *luax_checkfont(lua_State *L, int idx)
 Font *luax_checkfont(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Font>(L, idx, GRAPHICS_FONT_ID);
+	return luax_checktype<Font>(L, idx, Font::type);
 }
 }
 
 
 int w_Font_getHeight(lua_State *L)
 int w_Font_getHeight(lua_State *L)
@@ -207,7 +207,7 @@ static const luaL_Reg w_Font_functions[] =
 
 
 extern "C" int luaopen_font(lua_State *L)
 extern "C" int luaopen_font(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_FONT_ID, "Font", w_Font_functions, nullptr);
+	return luax_register_type(L, Font::type, "Font", w_Font_functions, nullptr);
 }
 }
 
 
 } // opengl
 } // opengl

+ 38 - 38
src/modules/graphics/opengl/wrap_Graphics.cpp

@@ -313,7 +313,7 @@ int w_newImage(lua_State *L)
 	bool releasedata = false;
 	bool releasedata = false;
 
 
 	// Convert to ImageData / CompressedImageData, if necessary.
 	// Convert to ImageData / CompressedImageData, if necessary.
-	if (lua_isstring(L, 1) || luax_istype(L, 1, FILESYSTEM_FILE_ID) || luax_istype(L, 1, FILESYSTEM_FILE_DATA_ID))
+	if (lua_isstring(L, 1) || luax_istype(L, 1, love::filesystem::File::type) || luax_istype(L, 1, love::filesystem::FileData::type))
 	{
 	{
 		auto imagemodule = Module::getInstance<love::image::Image>(Module::M_IMAGE);
 		auto imagemodule = Module::getInstance<love::image::Image>(Module::M_IMAGE);
 		if (imagemodule == nullptr)
 		if (imagemodule == nullptr)
@@ -339,7 +339,7 @@ int w_newImage(lua_State *L)
 		// Lua's GC won't release the image data, so we should do it ourselves.
 		// Lua's GC won't release the image data, so we should do it ourselves.
 		releasedata = true;
 		releasedata = true;
 	}
 	}
-	else if (luax_istype(L, 1, IMAGE_COMPRESSED_IMAGE_DATA_ID))
+	else if (luax_istype(L, 1, love::image::CompressedImageData::type))
 		cdata.push_back(love::image::luax_checkcompressedimagedata(L, 1));
 		cdata.push_back(love::image::luax_checkcompressedimagedata(L, 1));
 	else
 	else
 		data.push_back(love::image::luax_checkimagedata(L, 1));
 		data.push_back(love::image::luax_checkimagedata(L, 1));
@@ -358,14 +358,14 @@ int w_newImage(lua_State *L)
 
 
 				if (!data.empty())
 				if (!data.empty())
 				{
 				{
-					if (!luax_istype(L, -1, IMAGE_IMAGE_DATA_ID))
+					if (!luax_istype(L, -1, love::image::ImageData::type))
 						luax_convobj(L, -1, "image", "newImageData");
 						luax_convobj(L, -1, "image", "newImageData");
 
 
 					data.push_back(love::image::luax_checkimagedata(L, -1));
 					data.push_back(love::image::luax_checkimagedata(L, -1));
 				}
 				}
 				else if (!cdata.empty())
 				else if (!cdata.empty())
 				{
 				{
-					if (!luax_istype(L, -1, IMAGE_COMPRESSED_IMAGE_DATA_ID))
+					if (!luax_istype(L, -1, love::image::CompressedImageData::type))
 						luax_convobj(L, -1, "image", "newCompressedData");
 						luax_convobj(L, -1, "image", "newCompressedData");
 
 
 					cdata.push_back(love::image::luax_checkcompressedimagedata(L, -1));
 					cdata.push_back(love::image::luax_checkcompressedimagedata(L, -1));
@@ -402,7 +402,7 @@ int w_newImage(lua_State *L)
 		return luaL_error(L, "Could not load image.");
 		return luaL_error(L, "Could not load image.");
 
 
 	// Push the type.
 	// Push the type.
-	luax_pushtype(L, GRAPHICS_IMAGE_ID, image);
+	luax_pushtype(L, Image::type, image);
 	image->release();
 	image->release();
 	return 1;
 	return 1;
 }
 }
@@ -421,7 +421,7 @@ int w_newQuad(lua_State *L)
 	double sh = luaL_checknumber(L, 6);
 	double sh = luaL_checknumber(L, 6);
 
 
 	Quad *quad = instance()->newQuad(v, sw, sh);
 	Quad *quad = instance()->newQuad(v, sw, sh);
-	luax_pushtype(L, GRAPHICS_QUAD_ID, quad);
+	luax_pushtype(L, Quad::type, quad);
 	quad->release();
 	quad->release();
 	return 1;
 	return 1;
 }
 }
@@ -433,7 +433,7 @@ int w_newFont(lua_State *L)
 	Font *font = nullptr;
 	Font *font = nullptr;
 
 
 	// Convert to Rasterizer, if necessary.
 	// Convert to Rasterizer, if necessary.
-	if (!luax_istype(L, 1, FONT_RASTERIZER_ID))
+	if (!luax_istype(L, 1, love::font::Rasterizer::type))
 	{
 	{
 		std::vector<int> idxs;
 		std::vector<int> idxs;
 		for (int i = 0; i < lua_gettop(L); i++)
 		for (int i = 0; i < lua_gettop(L); i++)
@@ -442,14 +442,14 @@ int w_newFont(lua_State *L)
 		luax_convobj(L, &idxs[0], (int) idxs.size(), "font", "newRasterizer");
 		luax_convobj(L, &idxs[0], (int) idxs.size(), "font", "newRasterizer");
 	}
 	}
 
 
-	love::font::Rasterizer *rasterizer = luax_checktype<love::font::Rasterizer>(L, 1, FONT_RASTERIZER_ID);
+	love::font::Rasterizer *rasterizer = luax_checktype<love::font::Rasterizer>(L, 1, love::font::Rasterizer::type);
 
 
 	luax_catchexcept(L, [&]() {
 	luax_catchexcept(L, [&]() {
 		font = instance()->newFont(rasterizer, instance()->getDefaultFilter()); }
 		font = instance()->newFont(rasterizer, instance()->getDefaultFilter()); }
 	);
 	);
 
 
 	// Push the type.
 	// Push the type.
-	luax_pushtype(L, GRAPHICS_FONT_ID, font);
+	luax_pushtype(L, Font::type, font);
 	font->release();
 	font->release();
 	return 1;
 	return 1;
 }
 }
@@ -462,19 +462,19 @@ int w_newImageFont(lua_State *L)
 	Texture::Filter filter = instance()->getDefaultFilter();
 	Texture::Filter filter = instance()->getDefaultFilter();
 
 
 	// Convert to ImageData if necessary.
 	// Convert to ImageData if necessary.
-	if (luax_istype(L, 1, GRAPHICS_IMAGE_ID))
+	if (luax_istype(L, 1, Image::type))
 	{
 	{
-		Image *i = luax_checktype<Image>(L, 1, GRAPHICS_IMAGE_ID);
+		Image *i = luax_checktype<Image>(L, 1, Image::type);
 		filter = i->getFilter();
 		filter = i->getFilter();
 		const auto &idlevels = i->getImageData();
 		const auto &idlevels = i->getImageData();
 		if (idlevels.empty())
 		if (idlevels.empty())
 			return luaL_argerror(L, 1, "Image must not be compressed.");
 			return luaL_argerror(L, 1, "Image must not be compressed.");
-		luax_pushtype(L, IMAGE_IMAGE_DATA_ID, idlevels[0].get());
+		luax_pushtype(L, love::image::ImageData::type, idlevels[0].get());
 		lua_replace(L, 1);
 		lua_replace(L, 1);
 	}
 	}
 
 
 	// Convert to Rasterizer if necessary.
 	// Convert to Rasterizer if necessary.
-	if (!luax_istype(L, 1, FONT_RASTERIZER_ID))
+	if (!luax_istype(L, 1, love::font::Rasterizer::type))
 	{
 	{
 		luaL_checktype(L, 2, LUA_TSTRING);
 		luaL_checktype(L, 2, LUA_TSTRING);
 
 
@@ -485,13 +485,13 @@ int w_newImageFont(lua_State *L)
 		luax_convobj(L, &idxs[0], (int) idxs.size(), "font", "newImageRasterizer");
 		luax_convobj(L, &idxs[0], (int) idxs.size(), "font", "newImageRasterizer");
 	}
 	}
 
 
-	love::font::Rasterizer *rasterizer = luax_checktype<love::font::Rasterizer>(L, 1, FONT_RASTERIZER_ID);
+	love::font::Rasterizer *rasterizer = luax_checktype<love::font::Rasterizer>(L, 1, love::font::Rasterizer::type);
 
 
 	// Create the font.
 	// Create the font.
 	Font *font = instance()->newFont(rasterizer, filter);
 	Font *font = instance()->newFont(rasterizer, filter);
 
 
 	// Push the type.
 	// Push the type.
-	luax_pushtype(L, GRAPHICS_FONT_ID, font);
+	luax_pushtype(L, Font::type, font);
 	font->release();
 	font->release();
 	return 1;
 	return 1;
 }
 }
@@ -515,7 +515,7 @@ int w_newSpriteBatch(lua_State *L)
 		[&](){ t = instance()->newSpriteBatch(texture, size, usage); }
 		[&](){ t = instance()->newSpriteBatch(texture, size, usage); }
 	);
 	);
 
 
-	luax_pushtype(L, GRAPHICS_SPRITE_BATCH_ID, t);
+	luax_pushtype(L, SpriteBatch::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -534,7 +534,7 @@ int w_newParticleSystem(lua_State *L)
 		[&](){ t = instance()->newParticleSystem(texture, int(size)); }
 		[&](){ t = instance()->newParticleSystem(texture, int(size)); }
 	);
 	);
 
 
-	luax_pushtype(L, GRAPHICS_PARTICLE_SYSTEM_ID, t);
+	luax_pushtype(L, ParticleSystem::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -561,7 +561,7 @@ int w_newCanvas(lua_State *L)
 	if (canvas == nullptr)
 	if (canvas == nullptr)
 		return luaL_error(L, "Canvas not created, but no error thrown. I don't even...");
 		return luaL_error(L, "Canvas not created, but no error thrown. I don't even...");
 
 
-	luax_pushtype(L, GRAPHICS_CANVAS_ID, canvas);
+	luax_pushtype(L, Canvas::type, canvas);
 	canvas->release();
 	canvas->release();
 	return 1;
 	return 1;
 }
 }
@@ -654,7 +654,7 @@ int w_newShader(lua_State *L)
 	try
 	try
 	{
 	{
 		Shader *shader = instance()->newShader(source);
 		Shader *shader = instance()->newShader(source);
-		luax_pushtype(L, GRAPHICS_SHADER_ID, shader);
+		luax_pushtype(L, Shader::type, shader);
 		shader->release();
 		shader->release();
 	}
 	}
 	catch (love::Exception &e)
 	catch (love::Exception &e)
@@ -803,10 +803,10 @@ static Mesh *newCustomMesh(lua_State *L)
 		int vertexcount = (int) luaL_checknumber(L, 2);
 		int vertexcount = (int) luaL_checknumber(L, 2);
 		luax_catchexcept(L, [&](){ t = instance()->newMesh(vertexformat, vertexcount, drawmode, usage); });
 		luax_catchexcept(L, [&](){ t = instance()->newMesh(vertexformat, vertexcount, drawmode, usage); });
 	}
 	}
-	else if (luax_istype(L, 2, DATA_ID))
+	else if (luax_istype(L, 2, Data::type))
 	{
 	{
 		// Vertex data comes directly from a Data object.
 		// Vertex data comes directly from a Data object.
-		Data *data = luax_checktype<Data>(L, 2, DATA_ID);
+		Data *data = luax_checktype<Data>(L, 2, Data::type);
 		luax_catchexcept(L, [&](){ t = instance()->newMesh(vertexformat, data->getData(), data->getSize(), drawmode, usage); });
 		luax_catchexcept(L, [&](){ t = instance()->newMesh(vertexformat, data->getData(), data->getSize(), drawmode, usage); });
 	}
 	}
 	else
 	else
@@ -886,7 +886,7 @@ int w_newMesh(lua_State *L)
 	else
 	else
 		t = newStandardMesh(L);
 		t = newStandardMesh(L);
 
 
-	luax_pushtype(L, GRAPHICS_MESH_ID, t);
+	luax_pushtype(L, Mesh::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -908,7 +908,7 @@ int w_newText(lua_State *L)
 		luax_catchexcept(L, [&](){ t = instance()->newText(font, text); });
 		luax_catchexcept(L, [&](){ t = instance()->newText(font, text); });
 	}
 	}
 
 
-	luax_pushtype(L, GRAPHICS_TEXT_ID, t);
+	luax_pushtype(L, Text::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -917,14 +917,14 @@ int w_newVideo(lua_State *L)
 {
 {
 	luax_checkgraphicscreated(L);
 	luax_checkgraphicscreated(L);
 
 
-	if (!luax_istype(L, 1, VIDEO_VIDEO_STREAM_ID))
+	if (!luax_istype(L, 1, love::video::VideoStream::type))
 		luax_convobj(L, 1, "video", "newVideoStream");
 		luax_convobj(L, 1, "video", "newVideoStream");
 
 
-	auto stream = luax_checktype<love::video::VideoStream>(L, 1, VIDEO_VIDEO_STREAM_ID);
+	auto stream = luax_checktype<love::video::VideoStream>(L, 1, love::video::VideoStream::type);
 	Video *video = nullptr;
 	Video *video = nullptr;
 
 
 	luax_catchexcept(L, [&]() { video = instance()->newVideo(stream); });
 	luax_catchexcept(L, [&]() { video = instance()->newVideo(stream); });
-	luax_pushtype(L, GRAPHICS_VIDEO_ID, video);
+	luax_pushtype(L, Video::type, video);
 	video->release();
 	video->release();
 	return 1;
 	return 1;
 }
 }
@@ -1004,14 +1004,14 @@ int w_getBackgroundColor(lua_State *L)
 int w_setNewFont(lua_State *L)
 int w_setNewFont(lua_State *L)
 {
 {
 	int ret = w_newFont(L);
 	int ret = w_newFont(L);
-	Font *font = luax_checktype<Font>(L, -1, GRAPHICS_FONT_ID);
+	Font *font = luax_checktype<Font>(L, -1, Font::type);
 	instance()->setFont(font);
 	instance()->setFont(font);
 	return ret;
 	return ret;
 }
 }
 
 
 int w_setFont(lua_State *L)
 int w_setFont(lua_State *L)
 {
 {
-	Font *font = luax_checktype<Font>(L, 1, GRAPHICS_FONT_ID);
+	Font *font = luax_checktype<Font>(L, 1, Font::type);
 	instance()->setFont(font);
 	instance()->setFont(font);
 	return 0;
 	return 0;
 }
 }
@@ -1021,7 +1021,7 @@ int w_getFont(lua_State *L)
 	Font *f = nullptr;
 	Font *f = nullptr;
 	luax_catchexcept(L, [&](){ f = instance()->getFont(); });
 	luax_catchexcept(L, [&](){ f = instance()->getFont(); });
 
 
-	luax_pushtype(L, GRAPHICS_FONT_ID, f);
+	luax_pushtype(L, Font::type, f);
 	return 1;
 	return 1;
 }
 }
 
 
@@ -1248,13 +1248,13 @@ int w_isWireframe(lua_State *L)
 
 
 int w_newScreenshot(lua_State *L)
 int w_newScreenshot(lua_State *L)
 {
 {
-	love::image::Image *image = luax_getmodule<love::image::Image>(L, MODULE_IMAGE_ID);
+	love::image::Image *image = luax_getmodule<love::image::Image>(L, love::image::Image::type);
 	bool copyAlpha = luax_optboolean(L, 1, false);
 	bool copyAlpha = luax_optboolean(L, 1, false);
 	love::image::ImageData *i = 0;
 	love::image::ImageData *i = 0;
 
 
 	luax_catchexcept(L, [&](){ i = instance()->newScreenshot(image, copyAlpha); });
 	luax_catchexcept(L, [&](){ i = instance()->newScreenshot(image, copyAlpha); });
 
 
-	luax_pushtype(L, IMAGE_IMAGE_DATA_ID, i);
+	luax_pushtype(L, love::image::ImageData::type, i);
 	i->release();
 	i->release();
 	return 1;
 	return 1;
 }
 }
@@ -1306,7 +1306,7 @@ int w_getCanvas(lua_State *L)
 
 
 	for (Canvas *c : canvases)
 	for (Canvas *c : canvases)
 	{
 	{
-		luax_pushtype(L, GRAPHICS_CANVAS_ID, c);
+		luax_pushtype(L, Canvas::type, c);
 		n++;
 		n++;
 	}
 	}
 
 
@@ -1336,7 +1336,7 @@ int w_getShader(lua_State *L)
 {
 {
 	Shader *shader = instance()->getShader();
 	Shader *shader = instance()->getShader();
 	if (shader)
 	if (shader)
-		luax_pushtype(L, GRAPHICS_SHADER_ID, shader);
+		luax_pushtype(L, Shader::type, shader);
 	else
 	else
 		lua_pushnil(L);
 		lua_pushnil(L);
 
 
@@ -1525,10 +1525,10 @@ int w_draw(lua_State *L)
 	Quad *quad = nullptr;
 	Quad *quad = nullptr;
 	int startidx = 2;
 	int startidx = 2;
 
 
-	if (luax_istype(L, 2, GRAPHICS_QUAD_ID))
+	if (luax_istype(L, 2, Quad::type))
 	{
 	{
 		texture = luax_checktexture(L, 1);
 		texture = luax_checktexture(L, 1);
-		quad = luax_totype<Quad>(L, 2, GRAPHICS_QUAD_ID);
+		quad = luax_totype<Quad>(L, 2, Quad::type);
 		startidx = 3;
 		startidx = 3;
 	}
 	}
 	else if (lua_isnil(L, 2) && !lua_isnoneornil(L, 3))
 	else if (lua_isnil(L, 2) && !lua_isnoneornil(L, 3))
@@ -1537,7 +1537,7 @@ int w_draw(lua_State *L)
 	}
 	}
 	else
 	else
 	{
 	{
-		drawable = luax_checktype<Drawable>(L, 1, GRAPHICS_DRAWABLE_ID);
+		drawable = luax_checktype<Drawable>(L, 1, Drawable::type);
 		startidx = 2;
 		startidx = 2;
 	}
 	}
 
 
@@ -2090,7 +2090,7 @@ static const luaL_Reg functions[] =
 
 
 static int luaopen_drawable(lua_State *L)
 static int luaopen_drawable(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_DRAWABLE_ID, "Drawable", nullptr);
+	return luax_register_type(L, Drawable::type, "Drawable", nullptr);
 }
 }
 
 
 // Types for this module.
 // Types for this module.
@@ -2124,7 +2124,7 @@ extern "C" int luaopen_love_graphics(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = instance;
 	w.module = instance;
 	w.name = "graphics";
 	w.name = "graphics";
-	w.type = MODULE_GRAPHICS_ID;
+	w.type = &Graphics::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = types;
 	w.types = types;
 
 

+ 4 - 4
src/modules/graphics/opengl/wrap_Image.cpp

@@ -30,7 +30,7 @@ namespace opengl
 
 
 Image *luax_checkimage(lua_State *L, int idx)
 Image *luax_checkimage(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Image>(L, idx, GRAPHICS_IMAGE_ID);
+	return luax_checktype<Image>(L, idx, Image::type);
 }
 }
 
 
 int w_Image_setMipmapFilter(lua_State *L)
 int w_Image_setMipmapFilter(lua_State *L)
@@ -98,7 +98,7 @@ int w_Image_getData(lua_State *L)
 	{
 	{
 		for (const auto &cdata : i->getCompressedData())
 		for (const auto &cdata : i->getCompressedData())
 		{
 		{
-			luax_pushtype(L, IMAGE_COMPRESSED_IMAGE_DATA_ID, cdata.get());
+			luax_pushtype(L, love::image::CompressedImageData::type, cdata.get());
 			n++;
 			n++;
 		}
 		}
 	}
 	}
@@ -106,7 +106,7 @@ int w_Image_getData(lua_State *L)
 	{
 	{
 		for (const auto &data : i->getImageData())
 		for (const auto &data : i->getImageData())
 		{
 		{
-			luax_pushtype(L, IMAGE_IMAGE_DATA_ID, data.get());
+			luax_pushtype(L, love::image::ImageData::type, data.get());
 			n++;
 			n++;
 		}
 		}
 	}
 	}
@@ -150,7 +150,7 @@ static const luaL_Reg w_Image_functions[] =
 
 
 extern "C" int luaopen_image(lua_State *L)
 extern "C" int luaopen_image(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_IMAGE_ID, "Image", w_Texture_functions, w_Image_functions, nullptr);
+	return luax_register_type(L, Image::type, "Image", w_Texture_functions, w_Image_functions, nullptr);
 }
 }
 
 
 } // opengl
 } // opengl

+ 6 - 6
src/modules/graphics/opengl/wrap_Mesh.cpp

@@ -37,7 +37,7 @@ namespace opengl
 
 
 Mesh *luax_checkmesh(lua_State *L, int idx)
 Mesh *luax_checkmesh(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Mesh>(L, idx, GRAPHICS_MESH_ID);
+	return luax_checktype<Mesh>(L, idx, Mesh::type);
 }
 }
 
 
 static inline size_t writeByteData(lua_State *L, int startidx, int components, char *data)
 static inline size_t writeByteData(lua_State *L, int startidx, int components, char *data)
@@ -117,9 +117,9 @@ int w_Mesh_setVertices(lua_State *L)
 	size_t stride = t->getVertexStride();
 	size_t stride = t->getVertexStride();
 	size_t byteoffset = vertoffset * stride;
 	size_t byteoffset = vertoffset * stride;
 
 
-	if (luax_istype(L, 2, DATA_ID))
+	if (luax_istype(L, 2, Data::type))
 	{
 	{
-		Data *d = luax_checktype<Data>(L, 2, DATA_ID);
+		Data *d = luax_checktype<Data>(L, 2, Data::type);
 
 
 		size_t datasize = std::min(d->getSize(), (t->getVertexCount() - vertoffset) * stride);
 		size_t datasize = std::min(d->getSize(), (t->getVertexCount() - vertoffset) * stride);
 		char *bytedata = (char *) t->mapVertexData() + byteoffset;
 		char *bytedata = (char *) t->mapVertexData() + byteoffset;
@@ -437,9 +437,9 @@ int w_Mesh_getTexture(lua_State *L)
 
 
 	// FIXME: big hack right here.
 	// FIXME: big hack right here.
 	if (typeid(*tex) == typeid(Image))
 	if (typeid(*tex) == typeid(Image))
-		luax_pushtype(L, GRAPHICS_IMAGE_ID, tex);
+		luax_pushtype(L, Image::type, tex);
 	else if (typeid(*tex) == typeid(Canvas))
 	else if (typeid(*tex) == typeid(Canvas))
-		luax_pushtype(L, GRAPHICS_CANVAS_ID, tex);
+		luax_pushtype(L, Canvas::type, tex);
 	else
 	else
 		return luaL_error(L, "Unable to determine texture type.");
 		return luaL_error(L, "Unable to determine texture type.");
 
 
@@ -528,7 +528,7 @@ static const luaL_Reg w_Mesh_functions[] =
 
 
 extern "C" int luaopen_mesh(lua_State *L)
 extern "C" int luaopen_mesh(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_MESH_ID, "Mesh", w_Mesh_functions, nullptr);
+	return luax_register_type(L, Mesh::type, "Mesh", w_Mesh_functions, nullptr);
 }
 }
 
 
 } // opengl
 } // opengl

+ 8 - 8
src/modules/graphics/opengl/wrap_ParticleSystem.cpp

@@ -41,7 +41,7 @@ namespace opengl
 
 
 ParticleSystem *luax_checkparticlesystem(lua_State *L, int idx)
 ParticleSystem *luax_checkparticlesystem(lua_State *L, int idx)
 {
 {
-	return luax_checktype<ParticleSystem>(L, idx, GRAPHICS_PARTICLE_SYSTEM_ID);
+	return luax_checktype<ParticleSystem>(L, idx, ParticleSystem::type);
 }
 }
 
 
 int w_ParticleSystem_clone(lua_State *L)
 int w_ParticleSystem_clone(lua_State *L)
@@ -51,7 +51,7 @@ int w_ParticleSystem_clone(lua_State *L)
 	ParticleSystem *clone = nullptr;
 	ParticleSystem *clone = nullptr;
 	luax_catchexcept(L, [&](){ clone = t->clone(); });
 	luax_catchexcept(L, [&](){ clone = t->clone(); });
 
 
-	luax_pushtype(L, GRAPHICS_PARTICLE_SYSTEM_ID, clone);
+	luax_pushtype(L, ParticleSystem::type, clone);
 	clone->release();
 	clone->release();
 	return 1;
 	return 1;
 }
 }
@@ -71,9 +71,9 @@ int w_ParticleSystem_getTexture(lua_State *L)
 
 
 	// FIXME: big hack right here.
 	// FIXME: big hack right here.
 	if (typeid(*tex) == typeid(Image))
 	if (typeid(*tex) == typeid(Image))
-		luax_pushtype(L, GRAPHICS_IMAGE_ID, tex);
+		luax_pushtype(L, Image::type, tex);
 	else if (typeid(*tex) == typeid(Canvas))
 	else if (typeid(*tex) == typeid(Canvas))
-		luax_pushtype(L, GRAPHICS_CANVAS_ID, tex);
+		luax_pushtype(L, Canvas::type, tex);
 	else
 	else
 		return luaL_error(L, "Unable to determine texture type.");
 		return luaL_error(L, "Unable to determine texture type.");
 
 
@@ -584,7 +584,7 @@ int w_ParticleSystem_setQuads(lua_State *L)
 		{
 		{
 			lua_rawgeti(L, 2, i);
 			lua_rawgeti(L, 2, i);
 
 
-			Quad *q = luax_checktype<Quad>(L, -1, GRAPHICS_QUAD_ID);
+			Quad *q = luax_checktype<Quad>(L, -1, Quad::type);
 			quads.push_back(q);
 			quads.push_back(q);
 
 
 			lua_pop(L, 1);
 			lua_pop(L, 1);
@@ -594,7 +594,7 @@ int w_ParticleSystem_setQuads(lua_State *L)
 	{
 	{
 		for (int i = 2; i <= lua_gettop(L); i++)
 		for (int i = 2; i <= lua_gettop(L); i++)
 		{
 		{
-			Quad *q = luax_checktype<Quad>(L, i, GRAPHICS_QUAD_ID);
+			Quad *q = luax_checktype<Quad>(L, i, Quad::type);
 			quads.push_back(q);
 			quads.push_back(q);
 		}
 		}
 	}
 	}
@@ -612,7 +612,7 @@ int w_ParticleSystem_getQuads(lua_State *L)
 
 
 	for (int i = 0; i < (int) quads.size(); i++)
 	for (int i = 0; i < (int) quads.size(); i++)
 	{
 	{
-		luax_pushtype(L, GRAPHICS_QUAD_ID, quads[i]);
+		luax_pushtype(L, Quad::type, quads[i]);
 		lua_rawseti(L, -2, i + 1);
 		lua_rawseti(L, -2, i + 1);
 	}
 	}
 
 
@@ -772,7 +772,7 @@ static const luaL_Reg w_ParticleSystem_functions[] =
 
 
 extern "C" int luaopen_particlesystem(lua_State *L)
 extern "C" int luaopen_particlesystem(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_PARTICLE_SYSTEM_ID, "ParticleSystem", w_ParticleSystem_functions, nullptr);
+	return luax_register_type(L, ParticleSystem::type, "ParticleSystem", w_ParticleSystem_functions, nullptr);
 }
 }
 
 
 } // opengl
 } // opengl

+ 2 - 2
src/modules/graphics/opengl/wrap_Shader.cpp

@@ -35,7 +35,7 @@ namespace opengl
 
 
 Shader *luax_checkshader(lua_State *L, int idx)
 Shader *luax_checkshader(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Shader>(L, idx, GRAPHICS_SHADER_ID);
+	return luax_checktype<Shader>(L, idx, Shader::type);
 }
 }
 
 
 int w_Shader_getWarnings(lua_State *L)
 int w_Shader_getWarnings(lua_State *L)
@@ -317,7 +317,7 @@ static const luaL_Reg w_Shader_functions[] =
 
 
 extern "C" int luaopen_shader(lua_State *L)
 extern "C" int luaopen_shader(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_SHADER_ID, "Shader", w_Shader_functions, nullptr);
+	return luax_register_type(L, Shader::type, "Shader", w_Shader_functions, nullptr);
 }
 }
 
 
 } // opengl
 } // opengl

+ 7 - 7
src/modules/graphics/opengl/wrap_SpriteBatch.cpp

@@ -36,16 +36,16 @@ namespace opengl
 
 
 SpriteBatch *luax_checkspritebatch(lua_State *L, int idx)
 SpriteBatch *luax_checkspritebatch(lua_State *L, int idx)
 {
 {
-	return luax_checktype<SpriteBatch>(L, idx, GRAPHICS_SPRITE_BATCH_ID);
+	return luax_checktype<SpriteBatch>(L, idx, SpriteBatch::type);
 }
 }
 
 
 static inline int w_SpriteBatch_add_or_set(lua_State *L, SpriteBatch *t, int startidx, int index)
 static inline int w_SpriteBatch_add_or_set(lua_State *L, SpriteBatch *t, int startidx, int index)
 {
 {
 	Quad *quad = nullptr;
 	Quad *quad = nullptr;
 
 
-	if (luax_istype(L, startidx, GRAPHICS_QUAD_ID))
+	if (luax_istype(L, startidx, Quad::type))
 	{
 	{
-		quad = luax_totype<Quad>(L, startidx, GRAPHICS_QUAD_ID);
+		quad = luax_totype<Quad>(L, startidx, Quad::type);
 		startidx++;
 		startidx++;
 	}
 	}
 	else if (lua_isnil(L, startidx) && !lua_isnoneornil(L, startidx + 1))
 	else if (lua_isnil(L, startidx) && !lua_isnoneornil(L, startidx + 1))
@@ -122,9 +122,9 @@ int w_SpriteBatch_getTexture(lua_State *L)
 
 
 	// FIXME: big hack right here.
 	// FIXME: big hack right here.
 	if (typeid(*tex) == typeid(Image))
 	if (typeid(*tex) == typeid(Image))
-		luax_pushtype(L, GRAPHICS_IMAGE_ID, tex);
+		luax_pushtype(L, Image::type, tex);
 	else if (typeid(*tex) == typeid(Canvas))
 	else if (typeid(*tex) == typeid(Canvas))
-		luax_pushtype(L, GRAPHICS_CANVAS_ID, tex);
+		luax_pushtype(L, Canvas::type, tex);
 	else
 	else
 		return luaL_error(L, "Unable to determine texture type.");
 		return luaL_error(L, "Unable to determine texture type.");
 
 
@@ -201,7 +201,7 @@ int w_SpriteBatch_attachAttribute(lua_State *L)
 {
 {
 	SpriteBatch *t = luax_checkspritebatch(L, 1);
 	SpriteBatch *t = luax_checkspritebatch(L, 1);
 	const char *name = luaL_checkstring(L, 2);
 	const char *name = luaL_checkstring(L, 2);
-	Mesh *m = luax_checktype<Mesh>(L, 3, GRAPHICS_MESH_ID);
+	Mesh *m = luax_checktype<Mesh>(L, 3, Mesh::type);
 
 
 	luax_catchexcept(L, [&](){ t->attachAttribute(name, m); });
 	luax_catchexcept(L, [&](){ t->attachAttribute(name, m); });
 	return 0;
 	return 0;
@@ -257,7 +257,7 @@ static const luaL_Reg w_SpriteBatch_functions[] =
 
 
 extern "C" int luaopen_spritebatch(lua_State *L)
 extern "C" int luaopen_spritebatch(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_SPRITE_BATCH_ID, "SpriteBatch", w_SpriteBatch_functions, nullptr);
+	return luax_register_type(L, SpriteBatch::type, "SpriteBatch", w_SpriteBatch_functions, nullptr);
 }
 }
 
 
 } // opengl
 } // opengl

+ 4 - 4
src/modules/graphics/opengl/wrap_Text.cpp

@@ -29,7 +29,7 @@ namespace opengl
 
 
 Text *luax_checktext(lua_State *L, int idx)
 Text *luax_checktext(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Text>(L, idx, GRAPHICS_TEXT_ID);
+	return luax_checktype<Text>(L, idx, Text::type);
 }
 }
 
 
 void luax_checkcoloredstring(lua_State *L, int idx, std::vector<Font::ColoredString> &strings)
 void luax_checkcoloredstring(lua_State *L, int idx, std::vector<Font::ColoredString> &strings)
@@ -190,7 +190,7 @@ int w_Text_clear(lua_State *L)
 int w_Text_setFont(lua_State *L)
 int w_Text_setFont(lua_State *L)
 {
 {
 	Text *t = luax_checktext(L, 1);
 	Text *t = luax_checktext(L, 1);
-	Font *f = luax_checktype<Font>(L, 2, GRAPHICS_FONT_ID);
+	Font *f = luax_checktype<Font>(L, 2, Font::type);
 	luax_catchexcept(L, [&](){ t->setFont(f); });
 	luax_catchexcept(L, [&](){ t->setFont(f); });
 	return 0;
 	return 0;
 }
 }
@@ -199,7 +199,7 @@ int w_Text_getFont(lua_State *L)
 {
 {
 	Text *t = luax_checktext(L, 1);
 	Text *t = luax_checktext(L, 1);
 	Font *f = t->getFont();
 	Font *f = t->getFont();
-	luax_pushtype(L, GRAPHICS_FONT_ID, f);
+	luax_pushtype(L, Font::type, f);
 	return 1;
 	return 1;
 }
 }
 
 
@@ -245,7 +245,7 @@ static const luaL_Reg w_Text_functions[] =
 
 
 extern "C" int luaopen_text(lua_State *L)
 extern "C" int luaopen_text(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_TEXT_ID, "Text", w_Text_functions, nullptr);
+	return luax_register_type(L, Text::type, "Text", w_Text_functions, nullptr);
 }
 }
 
 
 } // opengl
 } // opengl

+ 6 - 6
src/modules/graphics/opengl/wrap_Video.cpp

@@ -34,13 +34,13 @@ namespace opengl
 
 
 Video *luax_checkvideo(lua_State *L, int idx)
 Video *luax_checkvideo(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Video>(L, idx, GRAPHICS_VIDEO_ID);
+	return luax_checktype<Video>(L, idx, Video::type);
 }
 }
 
 
 int w_Video_getStream(lua_State *L)
 int w_Video_getStream(lua_State *L)
 {
 {
 	Video *video = luax_checkvideo(L, 1);
 	Video *video = luax_checkvideo(L, 1);
-	luax_pushtype(L, VIDEO_VIDEO_STREAM_ID, video->getStream());
+	luax_pushtype(L, love::video::VideoStream::type, video->getStream());
 	return 1;
 	return 1;
 }
 }
 
 
@@ -49,7 +49,7 @@ int w_Video_getSource(lua_State *L)
 	Video *video = luax_checkvideo(L, 1);
 	Video *video = luax_checkvideo(L, 1);
 	auto source = video->getSource();
 	auto source = video->getSource();
 	if (source)
 	if (source)
-		luax_pushtype(L, AUDIO_SOURCE_ID, video->getSource());
+		luax_pushtype(L, love::audio::Source::type, video->getSource());
 	else
 	else
 		lua_pushnil(L);
 		lua_pushnil(L);
 	return 1;
 	return 1;
@@ -62,7 +62,7 @@ int w_Video_setSource(lua_State *L)
 		video->setSource(nullptr);
 		video->setSource(nullptr);
 	else
 	else
 	{
 	{
-		auto source = luax_checktype<love::audio::Source>(L, 2, AUDIO_SOURCE_ID);
+		auto source = luax_checktype<love::audio::Source>(L, 2, love::audio::Source::type);
 		video->setSource(source);
 		video->setSource(source);
 	}
 	}
 	return 0;
 	return 0;
@@ -143,10 +143,10 @@ static const luaL_Reg functions[] =
 
 
 int luaopen_video(lua_State *L)
 int luaopen_video(lua_State *L)
 {
 {
-	int ret = luax_register_type(L, GRAPHICS_VIDEO_ID, "Video", functions, nullptr);
+	int ret = luax_register_type(L, Video::type, "Video", functions, nullptr);
 
 
 	luaL_loadbuffer(L, video_lua, sizeof(video_lua), "Video.lua");
 	luaL_loadbuffer(L, video_lua, sizeof(video_lua), "Video.lua");
-	luax_gettypemetatable(L, GRAPHICS_VIDEO_ID);
+	luax_gettypemetatable(L, Video::type);
 	lua_call(L, 1, 0);
 	lua_call(L, 1, 0);
 
 
 	return ret;
 	return ret;

+ 2 - 2
src/modules/graphics/wrap_Quad.cpp

@@ -28,7 +28,7 @@ namespace graphics
 
 
 Quad *luax_checkquad(lua_State *L, int idx)
 Quad *luax_checkquad(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Quad>(L, idx, GRAPHICS_QUAD_ID);
+	return luax_checktype<Quad>(L, idx, Quad::type);
 }
 }
 
 
 int w_Quad_setViewport(lua_State *L)
 int w_Quad_setViewport(lua_State *L)
@@ -84,7 +84,7 @@ static const luaL_Reg w_Quad_functions[] =
 
 
 extern "C" int luaopen_quad(lua_State *L)
 extern "C" int luaopen_quad(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_QUAD_ID, "Quad", w_Quad_functions, nullptr);
+	return luax_register_type(L, Quad::type, "Quad", w_Quad_functions, nullptr);
 }
 }
 
 
 } // graphics
 } // graphics

+ 2 - 2
src/modules/graphics/wrap_Texture.cpp

@@ -27,7 +27,7 @@ namespace graphics
 
 
 Texture *luax_checktexture(lua_State *L, int idx)
 Texture *luax_checktexture(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Texture>(L, idx, GRAPHICS_TEXTURE_ID);
+	return luax_checktype<Texture>(L, idx, Texture::type);
 }
 }
 
 
 int w_Texture_getWidth(lua_State *L)
 int w_Texture_getWidth(lua_State *L)
@@ -139,7 +139,7 @@ const luaL_Reg w_Texture_functions[] =
 
 
 extern "C" int luaopen_texture(lua_State *L)
 extern "C" int luaopen_texture(lua_State *L)
 {
 {
-	return luax_register_type(L, GRAPHICS_TEXTURE_ID, "Texture", w_Texture_functions, nullptr);
+	return luax_register_type(L, Texture::type, "Texture", w_Texture_functions, nullptr);
 }
 }
 
 
 } // graphics
 } // graphics

+ 2 - 0
src/modules/image/CompressedImageData.cpp

@@ -25,6 +25,8 @@ namespace love
 namespace image
 namespace image
 {
 {
 
 
+love::Type CompressedImageData::type(&Data::type);
+
 CompressedImageData::CompressedImageData()
 CompressedImageData::CompressedImageData()
 	: format(FORMAT_UNKNOWN)
 	: format(FORMAT_UNKNOWN)
 	, sRGB(false)
 	, sRGB(false)

+ 2 - 0
src/modules/image/CompressedImageData.h

@@ -43,6 +43,8 @@ class CompressedImageData : public Data
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	// Recognized compressed image data formats.
 	// Recognized compressed image data formats.
 	enum Format
 	enum Format
 	{
 	{

+ 2 - 0
src/modules/image/Image.h

@@ -44,6 +44,8 @@ class Image : public Module
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	virtual ~Image() {}
 	virtual ~Image() {}
 
 
 	// Implements Module.
 	// Implements Module.

+ 2 - 0
src/modules/image/ImageData.cpp

@@ -27,6 +27,8 @@ namespace love
 namespace image
 namespace image
 {
 {
 
 
+love::Type ImageData::type(&Data::type);
+
 ImageData::ImageData()
 ImageData::ImageData()
 	: data(nullptr)
 	: data(nullptr)
 {
 {

+ 2 - 0
src/modules/image/ImageData.h

@@ -58,6 +58,8 @@ class ImageData : public Data
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	enum Format
 	enum Format
 	{
 	{
 		FORMAT_RGBA8,
 		FORMAT_RGBA8,

+ 2 - 2
src/modules/image/wrap_CompressedImageData.cpp

@@ -28,7 +28,7 @@ namespace image
 
 
 CompressedImageData *luax_checkcompressedimagedata(lua_State *L, int idx)
 CompressedImageData *luax_checkcompressedimagedata(lua_State *L, int idx)
 {
 {
-	return luax_checktype<CompressedImageData>(L, idx, IMAGE_COMPRESSED_IMAGE_DATA_ID);
+	return luax_checktype<CompressedImageData>(L, idx, CompressedImageData::type);
 }
 }
 
 
 int w_CompressedImageData_getWidth(lua_State *L)
 int w_CompressedImageData_getWidth(lua_State *L)
@@ -106,7 +106,7 @@ static const luaL_Reg w_CompressedImageData_functions[] =
 
 
 extern "C" int luaopen_compressedimagedata(lua_State *L)
 extern "C" int luaopen_compressedimagedata(lua_State *L)
 {
 {
-	return luax_register_type(L, IMAGE_COMPRESSED_IMAGE_DATA_ID, "CompressedImageData", w_Data_functions, w_CompressedImageData_functions, nullptr);
+	return luax_register_type(L, CompressedImageData::type, "CompressedImageData", w_Data_functions, w_CompressedImageData_functions, nullptr);
 }
 }
 
 
 } // image
 } // image

+ 4 - 4
src/modules/image/wrap_Image.cpp

@@ -73,7 +73,7 @@ int w_newImageData(lua_State *L)
 			memcpy(t->getData(), bytes, t->getSize());
 			memcpy(t->getData(), bytes, t->getSize());
 		}
 		}
 
 
-		luax_pushtype(L, IMAGE_IMAGE_DATA_ID, t);
+		luax_pushtype(L, ImageData::type, t);
 		t->release();
 		t->release();
 		return 1;
 		return 1;
 	}
 	}
@@ -87,7 +87,7 @@ int w_newImageData(lua_State *L)
 			[&](bool) { data->release(); }
 			[&](bool) { data->release(); }
 		);
 		);
 
 
-		luax_pushtype(L, IMAGE_IMAGE_DATA_ID, t);
+		luax_pushtype(L, ImageData::type, t);
 		t->release();
 		t->release();
 		return 1;
 		return 1;
 	}
 	}
@@ -107,7 +107,7 @@ int w_newCompressedData(lua_State *L)
 		[&](bool) { data->release(); }
 		[&](bool) { data->release(); }
 	);
 	);
 
 
-	luax_pushtype(L, IMAGE_COMPRESSED_IMAGE_DATA_ID, t);
+	luax_pushtype(L, CompressedImageData::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -151,7 +151,7 @@ extern "C" int luaopen_love_image(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = instance;
 	w.module = instance;
 	w.name = "image";
 	w.name = "image";
-	w.type = MODULE_IMAGE_ID;
+	w.type = &Image::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = types;
 	w.types = types;
 
 

+ 4 - 4
src/modules/image/wrap_ImageData.cpp

@@ -40,7 +40,7 @@ namespace image
 
 
 ImageData *luax_checkimagedata(lua_State *L, int idx)
 ImageData *luax_checkimagedata(lua_State *L, int idx)
 {
 {
-	return luax_checktype<ImageData>(L, idx, IMAGE_IMAGE_DATA_ID);
+	return luax_checktype<ImageData>(L, idx, ImageData::type);
 }
 }
 
 
 int w_ImageData_getFormat(lua_State *L)
 int w_ImageData_getFormat(lua_State *L)
@@ -282,7 +282,7 @@ int w_ImageData_encode(lua_State *L)
 	love::filesystem::FileData *filedata = nullptr;
 	love::filesystem::FileData *filedata = nullptr;
 	luax_catchexcept(L, [&](){ filedata = t->encode(format, filename.c_str()); });
 	luax_catchexcept(L, [&](){ filedata = t->encode(format, filename.c_str()); });
 
 
-	luax_pushtype(L, FILESYSTEM_FILE_DATA_ID, filedata);
+	luax_pushtype(L, love::filesystem::FileData::type, filedata);
 	filedata->release();
 	filedata->release();
 
 
 	if (hasfilename)
 	if (hasfilename)
@@ -366,9 +366,9 @@ static const luaL_Reg w_ImageData_functions[] =
 
 
 extern "C" int luaopen_imagedata(lua_State *L)
 extern "C" int luaopen_imagedata(lua_State *L)
 {
 {
-	int ret = luax_register_type(L, IMAGE_IMAGE_DATA_ID, "ImageData", w_Data_functions, w_ImageData_functions, nullptr);
+	int ret = luax_register_type(L, ImageData::type, "ImageData", w_Data_functions, w_ImageData_functions, nullptr);
 
 
-	luax_gettypemetatable(L, IMAGE_IMAGE_DATA_ID);
+	luax_gettypemetatable(L, ImageData::type);
 
 
 	// Load and execute ImageData.lua, sending the metatable and the ffi
 	// Load and execute ImageData.lua, sending the metatable and the ffi
 	// functions struct pointer as arguments.
 	// functions struct pointer as arguments.

+ 2 - 0
src/modules/joystick/Joystick.cpp

@@ -29,6 +29,8 @@ namespace love
 namespace joystick
 namespace joystick
 {
 {
 
 
+love::Type Joystick::type(&Object::type);
+
 float Joystick::clampval(float x)
 float Joystick::clampval(float x)
 {
 {
 	if (fabsf(x) < 0.01)
 	if (fabsf(x) < 0.01)

+ 2 - 0
src/modules/joystick/Joystick.h

@@ -38,6 +38,8 @@ class Joystick : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	// Joystick hat values.
 	// Joystick hat values.
 	enum Hat
 	enum Hat
 	{
 	{

+ 2 - 2
src/modules/joystick/wrap_Joystick.cpp

@@ -31,7 +31,7 @@ namespace joystick
 
 
 Joystick *luax_checkjoystick(lua_State *L, int idx)
 Joystick *luax_checkjoystick(lua_State *L, int idx)
 {
 {
-	return luax_checktype<Joystick>(L, idx, JOYSTICK_JOYSTICK_ID);
+	return luax_checktype<Joystick>(L, idx, Joystick::type);
 }
 }
 
 
 int w_Joystick_isConnected(lua_State *L)
 int w_Joystick_isConnected(lua_State *L)
@@ -296,7 +296,7 @@ static const luaL_Reg w_Joystick_functions[] =
 
 
 extern "C" int luaopen_joystick(lua_State *L)
 extern "C" int luaopen_joystick(lua_State *L)
 {
 {
-	return luax_register_type(L, JOYSTICK_JOYSTICK_ID, "Joystick", w_Joystick_functions, nullptr);
+	return luax_register_type(L, Joystick::type, "Joystick", w_Joystick_functions, nullptr);
 }
 }
 
 
 } // joystick
 } // joystick

+ 2 - 2
src/modules/joystick/wrap_JoystickModule.cpp

@@ -40,7 +40,7 @@ int w_getJoysticks(lua_State *L)
 	for (int i = 0; i < stickcount; i++)
 	for (int i = 0; i < stickcount; i++)
 	{
 	{
 		Joystick *stick = instance()->getJoystick(i);
 		Joystick *stick = instance()->getJoystick(i);
-		luax_pushtype(L, JOYSTICK_JOYSTICK_ID, stick);
+		luax_pushtype(L, Joystick::type, stick);
 		lua_rawseti(L, -2, i + 1);
 		lua_rawseti(L, -2, i + 1);
 	}
 	}
 
 
@@ -254,7 +254,7 @@ extern "C" int luaopen_love_joystick(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = instance;
 	w.module = instance;
 	w.name = "joystick";
 	w.name = "joystick";
-	w.type = MODULE_ID;
+	w.type = &Module::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = types;
 	w.types = types;
 
 

+ 1 - 1
src/modules/keyboard/wrap_Keyboard.cpp

@@ -201,7 +201,7 @@ extern "C" int luaopen_love_keyboard(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = instance;
 	w.module = instance;
 	w.name = "keyboard";
 	w.name = "keyboard";
-	w.type = MODULE_ID;
+	w.type = &Module::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = 0;
 	w.types = 0;
 
 

+ 2 - 0
src/modules/math/BezierCurve.cpp

@@ -83,6 +83,8 @@ namespace love
 namespace math
 namespace math
 {
 {
 
 
+love::Type BezierCurve::type(&Object::type);
+
 BezierCurve::BezierCurve(const vector<Vector> &pts)
 BezierCurve::BezierCurve(const vector<Vector> &pts)
 	: controlPoints(pts)
 	: controlPoints(pts)
 {
 {

+ 2 - 0
src/modules/math/BezierCurve.h

@@ -35,6 +35,8 @@ class BezierCurve : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	/**
 	/**
 	 * @param controlPoints Control polygon of the curve.
 	 * @param controlPoints Control polygon of the curve.
 	 **/
 	 **/

+ 2 - 0
src/modules/math/CompressedData.cpp

@@ -26,6 +26,8 @@ namespace love
 namespace math
 namespace math
 {
 {
 
 
+love::Type CompressedData::type(&Data::type);
+
 CompressedData::CompressedData(Compressor::Format format, char *cdata, size_t compressedsize, size_t rawsize, bool own)
 CompressedData::CompressedData(Compressor::Format format, char *cdata, size_t compressedsize, size_t rawsize, bool own)
 	: format(format)
 	: format(format)
 	, data(nullptr)
 	, data(nullptr)

+ 2 - 0
src/modules/math/CompressedData.h

@@ -37,6 +37,8 @@ class CompressedData : public love::Data
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	/**
 	/**
 	 * Constructor just stores already-compressed data in the object.
 	 * Constructor just stores already-compressed data in the object.
 	 **/
 	 **/

+ 2 - 0
src/modules/math/RandomGenerator.cpp

@@ -62,6 +62,8 @@ RandomGenerator::RandomGenerator()
 	setSeed(newseed);
 	setSeed(newseed);
 }
 }
 
 
+love::Type RandomGenerator::type(&Object::type);
+
 uint64 RandomGenerator::rand()
 uint64 RandomGenerator::rand()
 {
 {
 	rng_state.b64 ^= (rng_state.b64 >> 12);
 	rng_state.b64 ^= (rng_state.b64 >> 12);

+ 2 - 0
src/modules/math/RandomGenerator.h

@@ -41,6 +41,8 @@ class RandomGenerator : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	union Seed
 	union Seed
 	{
 	{
 		uint64 b64;
 		uint64 b64;

+ 4 - 4
src/modules/math/wrap_BezierCurve.cpp

@@ -30,7 +30,7 @@ namespace math
 
 
 BezierCurve *luax_checkbeziercurve(lua_State *L, int idx)
 BezierCurve *luax_checkbeziercurve(lua_State *L, int idx)
 {
 {
-	return luax_checktype<BezierCurve>(L, idx, MATH_BEZIER_CURVE_ID);
+	return luax_checktype<BezierCurve>(L, idx, BezierCurve::type);
 }
 }
 
 
 int w_BezierCurve_getDegree(lua_State *L)
 int w_BezierCurve_getDegree(lua_State *L)
@@ -44,7 +44,7 @@ int w_BezierCurve_getDerivative(lua_State *L)
 {
 {
 	BezierCurve *curve = luax_checkbeziercurve(L, 1);
 	BezierCurve *curve = luax_checkbeziercurve(L, 1);
 	BezierCurve *deriv = new BezierCurve(curve->getDerivative());
 	BezierCurve *deriv = new BezierCurve(curve->getDerivative());
-	luax_pushtype(L, MATH_BEZIER_CURVE_ID, deriv);
+	luax_pushtype(L, BezierCurve::type, deriv);
 	deriv->release();
 	deriv->release();
 	return 1;
 	return 1;
 }
 }
@@ -165,7 +165,7 @@ int w_BezierCurve_getSegment(lua_State *L)
 
 
 	BezierCurve *segment;
 	BezierCurve *segment;
 	luax_catchexcept(L, [&](){ segment = curve->getSegment(t1, t2); });
 	luax_catchexcept(L, [&](){ segment = curve->getSegment(t1, t2); });
-	luax_pushtype(L, MATH_BEZIER_CURVE_ID, segment);
+	luax_pushtype(L, BezierCurve::type, segment);
 	segment->release();
 	segment->release();
 
 
 	return 1;
 	return 1;
@@ -234,7 +234,7 @@ static const luaL_Reg w_BezierCurve_functions[] =
 
 
 extern "C" int luaopen_beziercurve(lua_State *L)
 extern "C" int luaopen_beziercurve(lua_State *L)
 {
 {
-	return luax_register_type(L, MATH_BEZIER_CURVE_ID, "BezierCurve", w_BezierCurve_functions, nullptr);
+	return luax_register_type(L, BezierCurve::type, "BezierCurve", w_BezierCurve_functions, nullptr);
 }
 }
 
 
 } // math
 } // math

+ 2 - 2
src/modules/math/wrap_CompressedData.cpp

@@ -29,7 +29,7 @@ namespace math
 
 
 CompressedData *luax_checkcompresseddata(lua_State *L, int idx)
 CompressedData *luax_checkcompresseddata(lua_State *L, int idx)
 {
 {
-	return luax_checktype<CompressedData>(L, idx, MATH_COMPRESSED_DATA_ID);
+	return luax_checktype<CompressedData>(L, idx, CompressedData::type);
 }
 }
 
 
 int w_CompressedData_getFormat(lua_State *L)
 int w_CompressedData_getFormat(lua_State *L)
@@ -53,7 +53,7 @@ static const luaL_Reg w_CompressedData_functions[] =
 
 
 extern "C" int luaopen_compresseddata(lua_State *L)
 extern "C" int luaopen_compresseddata(lua_State *L)
 {
 {
-	return luax_register_type(L, MATH_COMPRESSED_DATA_ID, "CompressedData", w_Data_functions, w_CompressedData_functions, nullptr);
+	return luax_register_type(L, CompressedData::type, "CompressedData", w_Data_functions, w_CompressedData_functions, nullptr);
 }
 }
 
 
 } // math
 } // math

+ 14 - 14
src/modules/math/wrap_Math.cpp

@@ -43,7 +43,7 @@ namespace math
 int w__getRandomGenerator(lua_State *L)
 int w__getRandomGenerator(lua_State *L)
 {
 {
 	RandomGenerator *t = Math::instance.getRandomGenerator();
 	RandomGenerator *t = Math::instance.getRandomGenerator();
-	luax_pushtype(L, MATH_RANDOM_GENERATOR_ID, t);
+	luax_pushtype(L, RandomGenerator::type, t);
 	return 1;
 	return 1;
 }
 }
 
 
@@ -74,7 +74,7 @@ int w_newRandomGenerator(lua_State *L)
 			return luaL_error(L, "%s", lua_tostring(L, -1));
 			return luaL_error(L, "%s", lua_tostring(L, -1));
 	}
 	}
 
 
-	luax_pushtype(L, MATH_RANDOM_GENERATOR_ID, t);
+	luax_pushtype(L, RandomGenerator::type, t);
 	t->release();
 	t->release();
 	return 1;
 	return 1;
 }
 }
@@ -113,7 +113,7 @@ int w_newBezierCurve(lua_State *L)
 	}
 	}
 
 
 	BezierCurve *curve = Math::instance.newBezierCurve(points);
 	BezierCurve *curve = Math::instance.newBezierCurve(points);
-	luax_pushtype(L, MATH_BEZIER_CURVE_ID, curve);
+	luax_pushtype(L, BezierCurve::type, curve);
 	curve->release();
 	curve->release();
 	return 1;
 	return 1;
 }
 }
@@ -338,11 +338,11 @@ int w_compress(lua_State *L)
 	}
 	}
 	else
 	else
 	{
 	{
-		Data *rawdata = luax_checktype<Data>(L, 1, DATA_ID);
+		Data *rawdata = luax_checktype<Data>(L, 1, Data::type);
 		luax_catchexcept(L, [&](){ cdata = compress(format, rawdata, level); });
 		luax_catchexcept(L, [&](){ cdata = compress(format, rawdata, level); });
 	}
 	}
 
 
-	luax_pushtype(L, MATH_COMPRESSED_DATA_ID, cdata);
+	luax_pushtype(L, CompressedData::type, cdata);
 	return 1;
 	return 1;
 }
 }
 
 
@@ -351,7 +351,7 @@ int w_decompress(lua_State *L)
 	char *rawbytes = nullptr;
 	char *rawbytes = nullptr;
 	size_t rawsize = 0;
 	size_t rawsize = 0;
 
 
-	if (luax_istype(L, 1, MATH_COMPRESSED_DATA_ID))
+	if (luax_istype(L, 1, CompressedData::type))
 	{
 	{
 		CompressedData *data = luax_checkcompresseddata(L, 1);
 		CompressedData *data = luax_checkcompresseddata(L, 1);
 		rawsize = data->getDecompressedSize();
 		rawsize = data->getDecompressedSize();
@@ -368,9 +368,9 @@ int w_decompress(lua_State *L)
 		size_t compressedsize = 0;
 		size_t compressedsize = 0;
 		const char *cbytes = nullptr;
 		const char *cbytes = nullptr;
 
 
-		if (luax_istype(L, 1, DATA_ID))
+		if (luax_istype(L, 1, Data::type))
 		{
 		{
-			Data *data = luax_checktype<Data>(L, 1, DATA_ID);
+			Data *data = luax_checktype<Data>(L, 1, Data::type);
 			cbytes = (const char *) data->getData();
 			cbytes = (const char *) data->getData();
 			compressedsize = data->getSize();
 			compressedsize = data->getSize();
 		}
 		}
@@ -396,9 +396,9 @@ int w_encode(lua_State *L)
 	size_t srclen = 0;
 	size_t srclen = 0;
 	const char *src = nullptr;
 	const char *src = nullptr;
 
 
-	if (luax_istype(L, 2, DATA_ID))
+	if (luax_istype(L, 2, Data::type))
 	{
 	{
-		Data *data = luax_totype<Data>(L, 2, DATA_ID);
+		Data *data = luax_totype<Data>(L, 2, Data::type);
 		src = (const char *) data->getData();
 		src = (const char *) data->getData();
 		srclen = data->getSize();
 		srclen = data->getSize();
 	}
 	}
@@ -430,9 +430,9 @@ int w_decode(lua_State *L)
 	size_t srclen = 0;
 	size_t srclen = 0;
 	const char *src = nullptr;
 	const char *src = nullptr;
 
 
-	if (luax_istype(L, 2, DATA_ID))
+	if (luax_istype(L, 2, Data::type))
 	{
 	{
-		Data *data = luax_totype<Data>(L, 2, DATA_ID);
+		Data *data = luax_totype<Data>(L, 2, Data::type);
 		src = (const char *) data->getData();
 		src = (const char *) data->getData();
 		srclen = data->getSize();
 		srclen = data->getSize();
 	}
 	}
@@ -468,7 +468,7 @@ int w_hash(lua_State *L)
 	}
 	}
 	else
 	else
 	{
 	{
-		Data *rawdata = luax_checktype<Data>(L, 2, DATA_ID);
+		Data *rawdata = luax_checktype<Data>(L, 2, Data::type);
 		luax_catchexcept(L, [&](){ hash = love::math::hash(function, rawdata); });
 		luax_catchexcept(L, [&](){ hash = love::math::hash(function, rawdata); });
 	}
 	}
 
 
@@ -535,7 +535,7 @@ extern "C" int luaopen_love_math(lua_State *L)
 	WrappedModule w;
 	WrappedModule w;
 	w.module = &Math::instance;
 	w.module = &Math::instance;
 	w.name = "math";
 	w.name = "math";
-	w.type = MODULE_ID;
+	w.type = &Module::type;
 	w.functions = functions;
 	w.functions = functions;
 	w.types = types;
 	w.types = types;
 
 

+ 4 - 4
src/modules/math/wrap_RandomGenerator.cpp

@@ -63,7 +63,7 @@ RandomGenerator::Seed luax_checkrandomseed(lua_State *L, int idx)
 
 
 RandomGenerator *luax_checkrandomgenerator(lua_State *L, int idx)
 RandomGenerator *luax_checkrandomgenerator(lua_State *L, int idx)
 {
 {
-	return luax_checktype<RandomGenerator>(L, idx, MATH_RANDOM_GENERATOR_ID);
+	return luax_checktype<RandomGenerator>(L, idx, RandomGenerator::type);
 }
 }
 
 
 int w_RandomGenerator__random(lua_State *L)
 int w_RandomGenerator__random(lua_State *L)
@@ -126,7 +126,7 @@ static FFI_RandomGenerator ffifuncs =
 	[](Proxy *p) -> double // random()
 	[](Proxy *p) -> double // random()
 	{
 	{
 		// FIXME: We need better type-checking...
 		// FIXME: We need better type-checking...
-		if (p == nullptr || p->object == nullptr || !typeFlags[p->type][MATH_RANDOM_GENERATOR_ID])
+		if (p == nullptr || p->object == nullptr || p->type == nullptr || !p->type->isa(RandomGenerator::type))
 			return 0.0;
 			return 0.0;
 
 
 		RandomGenerator *rng = (RandomGenerator *) p->object;
 		RandomGenerator *rng = (RandomGenerator *) p->object;
@@ -147,9 +147,9 @@ static const luaL_Reg w_RandomGenerator_functions[] =
 
 
 extern "C" int luaopen_randomgenerator(lua_State *L)
 extern "C" int luaopen_randomgenerator(lua_State *L)
 {
 {
-	int n = luax_register_type(L, MATH_RANDOM_GENERATOR_ID, "RandomGenerator", w_RandomGenerator_functions, nullptr);
+	int n = luax_register_type(L, RandomGenerator::type, "RandomGenerator", w_RandomGenerator_functions, nullptr);
 
 
-	luax_gettypemetatable(L, MATH_RANDOM_GENERATOR_ID);
+	luax_gettypemetatable(L, RandomGenerator::type);
 
 
 	// Load and execute wrap_RandomGenerator.lua, sending the metatable and the
 	// Load and execute wrap_RandomGenerator.lua, sending the metatable and the
 	// ffi functions struct pointer as arguments.
 	// ffi functions struct pointer as arguments.

+ 2 - 0
src/modules/mouse/Cursor.cpp

@@ -25,6 +25,8 @@ namespace love
 namespace mouse
 namespace mouse
 {
 {
 
 
+love::Type Cursor::type(&Object::type);
+
 Cursor::~Cursor()
 Cursor::~Cursor()
 {
 {
 }
 }

+ 2 - 0
src/modules/mouse/Cursor.h

@@ -35,6 +35,8 @@ class Cursor : public Object
 {
 {
 public:
 public:
 
 
+	static love::Type type;
+
 	// Types of system cursors.
 	// Types of system cursors.
 	enum SystemCursor
 	enum SystemCursor
 	{
 	{

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