Files
WickedEngine/WickedEngine/wiLoadingScreen_BindLua.cpp
T
Turánszki János 74cb74d3c9 version 0.60 (#367)
- namespace refactor (example: wiGraphics:: -> wi::graphics)
  - provided namespace compatibility macro for old user code: WICKEDENGINE_BACKWARDS_COMPATIBILITY_0_59
- resource manager will return `Resource` instead of `shared_ptr<Resource>` objects
- MAD shader optimizations
- implemented alpha to coverage with alpha tested materials when MSAA is enabled
- alpha testing fix with transparent shadow maps
- TLAS and scene buffers will be recreated less frequently when things get added/removed from the scene
2021-12-03 21:22:27 +01:00

86 lines
2.4 KiB
C++

#include "wiLoadingScreen_BindLua.h"
namespace wi::lua
{
const char LoadingScreen_BindLua::className[] = "LoadingScreen";
Luna<LoadingScreen_BindLua>::FunctionType LoadingScreen_BindLua::methods[] = {
lunamethod(RenderPath2D_BindLua, AddSprite),
lunamethod(RenderPath2D_BindLua, AddFont),
lunamethod(RenderPath2D_BindLua, RemoveSprite),
lunamethod(RenderPath2D_BindLua, RemoveFont),
lunamethod(RenderPath2D_BindLua, ClearSprites),
lunamethod(RenderPath2D_BindLua, ClearFonts),
lunamethod(RenderPath2D_BindLua, GetSpriteOrder),
lunamethod(RenderPath2D_BindLua, GetFontOrder),
lunamethod(RenderPath2D_BindLua, AddLayer),
lunamethod(RenderPath2D_BindLua, GetLayers),
lunamethod(RenderPath2D_BindLua, SetLayerOrder),
lunamethod(RenderPath2D_BindLua, SetSpriteOrder),
lunamethod(RenderPath2D_BindLua, SetFontOrder),
lunamethod(RenderPath_BindLua, GetLayerMask),
lunamethod(RenderPath_BindLua, SetLayerMask),
lunamethod(LoadingScreen_BindLua, AddLoadingTask),
lunamethod(LoadingScreen_BindLua, OnFinished),
{ NULL, NULL }
};
Luna<LoadingScreen_BindLua>::PropertyType LoadingScreen_BindLua::properties[] = {
{ NULL, NULL }
};
int LoadingScreen_BindLua::AddLoadingTask(lua_State* L)
{
int argc = wi::lua::SGetArgCount(L);
if (argc > 0)
{
std::string task = wi::lua::SGetString(L, 1);
LoadingScreen* loading = dynamic_cast<LoadingScreen*>(component);
if (loading != nullptr)
{
loading->addLoadingFunction([=](wi::jobsystem::JobArgs args) {
wi::lua::RunText(task);
});
}
else
wi::lua::SError(L, "AddLoader(string taskScript) component is not a LoadingScreen!");
}
else
wi::lua::SError(L, "AddLoader(string taskScript) not enough arguments!");
return 0;
}
int LoadingScreen_BindLua::OnFinished(lua_State* L)
{
int argc = wi::lua::SGetArgCount(L);
if (argc > 0)
{
std::string task = wi::lua::SGetString(L, 1);
LoadingScreen* loading = dynamic_cast<LoadingScreen*>(component);
if (loading != nullptr)
{
loading->onFinished([=] {
wi::lua::RunText(task);
});
}
else
wi::lua::SError(L, "OnFinished(string taskScript) component is not a LoadingScreen!");
}
else
wi::lua::SError(L, "OnFinished(string taskScript) not enough arguments!");
return 0;
}
void LoadingScreen_BindLua::Bind()
{
static bool initialized = false;
if (!initialized)
{
initialized = true;
Luna<LoadingScreen_BindLua>::Register(wi::lua::GetLuaState());
}
}
}