mirror of
https://github.com/love2d/love.git
synced 2026-08-16 16:20:42 +02:00
Make love::Type handle type names
TODO: Fix undefined behaviour in luax_register_type, you can't use a va_list after a reference type --HG-- branch : dynamiccore2
This commit is contained in:
@@ -58,7 +58,7 @@ void unGammaCorrectColor(Colorf &c)
|
||||
}
|
||||
}
|
||||
|
||||
love::Type Graphics::type(&Module::type);
|
||||
love::Type Graphics::type("graphics", &Module::type);
|
||||
|
||||
Graphics::~Graphics()
|
||||
{
|
||||
|
||||
@@ -50,7 +50,7 @@ float calculate_variation(float inner, float outer, float var)
|
||||
|
||||
} // anonymous namespace
|
||||
|
||||
love::Type ParticleSystem::type(&Drawable::type);
|
||||
love::Type ParticleSystem::type("ParticleSystem", &Drawable::type);
|
||||
|
||||
ParticleSystem::ParticleSystem(Texture *texture, uint32 size)
|
||||
: pMem(nullptr)
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace love
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
love::Type Quad::type(&Object::type);
|
||||
love::Type Quad::type("Quad", &Object::type);
|
||||
|
||||
Quad::Quad(const Quad::Viewport &v, double sw, double sh)
|
||||
: sw(sw)
|
||||
|
||||
@@ -25,8 +25,7 @@ namespace love
|
||||
namespace graphics
|
||||
{
|
||||
|
||||
love::Type Texture::type(&Drawable::type);
|
||||
|
||||
love::Type Texture::type("Texture", &Drawable::type);
|
||||
Texture::Filter Texture::defaultFilter;
|
||||
|
||||
Texture::Texture()
|
||||
|
||||
@@ -88,7 +88,7 @@ static GLenum createMSAABuffer(int width, int height, int &samples, GLenum iform
|
||||
return status;
|
||||
}
|
||||
|
||||
love::Type Canvas::type(&Texture::type);
|
||||
love::Type Canvas::type("Canvas", &Texture::type);
|
||||
Canvas *Canvas::current = nullptr;
|
||||
OpenGL::Viewport Canvas::systemViewport = OpenGL::Viewport();
|
||||
bool Canvas::screenHasSRGB = false;
|
||||
|
||||
@@ -39,13 +39,12 @@ namespace graphics
|
||||
namespace opengl
|
||||
{
|
||||
|
||||
love::Type Font::type(&Object::type);
|
||||
|
||||
static inline uint16 normToUint16(double n)
|
||||
{
|
||||
return (uint16) (n * LOVE_UINT16_MAX);
|
||||
}
|
||||
|
||||
love::Type Font::type("Font", &Object::type);
|
||||
int Font::fontCount = 0;
|
||||
|
||||
Font::Font(love::font::Rasterizer *r, const Texture::Filter &filter)
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace graphics
|
||||
namespace opengl
|
||||
{
|
||||
|
||||
love::Type Image::type(&Texture::type);
|
||||
love::Type Image::type("Image", &Texture::type);
|
||||
|
||||
int Image::imageCount = 0;
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ static std::vector<Mesh::AttribFormat> getDefaultVertexFormat()
|
||||
return vertexformat;
|
||||
}
|
||||
|
||||
love::Type Mesh::type(&Drawable::type);
|
||||
love::Type Mesh::type("Mesh", &Drawable::type);
|
||||
|
||||
Mesh::Mesh(const std::vector<AttribFormat> &vertexformat, const void *data, size_t datasize, DrawMode drawmode, Usage usage)
|
||||
: vertexFormat(vertexformat)
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace
|
||||
} // anonymous namespace
|
||||
|
||||
|
||||
love::Type Shader::type(&Object::type);
|
||||
love::Type Shader::type("Shader", &Object::type);
|
||||
Shader *Shader::current = nullptr;
|
||||
Shader *Shader::defaultShader = nullptr;
|
||||
Shader *Shader::defaultVideoShader = nullptr;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace graphics
|
||||
namespace opengl
|
||||
{
|
||||
|
||||
love::Type SpriteBatch::type(&Drawable::type);
|
||||
love::Type SpriteBatch::type("SpriteBatch", &Drawable::type);
|
||||
|
||||
SpriteBatch::SpriteBatch(Texture *texture, int size, Mesh::Usage usage)
|
||||
: texture(texture)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace graphics
|
||||
namespace opengl
|
||||
{
|
||||
|
||||
love::Type Text::type(&Drawable::type);
|
||||
love::Type Text::type("Text", &Drawable::type);
|
||||
|
||||
Text::Text(Font *font, const std::vector<Font::ColoredString> &text)
|
||||
: font(font)
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace graphics
|
||||
namespace opengl
|
||||
{
|
||||
|
||||
love::Type Video::type(&Drawable::type);
|
||||
love::Type Video::type("Video", &Drawable::type);
|
||||
|
||||
Video::Video(love::video::VideoStream *stream)
|
||||
: stream(stream)
|
||||
|
||||
@@ -112,7 +112,7 @@ static const luaL_Reg w_Canvas_functions[] =
|
||||
|
||||
extern "C" int luaopen_canvas(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Canvas::type, "Canvas", w_Texture_functions, w_Canvas_functions, nullptr);
|
||||
return luax_register_type(L, Canvas::type, w_Texture_functions, w_Canvas_functions, nullptr);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -207,7 +207,7 @@ static const luaL_Reg w_Font_functions[] =
|
||||
|
||||
extern "C" int luaopen_font(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Font::type, "Font", w_Font_functions, nullptr);
|
||||
return luax_register_type(L, Font::type, w_Font_functions, nullptr);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -2090,7 +2090,7 @@ static const luaL_Reg functions[] =
|
||||
|
||||
static int luaopen_drawable(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Drawable::type, "Drawable", nullptr);
|
||||
return luax_register_type(L, Drawable::type, nullptr);
|
||||
}
|
||||
|
||||
// Types for this module.
|
||||
|
||||
@@ -150,7 +150,7 @@ static const luaL_Reg w_Image_functions[] =
|
||||
|
||||
extern "C" int luaopen_image(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Image::type, "Image", w_Texture_functions, w_Image_functions, nullptr);
|
||||
return luax_register_type(L, Image::type, w_Texture_functions, w_Image_functions, nullptr);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -528,7 +528,7 @@ static const luaL_Reg w_Mesh_functions[] =
|
||||
|
||||
extern "C" int luaopen_mesh(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Mesh::type, "Mesh", w_Mesh_functions, nullptr);
|
||||
return luax_register_type(L, Mesh::type, w_Mesh_functions, nullptr);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -772,7 +772,7 @@ static const luaL_Reg w_ParticleSystem_functions[] =
|
||||
|
||||
extern "C" int luaopen_particlesystem(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, ParticleSystem::type, "ParticleSystem", w_ParticleSystem_functions, nullptr);
|
||||
return luax_register_type(L, ParticleSystem::type, w_ParticleSystem_functions, nullptr);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -317,7 +317,7 @@ static const luaL_Reg w_Shader_functions[] =
|
||||
|
||||
extern "C" int luaopen_shader(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Shader::type, "Shader", w_Shader_functions, nullptr);
|
||||
return luax_register_type(L, Shader::type, w_Shader_functions, nullptr);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -257,7 +257,7 @@ static const luaL_Reg w_SpriteBatch_functions[] =
|
||||
|
||||
extern "C" int luaopen_spritebatch(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, SpriteBatch::type, "SpriteBatch", w_SpriteBatch_functions, nullptr);
|
||||
return luax_register_type(L, SpriteBatch::type, w_SpriteBatch_functions, nullptr);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -245,7 +245,7 @@ static const luaL_Reg w_Text_functions[] =
|
||||
|
||||
extern "C" int luaopen_text(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Text::type, "Text", w_Text_functions, nullptr);
|
||||
return luax_register_type(L, Text::type, w_Text_functions, nullptr);
|
||||
}
|
||||
|
||||
} // opengl
|
||||
|
||||
@@ -143,7 +143,7 @@ static const luaL_Reg functions[] =
|
||||
|
||||
int luaopen_video(lua_State *L)
|
||||
{
|
||||
int ret = luax_register_type(L, Video::type, "Video", functions, nullptr);
|
||||
int ret = luax_register_type(L, Video::type, functions, nullptr);
|
||||
|
||||
luaL_loadbuffer(L, video_lua, sizeof(video_lua), "Video.lua");
|
||||
luax_gettypemetatable(L, Video::type);
|
||||
|
||||
@@ -84,7 +84,7 @@ static const luaL_Reg w_Quad_functions[] =
|
||||
|
||||
extern "C" int luaopen_quad(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Quad::type, "Quad", w_Quad_functions, nullptr);
|
||||
return luax_register_type(L, Quad::type, w_Quad_functions, nullptr);
|
||||
}
|
||||
|
||||
} // graphics
|
||||
|
||||
@@ -139,7 +139,7 @@ const luaL_Reg w_Texture_functions[] =
|
||||
|
||||
extern "C" int luaopen_texture(lua_State *L)
|
||||
{
|
||||
return luax_register_type(L, Texture::type, "Texture", w_Texture_functions, nullptr);
|
||||
return luax_register_type(L, Texture::type, w_Texture_functions, nullptr);
|
||||
}
|
||||
|
||||
} // graphics
|
||||
|
||||
Reference in New Issue
Block a user