Big f***ing cleanup part 1
This commit is contained in:
@@ -80,7 +80,7 @@ namespace Ndk
|
||||
music.BindMethod("__tostring", [] (Nz::LuaState& lua, Nz::Music& instance, std::size_t /*argumentCount*/) -> int
|
||||
{
|
||||
Nz::StringStream ss("Music(");
|
||||
ss << instance.GetFilePath() << ')';
|
||||
ss << instance.GetFilePath().generic_u8string() << ')';
|
||||
|
||||
lua.PushString(ss);
|
||||
return 1;
|
||||
@@ -169,9 +169,9 @@ namespace Ndk
|
||||
Nz::StringStream ss("SoundBuffer(");
|
||||
if (instance->IsValid())
|
||||
{
|
||||
Nz::String filePath = instance->GetFilePath();
|
||||
if (!filePath.IsEmpty())
|
||||
ss << "File: " << filePath << ", ";
|
||||
std::filesystem::path filePath = instance->GetFilePath();
|
||||
if (!filePath.empty())
|
||||
ss << "File: " << filePath.generic_u8string() << ", ";
|
||||
|
||||
ss << "Duration: " << instance->GetDuration() / 1000.f << "s";
|
||||
}
|
||||
|
||||
@@ -115,60 +115,6 @@ namespace Ndk
|
||||
});
|
||||
}
|
||||
|
||||
/********************************* Nz::Directory ********************************/
|
||||
directory.Reset("Directory");
|
||||
{
|
||||
directory.SetConstructor([] (Nz::LuaState& lua, Nz::Directory* instance, std::size_t argumentCount)
|
||||
{
|
||||
std::size_t argCount = std::min<std::size_t>(argumentCount, 1U);
|
||||
|
||||
int argIndex = 2;
|
||||
switch (argCount)
|
||||
{
|
||||
case 0:
|
||||
Nz::PlacementNew(instance);
|
||||
return true;
|
||||
|
||||
case 1:
|
||||
Nz::PlacementNew(instance, lua.Check<Nz::String>(&argIndex));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
directory.BindMethod("Close", &Nz::Directory::Close);
|
||||
directory.BindMethod("Exists", &Nz::Directory::Exists);
|
||||
directory.BindMethod("GetPath", &Nz::Directory::GetPath);
|
||||
directory.BindMethod("GetPattern", &Nz::Directory::GetPattern);
|
||||
directory.BindMethod("GetResultName", &Nz::Directory::GetResultName);
|
||||
directory.BindMethod("GetResultPath", &Nz::Directory::GetResultPath);
|
||||
directory.BindMethod("GetResultSize", &Nz::Directory::GetResultSize);
|
||||
directory.BindMethod("IsOpen", &Nz::Directory::IsOpen);
|
||||
directory.BindMethod("IsResultDirectory", &Nz::Directory::IsResultDirectory);
|
||||
directory.BindMethod("NextResult", &Nz::Directory::NextResult, true);
|
||||
directory.BindMethod("Open", &Nz::Directory::Open);
|
||||
directory.BindMethod("SetPath", &Nz::Directory::SetPath);
|
||||
directory.BindMethod("SetPattern", &Nz::Directory::SetPattern);
|
||||
|
||||
directory.BindStaticMethod("Copy", Nz::Directory::Copy);
|
||||
directory.BindStaticMethod("Create", Nz::Directory::Create);
|
||||
directory.BindStaticMethod("Exists", Nz::Directory::Exists);
|
||||
directory.BindStaticMethod("GetCurrent", Nz::Directory::GetCurrent);
|
||||
directory.BindStaticMethod("Remove", Nz::Directory::Remove);
|
||||
directory.BindStaticMethod("SetCurrent", Nz::Directory::SetCurrent);
|
||||
|
||||
// Manual
|
||||
directory.BindMethod("__tostring", [] (Nz::LuaState& lua, Nz::Directory& instance, std::size_t /*argumentCount*/) -> int {
|
||||
Nz::StringStream ss("Directory(");
|
||||
ss << instance.GetPath();
|
||||
ss << ')';
|
||||
|
||||
lua.PushString(ss);
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
/*********************************** Nz::File ***********************************/
|
||||
file.Reset("File");
|
||||
{
|
||||
@@ -187,7 +133,7 @@ namespace Ndk
|
||||
|
||||
case 1:
|
||||
{
|
||||
Nz::String filePath = lua.Check<Nz::String>(&argIndex);
|
||||
std::string filePath = lua.Check<std::string>(&argIndex);
|
||||
|
||||
Nz::PlacementNew(instance, filePath);
|
||||
return true;
|
||||
@@ -195,7 +141,7 @@ namespace Ndk
|
||||
|
||||
case 2:
|
||||
{
|
||||
Nz::String filePath = lua.Check<Nz::String>(&argIndex);
|
||||
std::string filePath = lua.Check<std::string>(&argIndex);
|
||||
Nz::UInt32 openMode = lua.Check<Nz::UInt32>(&argIndex);
|
||||
|
||||
Nz::PlacementNew(instance, filePath, openMode);
|
||||
@@ -212,29 +158,8 @@ namespace Ndk
|
||||
file.BindMethod("Delete", &Nz::File::Delete);
|
||||
file.BindMethod("EndOfFile", &Nz::File::EndOfFile);
|
||||
file.BindMethod("Exists", &Nz::File::Exists);
|
||||
file.BindMethod("GetCreationTime", &Nz::File::GetCreationTime);
|
||||
file.BindMethod("GetFileName", &Nz::File::GetFileName);
|
||||
file.BindMethod("GetLastAccessTime", &Nz::File::GetLastAccessTime);
|
||||
file.BindMethod("GetLastWriteTime", &Nz::File::GetLastWriteTime);
|
||||
file.BindMethod("IsOpen", &Nz::File::IsOpen);
|
||||
file.BindMethod("Rename", &Nz::File::GetLastWriteTime);
|
||||
file.BindMethod("GetLastWriteTime", &Nz::File::GetLastWriteTime);
|
||||
file.BindMethod("SetFile", &Nz::File::GetLastWriteTime);
|
||||
|
||||
file.BindStaticMethod("AbsolutePath", &Nz::File::AbsolutePath);
|
||||
file.BindStaticMethod("ComputeHash", (Nz::ByteArray(*)(Nz::HashType, const Nz::String&)) &Nz::File::ComputeHash);
|
||||
file.BindStaticMethod("Copy", &Nz::File::Copy);
|
||||
file.BindStaticMethod("Delete", &Nz::File::Delete);
|
||||
file.BindStaticMethod("Exists", &Nz::File::Exists);
|
||||
//fileClass.SetStaticMethod("GetCreationTime", &Nz::File::GetCreationTime);
|
||||
file.BindStaticMethod("GetDirectory", &Nz::File::GetDirectory);
|
||||
//fileClass.SetStaticMethod("GetLastAccessTime", &Nz::File::GetLastAccessTime);
|
||||
//fileClass.SetStaticMethod("GetLastWriteTime", &Nz::File::GetLastWriteTime);
|
||||
file.BindStaticMethod("GetSize", &Nz::File::GetSize);
|
||||
file.BindStaticMethod("IsAbsolute", &Nz::File::IsAbsolute);
|
||||
file.BindStaticMethod("NormalizePath", &Nz::File::NormalizePath);
|
||||
file.BindStaticMethod("NormalizeSeparators", &Nz::File::NormalizeSeparators);
|
||||
file.BindStaticMethod("Rename", &Nz::File::Rename);
|
||||
|
||||
// Manual
|
||||
file.BindMethod("Open", [] (Nz::LuaState& lua, Nz::File& instance, std::size_t argumentCount) -> int
|
||||
@@ -250,7 +175,7 @@ namespace Ndk
|
||||
|
||||
case 2:
|
||||
{
|
||||
Nz::String filePath = lua.Check<Nz::String>(&argIndex);
|
||||
std::string filePath = lua.Check<std::string>(&argIndex);
|
||||
Nz::UInt32 openMode = lua.Check<Nz::UInt32>(&argIndex, Nz::OpenMode_NotOpen);
|
||||
return lua.Push(instance.Open(filePath, openMode));
|
||||
}
|
||||
@@ -285,7 +210,7 @@ namespace Ndk
|
||||
file.BindMethod("__tostring", [] (Nz::LuaState& lua, Nz::File& instance, std::size_t /*argumentCount*/) -> int {
|
||||
Nz::StringStream ss("File(");
|
||||
if (instance.IsOpen())
|
||||
ss << "Path: " << instance.GetPath();
|
||||
ss << "Path: " << instance.GetPath().generic_u8string();
|
||||
|
||||
ss << ')';
|
||||
|
||||
@@ -304,7 +229,6 @@ namespace Ndk
|
||||
{
|
||||
// Classes
|
||||
clock.Register(state);
|
||||
directory.Register(state);
|
||||
file.Register(state);
|
||||
stream.Register(state);
|
||||
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace Ndk
|
||||
}
|
||||
else
|
||||
{
|
||||
Nz::PlacementNew(instance, Nz::Material::New(lua.Check<Nz::String>(&argIndex)));
|
||||
Nz::PlacementNew(instance, Nz::Material::New(lua.Check<std::string>(&argIndex)));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ namespace Ndk
|
||||
}
|
||||
else
|
||||
{
|
||||
lua.Push(instance->Configure(lua.Check<Nz::String>(&argIndex)));
|
||||
lua.Push(instance->Configure(lua.Check<std::string>(&argIndex)));
|
||||
return 1;
|
||||
}
|
||||
});
|
||||
@@ -214,7 +214,7 @@ namespace Ndk
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return lua.Push(instance->SetAlphaMap(lua.Check<Nz::String>(&argIndex)));
|
||||
return lua.Push(instance->SetAlphaMap(lua.Check<std::string>(&argIndex)));
|
||||
});
|
||||
|
||||
material.BindMethod("SetDiffuseMap", [] (Nz::LuaState& lua, Nz::MaterialRef& instance, std::size_t /*argumentCount*/) -> int
|
||||
@@ -226,7 +226,7 @@ namespace Ndk
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return lua.Push(instance->SetDiffuseMap(lua.Check<Nz::String>(&argIndex)));
|
||||
return lua.Push(instance->SetDiffuseMap(lua.Check<std::string>(&argIndex)));
|
||||
});
|
||||
|
||||
material.BindMethod("SetEmissiveMap", [] (Nz::LuaState& lua, Nz::MaterialRef& instance, std::size_t /*argumentCount*/) -> int
|
||||
@@ -238,7 +238,7 @@ namespace Ndk
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return lua.Push(instance->SetEmissiveMap(lua.Check<Nz::String>(&argIndex)));
|
||||
return lua.Push(instance->SetEmissiveMap(lua.Check<std::string>(&argIndex)));
|
||||
});
|
||||
|
||||
material.BindMethod("SetHeightMap", [] (Nz::LuaState& lua, Nz::MaterialRef& instance, std::size_t /*argumentCount*/) -> int
|
||||
@@ -250,7 +250,7 @@ namespace Ndk
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return lua.Push(instance->SetHeightMap(lua.Check<Nz::String>(&argIndex)));
|
||||
return lua.Push(instance->SetHeightMap(lua.Check<std::string>(&argIndex)));
|
||||
});
|
||||
|
||||
material.BindMethod("SetNormalMap", [] (Nz::LuaState& lua, Nz::MaterialRef& instance, std::size_t /*argumentCount*/) -> int
|
||||
@@ -262,7 +262,7 @@ namespace Ndk
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return lua.Push(instance->SetNormalMap(lua.Check<Nz::String>(&argIndex)));
|
||||
return lua.Push(instance->SetNormalMap(lua.Check<std::string>(&argIndex)));
|
||||
});
|
||||
|
||||
material.BindMethod("SetShader", [] (Nz::LuaState& lua, Nz::MaterialRef& instance, std::size_t /*argumentCount*/) -> int
|
||||
@@ -274,7 +274,7 @@ namespace Ndk
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return lua.Push(instance->SetShader(lua.Check<Nz::String>(&argIndex)));
|
||||
return lua.Push(instance->SetShader(lua.Check<std::string>(&argIndex)));
|
||||
});
|
||||
|
||||
material.BindMethod("SetSpecularMap", [] (Nz::LuaState& lua, Nz::MaterialRef& instance, std::size_t /*argumentCount*/) -> int
|
||||
@@ -286,7 +286,7 @@ namespace Ndk
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return lua.Push(instance->SetSpecularMap(lua.Check<Nz::String>(&argIndex)));
|
||||
return lua.Push(instance->SetSpecularMap(lua.Check<std::string>(&argIndex)));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -326,7 +326,7 @@ namespace Ndk
|
||||
}
|
||||
else if (lua.IsOfType(argIndex, Nz::LuaType_String))
|
||||
{
|
||||
Nz::String subMesh(lua.Check<Nz::String>(&argIndex));
|
||||
std::string subMesh(lua.Check<std::string>(&argIndex));
|
||||
Nz::MaterialRef mat(lua.Check<Nz::MaterialRef>(&argIndex));
|
||||
|
||||
instance->SetMaterial(subMesh, std::move(mat));
|
||||
@@ -351,7 +351,7 @@ namespace Ndk
|
||||
else if (lua.IsOfType(argIndex, Nz::LuaType_String))
|
||||
{
|
||||
std::size_t skinIndex(lua.Check<std::size_t>(&argIndex));
|
||||
Nz::String subMesh(lua.Check<Nz::String>(&argIndex));
|
||||
std::string subMesh(lua.Check<std::string>(&argIndex));
|
||||
Nz::MaterialRef materialRef(lua.Check<Nz::MaterialRef>(&argIndex));
|
||||
|
||||
instance->SetMaterial(skinIndex, subMesh, std::move(materialRef));
|
||||
@@ -423,7 +423,7 @@ namespace Ndk
|
||||
if (lua.IsOfType(argIndex, "Material"))
|
||||
instance->SetMaterial(skinIndex, *static_cast<Nz::MaterialRef*>(lua.ToUserdata(argIndex)), resizeSprite);
|
||||
else
|
||||
instance->SetMaterial(skinIndex, lua.Check<Nz::String>(&argIndex), resizeSprite);
|
||||
instance->SetMaterial(skinIndex, lua.Check<std::string>(&argIndex), resizeSprite);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -452,7 +452,7 @@ namespace Ndk
|
||||
if (lua.IsOfType(argIndex, "Texture"))
|
||||
instance->SetTexture(skinIndex, *static_cast<Nz::TextureRef*>(lua.ToUserdata(argIndex)), resizeSprite);
|
||||
else
|
||||
instance->SetTexture(skinIndex, lua.Check<Nz::String>(&argIndex), resizeSprite);
|
||||
instance->SetTexture(skinIndex, lua.Check<std::string>(&argIndex), resizeSprite);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user