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
+2
View File
@@ -27,6 +27,8 @@ namespace love
namespace video
{
love::Type VideoStream::type(&Stream::type);
void VideoStream::setSync(VideoStream::FrameSync *frameSync)
{
this->frameSync = frameSync;
+3
View File
@@ -34,6 +34,9 @@ namespace video
class VideoStream : public Stream
{
public:
static love::Type type;
virtual ~VideoStream() {}
virtual int getWidth() const = 0;
+2 -2
View File
@@ -45,7 +45,7 @@ int w_newVideoStream(lua_State *L)
stream = instance()->newVideoStream(file);
});
luax_pushtype(L, VIDEO_VIDEO_STREAM_ID, stream);
luax_pushtype(L, VideoStream::type, stream);
stream->release();
return 1;
}
@@ -75,7 +75,7 @@ extern "C" int luaopen_love_video(lua_State *L)
WrappedModule w;
w.module = instance;
w.name = "video";
w.type = MODULE_ID;
w.type = &Module::type;
w.functions = functions;
w.types = types;
+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