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

--HG--
branch : dynamiccore2
This commit is contained in:
Bart van Strien
2016-11-13 16:38:57 +01:00
parent 452a8a877e
commit c761202486
192 changed files with 734 additions and 614 deletions
+6 -6
View File
@@ -27,23 +27,23 @@ namespace video
VideoStream *luax_checkvideostream(lua_State *L, int idx)
{
return luax_checktype<VideoStream>(L, idx, VIDEO_VIDEO_STREAM_ID);
return luax_checktype<VideoStream>(L, idx, VideoStream::type);
}
int w_VideoStream_setSync(lua_State *L)
{
auto stream = luax_checkvideostream(L, 1);
if (luax_istype(L, 2, AUDIO_SOURCE_ID))
if (luax_istype(L, 2, love::audio::Source::type))
{
auto src = luax_totype<love::audio::Source>(L, 2, AUDIO_SOURCE_ID);
auto src = luax_totype<love::audio::Source>(L, 2, love::audio::Source::type);
auto sync = new VideoStream::SourceSync(src);
stream->setSync(sync);
sync->release();
}
else if (luax_istype(L, 2, VIDEO_VIDEO_STREAM_ID))
else if (luax_istype(L, 2, VideoStream::type))
{
auto other = luax_totype<VideoStream>(L, 2, VIDEO_VIDEO_STREAM_ID);
auto other = luax_totype<VideoStream>(L, 2, VideoStream::type);
stream->setSync(other->getSync());
}
else if (lua_isnoneornil(L, 2))
@@ -124,7 +124,7 @@ static const luaL_Reg videostream_functions[] =
int luaopen_videostream(lua_State *L)
{
return luax_register_type(L, VIDEO_VIDEO_STREAM_ID, "VideoStream", videostream_functions, nullptr);
return luax_register_type(L, VideoStream::type, "VideoStream", videostream_functions, nullptr);
}
} // video