Lua/LuaClass: Rename Set[Static]Method to Bind[Static]Method
Former-commit-id: fee2269cb12a621443715946602827cbfc5efc42
This commit is contained in:
parent
c8dd28f75c
commit
9ea9137c21
|
|
@ -18,28 +18,28 @@ namespace Ndk
|
|||
//musicClass.SetMethod("Create", &Nz::Music::Create);
|
||||
//musicClass.SetMethod("Destroy", &Nz::Music::Destroy);
|
||||
|
||||
musicClass.SetMethod("EnableLooping", &Nz::Music::EnableLooping);
|
||||
musicClass.BindMethod("EnableLooping", &Nz::Music::EnableLooping);
|
||||
|
||||
musicClass.SetMethod("GetDuration", &Nz::Music::GetDuration);
|
||||
musicClass.SetMethod("GetFormat", &Nz::Music::GetFormat);
|
||||
musicClass.SetMethod("GetPlayingOffset", &Nz::Music::GetPlayingOffset);
|
||||
musicClass.SetMethod("GetSampleCount", &Nz::Music::GetSampleCount);
|
||||
musicClass.SetMethod("GetSampleRate", &Nz::Music::GetSampleRate);
|
||||
musicClass.SetMethod("GetStatus", &Nz::Music::GetStatus);
|
||||
musicClass.BindMethod("GetDuration", &Nz::Music::GetDuration);
|
||||
musicClass.BindMethod("GetFormat", &Nz::Music::GetFormat);
|
||||
musicClass.BindMethod("GetPlayingOffset", &Nz::Music::GetPlayingOffset);
|
||||
musicClass.BindMethod("GetSampleCount", &Nz::Music::GetSampleCount);
|
||||
musicClass.BindMethod("GetSampleRate", &Nz::Music::GetSampleRate);
|
||||
musicClass.BindMethod("GetStatus", &Nz::Music::GetStatus);
|
||||
|
||||
musicClass.SetMethod("IsLooping", &Nz::Music::IsLooping);
|
||||
musicClass.BindMethod("IsLooping", &Nz::Music::IsLooping);
|
||||
|
||||
musicClass.SetMethod("OpenFromFile", &Nz::Music::OpenFromFile, Nz::MusicParams());
|
||||
musicClass.BindMethod("OpenFromFile", &Nz::Music::OpenFromFile, Nz::MusicParams());
|
||||
|
||||
musicClass.SetMethod("Pause", &Nz::Music::Pause);
|
||||
musicClass.SetMethod("Play", &Nz::Music::Play);
|
||||
musicClass.BindMethod("Pause", &Nz::Music::Pause);
|
||||
musicClass.BindMethod("Play", &Nz::Music::Play);
|
||||
|
||||
musicClass.SetMethod("SetPlayingOffset", &Nz::Music::SetPlayingOffset);
|
||||
musicClass.BindMethod("SetPlayingOffset", &Nz::Music::SetPlayingOffset);
|
||||
|
||||
musicClass.SetMethod("Stop", &Nz::Music::Stop);
|
||||
musicClass.BindMethod("Stop", &Nz::Music::Stop);
|
||||
|
||||
// Manual
|
||||
musicClass.SetMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::Music& music) -> int
|
||||
musicClass.BindMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::Music& music) -> int
|
||||
{
|
||||
Nz::StringStream stream("Music(");
|
||||
stream << music.GetFilePath() << ')';
|
||||
|
|
@ -56,17 +56,17 @@ namespace Ndk
|
|||
return new Nz::Sound;
|
||||
});
|
||||
|
||||
soundClass.SetMethod("GetBuffer", &Nz::Sound::GetBuffer);
|
||||
soundClass.BindMethod("GetBuffer", &Nz::Sound::GetBuffer);
|
||||
|
||||
soundClass.SetMethod("IsPlayable", &Nz::Sound::IsPlayable);
|
||||
soundClass.SetMethod("IsPlaying", &Nz::Sound::IsPlaying);
|
||||
soundClass.BindMethod("IsPlayable", &Nz::Sound::IsPlayable);
|
||||
soundClass.BindMethod("IsPlaying", &Nz::Sound::IsPlaying);
|
||||
|
||||
soundClass.SetMethod("LoadFromFile", &Nz::Sound::LoadFromFile, Nz::SoundBufferParams());
|
||||
soundClass.BindMethod("LoadFromFile", &Nz::Sound::LoadFromFile, Nz::SoundBufferParams());
|
||||
|
||||
soundClass.SetMethod("SetPlayingOffset", &Nz::Sound::SetPlayingOffset);
|
||||
soundClass.BindMethod("SetPlayingOffset", &Nz::Sound::SetPlayingOffset);
|
||||
|
||||
// Manual
|
||||
soundClass.SetMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::Sound& sound) -> int
|
||||
soundClass.BindMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::Sound& sound) -> int
|
||||
{
|
||||
Nz::StringStream stream("Sound(");
|
||||
if (const Nz::SoundBuffer* buffer = sound.GetBuffer())
|
||||
|
|
@ -84,21 +84,21 @@ namespace Ndk
|
|||
return new Nz::SoundBufferRef(new Nz::SoundBuffer);
|
||||
});
|
||||
|
||||
soundBuffer.SetMethod("Destroy", &Nz::SoundBuffer::Destroy);
|
||||
soundBuffer.BindMethod("Destroy", &Nz::SoundBuffer::Destroy);
|
||||
|
||||
soundBuffer.SetMethod("GetDuration", &Nz::SoundBuffer::GetDuration);
|
||||
soundBuffer.SetMethod("GetFormat", &Nz::SoundBuffer::GetFormat);
|
||||
soundBuffer.SetMethod("GetSampleCount", &Nz::SoundBuffer::GetSampleCount);
|
||||
soundBuffer.SetMethod("GetSampleRate", &Nz::SoundBuffer::GetSampleRate);
|
||||
soundBuffer.BindMethod("GetDuration", &Nz::SoundBuffer::GetDuration);
|
||||
soundBuffer.BindMethod("GetFormat", &Nz::SoundBuffer::GetFormat);
|
||||
soundBuffer.BindMethod("GetSampleCount", &Nz::SoundBuffer::GetSampleCount);
|
||||
soundBuffer.BindMethod("GetSampleRate", &Nz::SoundBuffer::GetSampleRate);
|
||||
|
||||
soundBuffer.SetMethod("IsValid", &Nz::SoundBuffer::IsValid);
|
||||
soundBuffer.BindMethod("IsValid", &Nz::SoundBuffer::IsValid);
|
||||
|
||||
soundBuffer.SetMethod("LoadFromFile", &Nz::SoundBuffer::LoadFromFile, Nz::SoundBufferParams());
|
||||
soundBuffer.BindMethod("LoadFromFile", &Nz::SoundBuffer::LoadFromFile, Nz::SoundBufferParams());
|
||||
|
||||
soundBuffer.SetStaticMethod("IsFormatSupported", &Nz::SoundBuffer::IsFormatSupported);
|
||||
soundBuffer.BindStaticMethod("IsFormatSupported", &Nz::SoundBuffer::IsFormatSupported);
|
||||
|
||||
// Manual
|
||||
soundBuffer.SetMethod("Create", [] (Nz::LuaInstance& lua, Nz::SoundBufferRef& instance) -> int
|
||||
soundBuffer.BindMethod("Create", [] (Nz::LuaInstance& lua, Nz::SoundBufferRef& instance) -> int
|
||||
{
|
||||
int index = 1;
|
||||
Nz::AudioFormat format = lua.Check<Nz::AudioFormat>(&index);
|
||||
|
|
@ -113,13 +113,13 @@ namespace Ndk
|
|||
return 1;
|
||||
});
|
||||
|
||||
soundBuffer.SetMethod("GetSamples", [] (Nz::LuaInstance& lua, Nz::SoundBufferRef& instance) -> int
|
||||
soundBuffer.BindMethod("GetSamples", [] (Nz::LuaInstance& lua, Nz::SoundBufferRef& instance) -> int
|
||||
{
|
||||
lua.PushString(reinterpret_cast<const char*>(instance->GetSamples()), instance->GetSampleCount() * sizeof(Nz::Int16));
|
||||
return 1;
|
||||
});
|
||||
|
||||
soundBuffer.SetMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::SoundBufferRef& soundBuffer) -> int
|
||||
soundBuffer.BindMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::SoundBufferRef& soundBuffer) -> int
|
||||
{
|
||||
Nz::StringStream stream("SoundBuffer(");
|
||||
if (soundBuffer->IsValid())
|
||||
|
|
@ -137,33 +137,33 @@ namespace Ndk
|
|||
});
|
||||
|
||||
/*********************************** Nz::SoundEmitter **********************************/
|
||||
soundEmitter.SetMethod("EnableLooping", &Nz::SoundEmitter::EnableLooping);
|
||||
soundEmitter.SetMethod("EnableSpatialization", &Nz::SoundEmitter::EnableSpatialization);
|
||||
soundEmitter.BindMethod("EnableLooping", &Nz::SoundEmitter::EnableLooping);
|
||||
soundEmitter.BindMethod("EnableSpatialization", &Nz::SoundEmitter::EnableSpatialization);
|
||||
|
||||
soundEmitter.SetMethod("GetAttenuation", &Nz::SoundEmitter::GetAttenuation);
|
||||
soundEmitter.SetMethod("GetDuration", &Nz::SoundEmitter::GetDuration);
|
||||
soundEmitter.SetMethod("GetMinDistance", &Nz::SoundEmitter::GetMinDistance);
|
||||
soundEmitter.SetMethod("GetPitch", &Nz::SoundEmitter::GetPitch);
|
||||
soundEmitter.SetMethod("GetPlayingOffset", &Nz::SoundEmitter::GetPlayingOffset);
|
||||
soundEmitter.SetMethod("GetPosition", &Nz::Sound::GetPosition);
|
||||
soundEmitter.SetMethod("GetStatus", &Nz::SoundEmitter::GetStatus);
|
||||
soundEmitter.SetMethod("GetVelocity", &Nz::Sound::GetVelocity);
|
||||
soundEmitter.SetMethod("GetVolume", &Nz::SoundEmitter::GetVolume);
|
||||
soundEmitter.BindMethod("GetAttenuation", &Nz::SoundEmitter::GetAttenuation);
|
||||
soundEmitter.BindMethod("GetDuration", &Nz::SoundEmitter::GetDuration);
|
||||
soundEmitter.BindMethod("GetMinDistance", &Nz::SoundEmitter::GetMinDistance);
|
||||
soundEmitter.BindMethod("GetPitch", &Nz::SoundEmitter::GetPitch);
|
||||
soundEmitter.BindMethod("GetPlayingOffset", &Nz::SoundEmitter::GetPlayingOffset);
|
||||
soundEmitter.BindMethod("GetPosition", &Nz::Sound::GetPosition);
|
||||
soundEmitter.BindMethod("GetStatus", &Nz::SoundEmitter::GetStatus);
|
||||
soundEmitter.BindMethod("GetVelocity", &Nz::Sound::GetVelocity);
|
||||
soundEmitter.BindMethod("GetVolume", &Nz::SoundEmitter::GetVolume);
|
||||
|
||||
soundEmitter.SetMethod("IsLooping", &Nz::SoundEmitter::IsLooping);
|
||||
soundEmitter.SetMethod("IsSpatialized", &Nz::SoundEmitter::IsSpatialized);
|
||||
soundEmitter.BindMethod("IsLooping", &Nz::SoundEmitter::IsLooping);
|
||||
soundEmitter.BindMethod("IsSpatialized", &Nz::SoundEmitter::IsSpatialized);
|
||||
|
||||
soundEmitter.SetMethod("Pause", &Nz::SoundEmitter::Pause);
|
||||
soundEmitter.SetMethod("Play", &Nz::SoundEmitter::Play);
|
||||
soundEmitter.BindMethod("Pause", &Nz::SoundEmitter::Pause);
|
||||
soundEmitter.BindMethod("Play", &Nz::SoundEmitter::Play);
|
||||
|
||||
soundEmitter.SetMethod("SetAttenuation", &Nz::SoundEmitter::SetAttenuation);
|
||||
soundEmitter.SetMethod("SetMinDistance", &Nz::SoundEmitter::SetMinDistance);
|
||||
soundEmitter.SetMethod("SetPitch", &Nz::SoundEmitter::SetPitch);
|
||||
soundEmitter.SetMethod("SetPosition", (void(Nz::SoundEmitter::*)(const Nz::Vector3f&)) &Nz::SoundEmitter::SetPosition);
|
||||
soundEmitter.SetMethod("SetVelocity", (void(Nz::SoundEmitter::*)(const Nz::Vector3f&)) &Nz::SoundEmitter::SetVelocity);
|
||||
soundEmitter.SetMethod("SetVolume", &Nz::SoundEmitter::SetVolume);
|
||||
soundEmitter.BindMethod("SetAttenuation", &Nz::SoundEmitter::SetAttenuation);
|
||||
soundEmitter.BindMethod("SetMinDistance", &Nz::SoundEmitter::SetMinDistance);
|
||||
soundEmitter.BindMethod("SetPitch", &Nz::SoundEmitter::SetPitch);
|
||||
soundEmitter.BindMethod("SetPosition", (void(Nz::SoundEmitter::*)(const Nz::Vector3f&)) &Nz::SoundEmitter::SetPosition);
|
||||
soundEmitter.BindMethod("SetVelocity", (void(Nz::SoundEmitter::*)(const Nz::Vector3f&)) &Nz::SoundEmitter::SetVelocity);
|
||||
soundEmitter.BindMethod("SetVolume", &Nz::SoundEmitter::SetVolume);
|
||||
|
||||
soundEmitter.SetMethod("Stop", &Nz::SoundEmitter::Stop);
|
||||
soundEmitter.BindMethod("Stop", &Nz::SoundEmitter::Stop);
|
||||
}
|
||||
|
||||
void LuaBinding::RegisterAudio(Nz::LuaInstance& instance)
|
||||
|
|
|
|||
|
|
@ -14,16 +14,16 @@ namespace Ndk
|
|||
return new Nz::Clock(lua.Check<Nz::Int64>(&argIndex, 0), lua.Check<bool>(&argIndex, false));
|
||||
});
|
||||
|
||||
clockClass.SetMethod("GetMicroseconds", &Nz::Clock::GetMicroseconds);
|
||||
clockClass.SetMethod("GetMilliseconds", &Nz::Clock::GetMilliseconds);
|
||||
clockClass.SetMethod("GetSeconds", &Nz::Clock::GetSeconds);
|
||||
clockClass.SetMethod("IsPaused", &Nz::Clock::IsPaused);
|
||||
clockClass.SetMethod("Pause", &Nz::Clock::Pause);
|
||||
clockClass.SetMethod("Restart", &Nz::Clock::Restart);
|
||||
clockClass.SetMethod("Unpause", &Nz::Clock::Unpause);
|
||||
clockClass.BindMethod("GetMicroseconds", &Nz::Clock::GetMicroseconds);
|
||||
clockClass.BindMethod("GetMilliseconds", &Nz::Clock::GetMilliseconds);
|
||||
clockClass.BindMethod("GetSeconds", &Nz::Clock::GetSeconds);
|
||||
clockClass.BindMethod("IsPaused", &Nz::Clock::IsPaused);
|
||||
clockClass.BindMethod("Pause", &Nz::Clock::Pause);
|
||||
clockClass.BindMethod("Restart", &Nz::Clock::Restart);
|
||||
clockClass.BindMethod("Unpause", &Nz::Clock::Unpause);
|
||||
|
||||
// Manual
|
||||
clockClass.SetMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::Clock& clock) -> int {
|
||||
clockClass.BindMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::Clock& clock) -> int {
|
||||
Nz::StringStream stream("Clock(Elapsed: ");
|
||||
stream << clock.GetSeconds();
|
||||
stream << "s, Paused: ";
|
||||
|
|
@ -52,29 +52,29 @@ namespace Ndk
|
|||
return nullptr;
|
||||
});
|
||||
|
||||
directoryClass.SetMethod("Close", &Nz::Directory::Close);
|
||||
directoryClass.SetMethod("Exists", &Nz::Directory::Exists);
|
||||
directoryClass.SetMethod("GetPath", &Nz::Directory::GetPath);
|
||||
directoryClass.SetMethod("GetPattern", &Nz::Directory::GetPattern);
|
||||
directoryClass.SetMethod("GetResultName", &Nz::Directory::GetResultName);
|
||||
directoryClass.SetMethod("GetResultPath", &Nz::Directory::GetResultPath);
|
||||
directoryClass.SetMethod("GetResultSize", &Nz::Directory::GetResultSize);
|
||||
directoryClass.SetMethod("IsOpen", &Nz::Directory::IsOpen);
|
||||
directoryClass.SetMethod("IsResultDirectory", &Nz::Directory::IsResultDirectory);
|
||||
directoryClass.SetMethod("NextResult", &Nz::Directory::NextResult, true);
|
||||
directoryClass.SetMethod("Open", &Nz::Directory::Open);
|
||||
directoryClass.SetMethod("SetPath", &Nz::Directory::SetPath);
|
||||
directoryClass.SetMethod("SetPattern", &Nz::Directory::SetPattern);
|
||||
directoryClass.BindMethod("Close", &Nz::Directory::Close);
|
||||
directoryClass.BindMethod("Exists", &Nz::Directory::Exists);
|
||||
directoryClass.BindMethod("GetPath", &Nz::Directory::GetPath);
|
||||
directoryClass.BindMethod("GetPattern", &Nz::Directory::GetPattern);
|
||||
directoryClass.BindMethod("GetResultName", &Nz::Directory::GetResultName);
|
||||
directoryClass.BindMethod("GetResultPath", &Nz::Directory::GetResultPath);
|
||||
directoryClass.BindMethod("GetResultSize", &Nz::Directory::GetResultSize);
|
||||
directoryClass.BindMethod("IsOpen", &Nz::Directory::IsOpen);
|
||||
directoryClass.BindMethod("IsResultDirectory", &Nz::Directory::IsResultDirectory);
|
||||
directoryClass.BindMethod("NextResult", &Nz::Directory::NextResult, true);
|
||||
directoryClass.BindMethod("Open", &Nz::Directory::Open);
|
||||
directoryClass.BindMethod("SetPath", &Nz::Directory::SetPath);
|
||||
directoryClass.BindMethod("SetPattern", &Nz::Directory::SetPattern);
|
||||
|
||||
directoryClass.SetStaticMethod("Copy", Nz::Directory::Copy);
|
||||
directoryClass.SetStaticMethod("Create", Nz::Directory::Create);
|
||||
directoryClass.SetStaticMethod("Exists", Nz::Directory::Exists);
|
||||
directoryClass.SetStaticMethod("GetCurrent", Nz::Directory::GetCurrent);
|
||||
directoryClass.SetStaticMethod("Remove", Nz::Directory::Remove);
|
||||
directoryClass.SetStaticMethod("SetCurrent", Nz::Directory::SetCurrent);
|
||||
directoryClass.BindStaticMethod("Copy", Nz::Directory::Copy);
|
||||
directoryClass.BindStaticMethod("Create", Nz::Directory::Create);
|
||||
directoryClass.BindStaticMethod("Exists", Nz::Directory::Exists);
|
||||
directoryClass.BindStaticMethod("GetCurrent", Nz::Directory::GetCurrent);
|
||||
directoryClass.BindStaticMethod("Remove", Nz::Directory::Remove);
|
||||
directoryClass.BindStaticMethod("SetCurrent", Nz::Directory::SetCurrent);
|
||||
|
||||
// Manual
|
||||
directoryClass.SetMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::Directory& directory) -> int {
|
||||
directoryClass.BindMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::Directory& directory) -> int {
|
||||
Nz::StringStream stream("Directory(");
|
||||
stream << directory.GetPath();
|
||||
stream << ')';
|
||||
|
|
@ -84,22 +84,22 @@ namespace Ndk
|
|||
});
|
||||
|
||||
/*********************************** Nz::Stream ***********************************/
|
||||
streamClass.SetMethod("EnableTextMode", &Nz::Stream::EnableTextMode);
|
||||
streamClass.SetMethod("Flush", &Nz::Stream::Flush);
|
||||
streamClass.SetMethod("GetCursorPos", &Nz::Stream::GetCursorPos);
|
||||
streamClass.SetMethod("GetDirectory", &Nz::Stream::GetDirectory);
|
||||
streamClass.SetMethod("GetPath", &Nz::Stream::GetPath);
|
||||
streamClass.SetMethod("GetOpenMode", &Nz::Stream::GetOpenMode);
|
||||
streamClass.SetMethod("GetStreamOptions", &Nz::Stream::GetStreamOptions);
|
||||
streamClass.SetMethod("GetSize", &Nz::Stream::GetSize);
|
||||
streamClass.SetMethod("ReadLine", &Nz::Stream::ReadLine, 0U);
|
||||
streamClass.SetMethod("IsReadable", &Nz::Stream::IsReadable);
|
||||
streamClass.SetMethod("IsSequential", &Nz::Stream::IsSequential);
|
||||
streamClass.SetMethod("IsTextModeEnabled", &Nz::Stream::IsTextModeEnabled);
|
||||
streamClass.SetMethod("IsWritable", &Nz::Stream::IsWritable);
|
||||
streamClass.SetMethod("SetCursorPos", &Nz::Stream::SetCursorPos);
|
||||
streamClass.BindMethod("EnableTextMode", &Nz::Stream::EnableTextMode);
|
||||
streamClass.BindMethod("Flush", &Nz::Stream::Flush);
|
||||
streamClass.BindMethod("GetCursorPos", &Nz::Stream::GetCursorPos);
|
||||
streamClass.BindMethod("GetDirectory", &Nz::Stream::GetDirectory);
|
||||
streamClass.BindMethod("GetPath", &Nz::Stream::GetPath);
|
||||
streamClass.BindMethod("GetOpenMode", &Nz::Stream::GetOpenMode);
|
||||
streamClass.BindMethod("GetStreamOptions", &Nz::Stream::GetStreamOptions);
|
||||
streamClass.BindMethod("GetSize", &Nz::Stream::GetSize);
|
||||
streamClass.BindMethod("ReadLine", &Nz::Stream::ReadLine, 0U);
|
||||
streamClass.BindMethod("IsReadable", &Nz::Stream::IsReadable);
|
||||
streamClass.BindMethod("IsSequential", &Nz::Stream::IsSequential);
|
||||
streamClass.BindMethod("IsTextModeEnabled", &Nz::Stream::IsTextModeEnabled);
|
||||
streamClass.BindMethod("IsWritable", &Nz::Stream::IsWritable);
|
||||
streamClass.BindMethod("SetCursorPos", &Nz::Stream::SetCursorPos);
|
||||
|
||||
streamClass.SetMethod("Read", [] (Nz::LuaInstance& lua, Nz::Stream& stream) -> int {
|
||||
streamClass.BindMethod("Read", [] (Nz::LuaInstance& lua, Nz::Stream& stream) -> int {
|
||||
int argIndex = 1;
|
||||
|
||||
std::size_t length = lua.Check<std::size_t>(&argIndex);
|
||||
|
|
@ -111,7 +111,7 @@ namespace Ndk
|
|||
return 1;
|
||||
});
|
||||
|
||||
streamClass.SetMethod("Write", [] (Nz::LuaInstance& lua, Nz::Stream& stream) -> int {
|
||||
streamClass.BindMethod("Write", [] (Nz::LuaInstance& lua, Nz::Stream& stream) -> int {
|
||||
int argIndex = 1;
|
||||
|
||||
std::size_t bufferSize = 0;
|
||||
|
|
@ -147,37 +147,37 @@ namespace Ndk
|
|||
return nullptr;
|
||||
});
|
||||
|
||||
fileClass.SetMethod("Close", &Nz::File::Close);
|
||||
fileClass.SetMethod("Copy", &Nz::File::Copy);
|
||||
fileClass.SetMethod("Delete", &Nz::File::Delete);
|
||||
fileClass.SetMethod("EndOfFile", &Nz::File::EndOfFile);
|
||||
fileClass.SetMethod("Exists", &Nz::File::Exists);
|
||||
fileClass.SetMethod("GetCreationTime", &Nz::File::GetCreationTime);
|
||||
fileClass.SetMethod("GetFileName", &Nz::File::GetFileName);
|
||||
fileClass.SetMethod("GetLastAccessTime", &Nz::File::GetLastAccessTime);
|
||||
fileClass.SetMethod("GetLastWriteTime", &Nz::File::GetLastWriteTime);
|
||||
fileClass.SetMethod("IsOpen", &Nz::File::IsOpen);
|
||||
fileClass.SetMethod("Rename", &Nz::File::GetLastWriteTime);
|
||||
fileClass.SetMethod("GetLastWriteTime", &Nz::File::GetLastWriteTime);
|
||||
fileClass.SetMethod("SetFile", &Nz::File::GetLastWriteTime);
|
||||
fileClass.BindMethod("Close", &Nz::File::Close);
|
||||
fileClass.BindMethod("Copy", &Nz::File::Copy);
|
||||
fileClass.BindMethod("Delete", &Nz::File::Delete);
|
||||
fileClass.BindMethod("EndOfFile", &Nz::File::EndOfFile);
|
||||
fileClass.BindMethod("Exists", &Nz::File::Exists);
|
||||
fileClass.BindMethod("GetCreationTime", &Nz::File::GetCreationTime);
|
||||
fileClass.BindMethod("GetFileName", &Nz::File::GetFileName);
|
||||
fileClass.BindMethod("GetLastAccessTime", &Nz::File::GetLastAccessTime);
|
||||
fileClass.BindMethod("GetLastWriteTime", &Nz::File::GetLastWriteTime);
|
||||
fileClass.BindMethod("IsOpen", &Nz::File::IsOpen);
|
||||
fileClass.BindMethod("Rename", &Nz::File::GetLastWriteTime);
|
||||
fileClass.BindMethod("GetLastWriteTime", &Nz::File::GetLastWriteTime);
|
||||
fileClass.BindMethod("SetFile", &Nz::File::GetLastWriteTime);
|
||||
|
||||
fileClass.SetStaticMethod("AbsolutePath", &Nz::File::AbsolutePath);
|
||||
fileClass.SetStaticMethod("ComputeHash", (Nz::ByteArray (*)(Nz::HashType, const Nz::String&)) &Nz::File::ComputeHash);
|
||||
fileClass.SetStaticMethod("Copy", &Nz::File::Copy);
|
||||
fileClass.SetStaticMethod("Delete", &Nz::File::Delete);
|
||||
fileClass.SetStaticMethod("Exists", &Nz::File::Exists);
|
||||
fileClass.BindStaticMethod("AbsolutePath", &Nz::File::AbsolutePath);
|
||||
fileClass.BindStaticMethod("ComputeHash", (Nz::ByteArray (*)(Nz::HashType, const Nz::String&)) &Nz::File::ComputeHash);
|
||||
fileClass.BindStaticMethod("Copy", &Nz::File::Copy);
|
||||
fileClass.BindStaticMethod("Delete", &Nz::File::Delete);
|
||||
fileClass.BindStaticMethod("Exists", &Nz::File::Exists);
|
||||
//fileClass.SetStaticMethod("GetCreationTime", &Nz::File::GetCreationTime);
|
||||
fileClass.SetStaticMethod("GetDirectory", &Nz::File::GetDirectory);
|
||||
fileClass.BindStaticMethod("GetDirectory", &Nz::File::GetDirectory);
|
||||
//fileClass.SetStaticMethod("GetLastAccessTime", &Nz::File::GetLastAccessTime);
|
||||
//fileClass.SetStaticMethod("GetLastWriteTime", &Nz::File::GetLastWriteTime);
|
||||
fileClass.SetStaticMethod("GetSize", &Nz::File::GetSize);
|
||||
fileClass.SetStaticMethod("IsAbsolute", &Nz::File::IsAbsolute);
|
||||
fileClass.SetStaticMethod("NormalizePath", &Nz::File::NormalizePath);
|
||||
fileClass.SetStaticMethod("NormalizeSeparators", &Nz::File::NormalizeSeparators);
|
||||
fileClass.SetStaticMethod("Rename", &Nz::File::Rename);
|
||||
fileClass.BindStaticMethod("GetSize", &Nz::File::GetSize);
|
||||
fileClass.BindStaticMethod("IsAbsolute", &Nz::File::IsAbsolute);
|
||||
fileClass.BindStaticMethod("NormalizePath", &Nz::File::NormalizePath);
|
||||
fileClass.BindStaticMethod("NormalizeSeparators", &Nz::File::NormalizeSeparators);
|
||||
fileClass.BindStaticMethod("Rename", &Nz::File::Rename);
|
||||
|
||||
// Manual
|
||||
fileClass.SetMethod("Open", [] (Nz::LuaInstance& lua, Nz::File& file) -> int
|
||||
fileClass.BindMethod("Open", [] (Nz::LuaInstance& lua, Nz::File& file) -> int
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 2U);
|
||||
|
||||
|
|
@ -196,7 +196,7 @@ namespace Ndk
|
|||
return 0;
|
||||
});
|
||||
|
||||
fileClass.SetMethod("SetCursorPos", [] (Nz::LuaInstance& lua, Nz::File& file) -> int
|
||||
fileClass.BindMethod("SetCursorPos", [] (Nz::LuaInstance& lua, Nz::File& file) -> int
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 2U);
|
||||
|
||||
|
|
@ -214,7 +214,7 @@ namespace Ndk
|
|||
return 0;
|
||||
});
|
||||
|
||||
fileClass.SetMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::File& file) -> int {
|
||||
fileClass.BindMethod("__tostring", [] (Nz::LuaInstance& lua, Nz::File& file) -> int {
|
||||
Nz::StringStream stream("File(");
|
||||
if (file.IsOpen())
|
||||
stream << "Path: " << file.GetPath();
|
||||
|
|
|
|||
|
|
@ -22,21 +22,21 @@ namespace Ndk
|
|||
});
|
||||
|
||||
//modelClass.SetMethod("GetMaterial", &Nz::Model::GetMaterial);
|
||||
modelClass.SetMethod("GetMaterialCount", &Nz::Model::GetMaterialCount);
|
||||
modelClass.BindMethod("GetMaterialCount", &Nz::Model::GetMaterialCount);
|
||||
//modelClass.SetMethod("GetMesh", &Nz::Model::GetMesh);
|
||||
modelClass.SetMethod("GetSkin", &Nz::Model::GetSkin);
|
||||
modelClass.SetMethod("GetSkinCount", &Nz::Model::GetSkinCount);
|
||||
modelClass.BindMethod("GetSkin", &Nz::Model::GetSkin);
|
||||
modelClass.BindMethod("GetSkinCount", &Nz::Model::GetSkinCount);
|
||||
|
||||
modelClass.SetMethod("IsAnimated", &Nz::Model::IsAnimated);
|
||||
modelClass.SetMethod("LoadFromFile", &Nz::Model::LoadFromFile, Nz::ModelParameters());
|
||||
modelClass.BindMethod("IsAnimated", &Nz::Model::IsAnimated);
|
||||
modelClass.BindMethod("LoadFromFile", &Nz::Model::LoadFromFile, Nz::ModelParameters());
|
||||
|
||||
modelClass.SetMethod("Reset", &Nz::Model::Reset);
|
||||
modelClass.BindMethod("Reset", &Nz::Model::Reset);
|
||||
|
||||
//modelClass.SetMethod("SetMaterial", &Nz::Model::SetMaterial);
|
||||
//modelClass.SetMethod("SetMesh", &Nz::Model::SetMesh);
|
||||
//modelClass.SetMethod("SetSequence", &Nz::Model::SetSequence);
|
||||
modelClass.SetMethod("SetSkin", &Nz::Model::SetSkin);
|
||||
modelClass.SetMethod("SetSkinCount", &Nz::Model::SetSkinCount);
|
||||
modelClass.BindMethod("SetSkin", &Nz::Model::SetSkin);
|
||||
modelClass.BindMethod("SetSkinCount", &Nz::Model::SetSkinCount);
|
||||
}
|
||||
|
||||
void LuaBinding::RegisterGraphics(Nz::LuaInstance& instance)
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ namespace Ndk
|
|||
return nullptr;
|
||||
});
|
||||
|
||||
eulerAnglesClass.SetMethod("__tostring", &Nz::EulerAnglesd::ToString);
|
||||
eulerAnglesClass.BindMethod("__tostring", &Nz::EulerAnglesd::ToString);
|
||||
|
||||
eulerAnglesClass.SetGetter([] (Nz::LuaInstance& lua, Nz::EulerAnglesd& instance)
|
||||
{
|
||||
|
|
@ -173,7 +173,7 @@ namespace Ndk
|
|||
return nullptr;
|
||||
});
|
||||
|
||||
quaternionClass.SetMethod("__tostring", &Nz::Quaterniond::ToString);
|
||||
quaternionClass.BindMethod("__tostring", &Nz::Quaterniond::ToString);
|
||||
|
||||
quaternionClass.SetGetter([] (Nz::LuaInstance& lua, Nz::Quaterniond& instance)
|
||||
{
|
||||
|
|
@ -262,7 +262,7 @@ namespace Ndk
|
|||
return nullptr;
|
||||
});
|
||||
|
||||
vector2dClass.SetMethod("__tostring", &Nz::Vector2d::ToString);
|
||||
vector2dClass.BindMethod("__tostring", &Nz::Vector2d::ToString);
|
||||
|
||||
vector2dClass.SetGetter([](Nz::LuaInstance& lua, Nz::Vector2d& instance)
|
||||
{
|
||||
|
|
@ -381,7 +381,7 @@ namespace Ndk
|
|||
return nullptr;
|
||||
});
|
||||
|
||||
vector3dClass.SetMethod("__tostring", &Nz::Vector3d::ToString);
|
||||
vector3dClass.BindMethod("__tostring", &Nz::Vector3d::ToString);
|
||||
|
||||
vector3dClass.SetGetter([] (Nz::LuaInstance& lua, Nz::Vector3d& instance)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -8,13 +8,13 @@ namespace Ndk
|
|||
void LuaBinding::BindNetwork()
|
||||
{
|
||||
/*********************************** Nz::AbstractSocket **********************************/
|
||||
abstractSocketClass.SetMethod("Close", &Nz::AbstractSocket::Close);
|
||||
abstractSocketClass.SetMethod("EnableBlocking", &Nz::AbstractSocket::EnableBlocking);
|
||||
abstractSocketClass.SetMethod("GetLastError", &Nz::AbstractSocket::GetLastError);
|
||||
abstractSocketClass.SetMethod("GetState", &Nz::AbstractSocket::GetState);
|
||||
abstractSocketClass.SetMethod("GetType", &Nz::AbstractSocket::GetType);
|
||||
abstractSocketClass.SetMethod("IsBlockingEnabled", &Nz::AbstractSocket::IsBlockingEnabled);
|
||||
abstractSocketClass.SetMethod("QueryAvailableBytes", &Nz::AbstractSocket::QueryAvailableBytes);
|
||||
abstractSocketClass.BindMethod("Close", &Nz::AbstractSocket::Close);
|
||||
abstractSocketClass.BindMethod("EnableBlocking", &Nz::AbstractSocket::EnableBlocking);
|
||||
abstractSocketClass.BindMethod("GetLastError", &Nz::AbstractSocket::GetLastError);
|
||||
abstractSocketClass.BindMethod("GetState", &Nz::AbstractSocket::GetState);
|
||||
abstractSocketClass.BindMethod("GetType", &Nz::AbstractSocket::GetType);
|
||||
abstractSocketClass.BindMethod("IsBlockingEnabled", &Nz::AbstractSocket::IsBlockingEnabled);
|
||||
abstractSocketClass.BindMethod("QueryAvailableBytes", &Nz::AbstractSocket::QueryAvailableBytes);
|
||||
|
||||
/*********************************** Nz::IpAddress **********************************/
|
||||
ipAddressClass.SetConstructor([] (Nz::LuaInstance& lua) -> Nz::IpAddress*
|
||||
|
|
@ -43,14 +43,14 @@ namespace Ndk
|
|||
return nullptr;
|
||||
});
|
||||
|
||||
ipAddressClass.SetMethod("GetPort", &Nz::IpAddress::GetPort);
|
||||
ipAddressClass.SetMethod("GetProtocol", &Nz::IpAddress::GetProtocol);
|
||||
ipAddressClass.SetMethod("IsLoopback", &Nz::IpAddress::IsLoopback);
|
||||
ipAddressClass.SetMethod("IsValid", &Nz::IpAddress::IsValid);
|
||||
ipAddressClass.SetMethod("ToUInt32", &Nz::IpAddress::ToUInt32);
|
||||
ipAddressClass.SetMethod("__tostring", &Nz::IpAddress::ToString);
|
||||
ipAddressClass.BindMethod("GetPort", &Nz::IpAddress::GetPort);
|
||||
ipAddressClass.BindMethod("GetProtocol", &Nz::IpAddress::GetProtocol);
|
||||
ipAddressClass.BindMethod("IsLoopback", &Nz::IpAddress::IsLoopback);
|
||||
ipAddressClass.BindMethod("IsValid", &Nz::IpAddress::IsValid);
|
||||
ipAddressClass.BindMethod("ToUInt32", &Nz::IpAddress::ToUInt32);
|
||||
ipAddressClass.BindMethod("__tostring", &Nz::IpAddress::ToString);
|
||||
|
||||
ipAddressClass.SetStaticMethod("ResolveAddress", [] (Nz::LuaInstance& instance) -> int
|
||||
ipAddressClass.BindStaticMethod("ResolveAddress", [] (Nz::LuaInstance& instance) -> int
|
||||
{
|
||||
Nz::String service;
|
||||
Nz::ResolveError error = Nz::ResolveError_Unknown;
|
||||
|
|
@ -72,7 +72,7 @@ namespace Ndk
|
|||
}
|
||||
});
|
||||
|
||||
ipAddressClass.SetStaticMethod("ResolveHostname", [] (Nz::LuaInstance& instance) -> int
|
||||
ipAddressClass.BindStaticMethod("ResolveHostname", [] (Nz::LuaInstance& instance) -> int
|
||||
{
|
||||
Nz::ResolveError error = Nz::ResolveError_Unknown;
|
||||
|
||||
|
|
|
|||
|
|
@ -49,14 +49,14 @@ namespace Ndk
|
|||
#ifndef NDK_SERVER
|
||||
//application.SetMethod("AddWindow", &Application::AddWindow);
|
||||
#endif
|
||||
application.SetMethod("AddWorld", [] (Nz::LuaInstance& instance, Application* application) -> int
|
||||
application.BindMethod("AddWorld", [] (Nz::LuaInstance& instance, Application* application) -> int
|
||||
{
|
||||
instance.Push(application->AddWorld().CreateHandle());
|
||||
return 1;
|
||||
});
|
||||
|
||||
application.SetMethod("GetUpdateTime", &Application::GetUpdateTime);
|
||||
application.SetMethod("Quit", &Application::Quit);
|
||||
application.BindMethod("GetUpdateTime", &Application::GetUpdateTime);
|
||||
application.BindMethod("Quit", &Application::Quit);
|
||||
|
||||
/*********************************** Ndk::Console **********************************/
|
||||
#ifndef NDK_SERVER
|
||||
|
|
@ -65,40 +65,40 @@ namespace Ndk
|
|||
return handle->GetObject();
|
||||
});
|
||||
|
||||
consoleClass.SetMethod("AddLine", &Console::AddLine, Nz::Color::White);
|
||||
consoleClass.SetMethod("Clear", &Console::Clear);
|
||||
consoleClass.SetMethod("GetCharacterSize", &Console::GetCharacterSize);
|
||||
consoleClass.SetMethod("GetHistory", &Console::GetHistory);
|
||||
consoleClass.SetMethod("GetHistoryBackground", &Console::GetHistoryBackground);
|
||||
consoleClass.SetMethod("GetInput", &Console::GetInput);
|
||||
consoleClass.SetMethod("GetInputBackground", &Console::GetInputBackground);
|
||||
consoleClass.SetMethod("GetSize", &Console::GetSize);
|
||||
consoleClass.BindMethod("AddLine", &Console::AddLine, Nz::Color::White);
|
||||
consoleClass.BindMethod("Clear", &Console::Clear);
|
||||
consoleClass.BindMethod("GetCharacterSize", &Console::GetCharacterSize);
|
||||
consoleClass.BindMethod("GetHistory", &Console::GetHistory);
|
||||
consoleClass.BindMethod("GetHistoryBackground", &Console::GetHistoryBackground);
|
||||
consoleClass.BindMethod("GetInput", &Console::GetInput);
|
||||
consoleClass.BindMethod("GetInputBackground", &Console::GetInputBackground);
|
||||
consoleClass.BindMethod("GetSize", &Console::GetSize);
|
||||
//consoleClass.SetMethod("GetTextFont", &Console::GetTextFont);
|
||||
|
||||
consoleClass.SetMethod("IsVisible", &Console::IsVisible);
|
||||
consoleClass.BindMethod("IsVisible", &Console::IsVisible);
|
||||
|
||||
consoleClass.SetMethod("SendCharacter", &Console::SendCharacter);
|
||||
consoleClass.BindMethod("SendCharacter", &Console::SendCharacter);
|
||||
//consoleClass.SetMethod("SendEvent", &Console::SendEvent);
|
||||
|
||||
consoleClass.SetMethod("SetCharacterSize", &Console::SetCharacterSize);
|
||||
consoleClass.SetMethod("SetSize", &Console::SetSize);
|
||||
consoleClass.BindMethod("SetCharacterSize", &Console::SetCharacterSize);
|
||||
consoleClass.BindMethod("SetSize", &Console::SetSize);
|
||||
//consoleClass.SetMethod("SetTextFont", &Console::SetTextFont);
|
||||
|
||||
consoleClass.SetMethod("Show", &Console::Show, true);
|
||||
consoleClass.BindMethod("Show", &Console::Show, true);
|
||||
#endif
|
||||
|
||||
/*********************************** Ndk::Entity **********************************/
|
||||
entityClass.SetMethod("Enable", &Entity::Enable);
|
||||
entityClass.SetMethod("GetId", &Entity::GetId);
|
||||
entityClass.SetMethod("GetWorld", &Entity::GetWorld);
|
||||
entityClass.SetMethod("Kill", &Entity::Kill);
|
||||
entityClass.SetMethod("IsEnabled", &Entity::IsEnabled);
|
||||
entityClass.SetMethod("IsValid", &Entity::IsValid);
|
||||
entityClass.SetMethod("RemoveComponent", (void(Entity::*)(ComponentIndex)) &Entity::RemoveComponent);
|
||||
entityClass.SetMethod("RemoveAllComponents", &Entity::RemoveAllComponents);
|
||||
entityClass.SetMethod("__tostring", &EntityHandle::ToString);
|
||||
entityClass.BindMethod("Enable", &Entity::Enable);
|
||||
entityClass.BindMethod("GetId", &Entity::GetId);
|
||||
entityClass.BindMethod("GetWorld", &Entity::GetWorld);
|
||||
entityClass.BindMethod("Kill", &Entity::Kill);
|
||||
entityClass.BindMethod("IsEnabled", &Entity::IsEnabled);
|
||||
entityClass.BindMethod("IsValid", &Entity::IsValid);
|
||||
entityClass.BindMethod("RemoveComponent", (void(Entity::*)(ComponentIndex)) &Entity::RemoveComponent);
|
||||
entityClass.BindMethod("RemoveAllComponents", &Entity::RemoveAllComponents);
|
||||
entityClass.BindMethod("__tostring", &EntityHandle::ToString);
|
||||
|
||||
entityClass.SetMethod("AddComponent", [this] (Nz::LuaInstance& lua, EntityHandle& handle) -> int
|
||||
entityClass.BindMethod("AddComponent", [this] (Nz::LuaInstance& lua, EntityHandle& handle) -> int
|
||||
{
|
||||
int index = 1;
|
||||
ComponentIndex componentIndex = lua.Check<ComponentIndex>(&index);
|
||||
|
|
@ -119,7 +119,7 @@ namespace Ndk
|
|||
return binding.adder(lua, handle);
|
||||
});
|
||||
|
||||
entityClass.SetMethod("GetComponent", [this] (Nz::LuaInstance& lua, EntityHandle& handle) -> int
|
||||
entityClass.BindMethod("GetComponent", [this] (Nz::LuaInstance& lua, EntityHandle& handle) -> int
|
||||
{
|
||||
int index = 1;
|
||||
ComponentIndex componentIndex = lua.Check<ComponentIndex>(&index);
|
||||
|
|
@ -183,14 +183,14 @@ namespace Ndk
|
|||
});
|
||||
|
||||
/*********************************** Ndk::World **********************************/
|
||||
worldClass.SetMethod("CreateEntity", &World::CreateEntity);
|
||||
worldClass.SetMethod("CreateEntities", &World::CreateEntities);
|
||||
worldClass.SetMethod("Clear", &World::Clear);
|
||||
worldClass.BindMethod("CreateEntity", &World::CreateEntity);
|
||||
worldClass.BindMethod("CreateEntities", &World::CreateEntities);
|
||||
worldClass.BindMethod("Clear", &World::Clear);
|
||||
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
/*********************************** Ndk::GraphicsComponent **********************************/
|
||||
graphicsComponent.SetMethod("Attach", &GraphicsComponent::Attach, 0);
|
||||
graphicsComponent.BindMethod("Attach", &GraphicsComponent::Attach, 0);
|
||||
#endif
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -9,19 +9,19 @@ namespace Ndk
|
|||
void LuaBinding::BindUtility()
|
||||
{
|
||||
/*********************************** Nz::AbstractImage **********************************/
|
||||
abstractImage.SetMethod("GetBytesPerPixel", &Nz::AbstractImage::GetBytesPerPixel);
|
||||
abstractImage.SetMethod("GetDepth", &Nz::AbstractImage::GetDepth, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.SetMethod("GetFormat", &Nz::AbstractImage::GetFormat);
|
||||
abstractImage.SetMethod("GetHeight", &Nz::AbstractImage::GetHeight, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.SetMethod("GetLevelCount", &Nz::AbstractImage::GetLevelCount);
|
||||
abstractImage.SetMethod("GetMaxLevel", &Nz::AbstractImage::GetMaxLevel);
|
||||
abstractImage.SetMethod("GetSize", &Nz::AbstractImage::GetSize, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.SetMethod("GetType", &Nz::AbstractImage::GetType);
|
||||
abstractImage.SetMethod("GetWidth", &Nz::AbstractImage::GetWidth, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.SetMethod("IsCompressed", &Nz::AbstractImage::IsCompressed);
|
||||
abstractImage.SetMethod("IsCubemap", &Nz::AbstractImage::IsCubemap);
|
||||
abstractImage.BindMethod("GetBytesPerPixel", &Nz::AbstractImage::GetBytesPerPixel);
|
||||
abstractImage.BindMethod("GetDepth", &Nz::AbstractImage::GetDepth, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.BindMethod("GetFormat", &Nz::AbstractImage::GetFormat);
|
||||
abstractImage.BindMethod("GetHeight", &Nz::AbstractImage::GetHeight, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.BindMethod("GetLevelCount", &Nz::AbstractImage::GetLevelCount);
|
||||
abstractImage.BindMethod("GetMaxLevel", &Nz::AbstractImage::GetMaxLevel);
|
||||
abstractImage.BindMethod("GetSize", &Nz::AbstractImage::GetSize, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.BindMethod("GetType", &Nz::AbstractImage::GetType);
|
||||
abstractImage.BindMethod("GetWidth", &Nz::AbstractImage::GetWidth, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.BindMethod("IsCompressed", &Nz::AbstractImage::IsCompressed);
|
||||
abstractImage.BindMethod("IsCubemap", &Nz::AbstractImage::IsCubemap);
|
||||
|
||||
abstractImage.SetMethod("GetMemoryUsage", [] (Nz::LuaInstance& lua, Nz::AbstractImage* abstractImage) -> int
|
||||
abstractImage.BindMethod("GetMemoryUsage", [] (Nz::LuaInstance& lua, Nz::AbstractImage* abstractImage) -> int
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 1U);
|
||||
switch (argCount)
|
||||
|
|
@ -42,7 +42,7 @@ namespace Ndk
|
|||
return 0;
|
||||
});
|
||||
|
||||
abstractImage.SetMethod("Update", [] (Nz::LuaInstance& lua, Nz::AbstractImage* abstractImage) -> int
|
||||
abstractImage.BindMethod("Update", [] (Nz::LuaInstance& lua, Nz::AbstractImage* abstractImage) -> int
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 6U);
|
||||
int argIndex = 1;
|
||||
|
|
@ -89,52 +89,52 @@ namespace Ndk
|
|||
});
|
||||
|
||||
/*********************************** Nz::Node **********************************/
|
||||
nodeClass.SetMethod("GetBackward", &Nz::Node::GetBackward);
|
||||
nodeClass.BindMethod("GetBackward", &Nz::Node::GetBackward);
|
||||
//nodeClass.SetMethod("GetChilds", &Nz::Node::GetChilds);
|
||||
nodeClass.SetMethod("GetDown", &Nz::Node::GetDown);
|
||||
nodeClass.SetMethod("GetForward", &Nz::Node::GetForward);
|
||||
nodeClass.SetMethod("GetInheritPosition", &Nz::Node::GetInheritPosition);
|
||||
nodeClass.SetMethod("GetInheritRotation", &Nz::Node::GetInheritRotation);
|
||||
nodeClass.SetMethod("GetInheritScale", &Nz::Node::GetInheritScale);
|
||||
nodeClass.SetMethod("GetInitialPosition", &Nz::Node::GetInitialPosition);
|
||||
nodeClass.BindMethod("GetDown", &Nz::Node::GetDown);
|
||||
nodeClass.BindMethod("GetForward", &Nz::Node::GetForward);
|
||||
nodeClass.BindMethod("GetInheritPosition", &Nz::Node::GetInheritPosition);
|
||||
nodeClass.BindMethod("GetInheritRotation", &Nz::Node::GetInheritRotation);
|
||||
nodeClass.BindMethod("GetInheritScale", &Nz::Node::GetInheritScale);
|
||||
nodeClass.BindMethod("GetInitialPosition", &Nz::Node::GetInitialPosition);
|
||||
//nodeClass.SetMethod("GetInitialRotation", &Nz::Node::GetInitialRotation);
|
||||
nodeClass.SetMethod("GetInitialScale", &Nz::Node::GetInitialScale);
|
||||
nodeClass.SetMethod("GetLeft", &Nz::Node::GetLeft);
|
||||
nodeClass.SetMethod("GetNodeType", &Nz::Node::GetNodeType);
|
||||
nodeClass.BindMethod("GetInitialScale", &Nz::Node::GetInitialScale);
|
||||
nodeClass.BindMethod("GetLeft", &Nz::Node::GetLeft);
|
||||
nodeClass.BindMethod("GetNodeType", &Nz::Node::GetNodeType);
|
||||
//nodeClass.SetMethod("GetParent", &Nz::Node::GetParent);
|
||||
nodeClass.SetMethod("GetPosition", &Nz::Node::GetPosition, Nz::CoordSys_Global);
|
||||
nodeClass.SetMethod("GetRight", &Nz::Node::GetRight);
|
||||
nodeClass.BindMethod("GetPosition", &Nz::Node::GetPosition, Nz::CoordSys_Global);
|
||||
nodeClass.BindMethod("GetRight", &Nz::Node::GetRight);
|
||||
//nodeClass.SetMethod("GetRotation", &Nz::Node::GetRotation, Nz::CoordSys_Global);
|
||||
nodeClass.SetMethod("GetScale", &Nz::Node::GetScale, Nz::CoordSys_Global);
|
||||
nodeClass.BindMethod("GetScale", &Nz::Node::GetScale, Nz::CoordSys_Global);
|
||||
//nodeClass.SetMethod("GetTransformMatrix", &Nz::Node::GetTransformMatrix);
|
||||
nodeClass.SetMethod("GetUp", &Nz::Node::GetUp);
|
||||
nodeClass.BindMethod("GetUp", &Nz::Node::GetUp);
|
||||
|
||||
nodeClass.SetMethod("HasChilds", &Nz::Node::HasChilds);
|
||||
nodeClass.BindMethod("HasChilds", &Nz::Node::HasChilds);
|
||||
|
||||
nodeClass.SetMethod("GetBackward", &Nz::Node::GetBackward);
|
||||
nodeClass.SetMethod("GetDown", &Nz::Node::GetDown);
|
||||
nodeClass.SetMethod("GetForward", &Nz::Node::GetForward);
|
||||
nodeClass.SetMethod("GetInheritPosition", &Nz::Node::GetInheritPosition);
|
||||
nodeClass.SetMethod("GetInheritRotation", &Nz::Node::GetInheritRotation);
|
||||
nodeClass.SetMethod("GetInheritScale", &Nz::Node::GetInheritScale);
|
||||
nodeClass.SetMethod("GetInitialPosition", &Nz::Node::GetInitialPosition);
|
||||
nodeClass.SetMethod("GetInitialRotation", &Nz::Node::GetInitialRotation);
|
||||
nodeClass.SetMethod("GetInitialScale", &Nz::Node::GetInitialScale);
|
||||
nodeClass.SetMethod("GetLeft", &Nz::Node::GetLeft);
|
||||
nodeClass.SetMethod("GetNodeType", &Nz::Node::GetNodeType);
|
||||
nodeClass.SetMethod("GetPosition", &Nz::Node::GetPosition, Nz::CoordSys_Global);
|
||||
nodeClass.SetMethod("GetRight", &Nz::Node::GetRight);
|
||||
nodeClass.SetMethod("GetRotation", &Nz::Node::GetRotation, Nz::CoordSys_Global);
|
||||
nodeClass.SetMethod("GetScale", &Nz::Node::GetScale, Nz::CoordSys_Global);
|
||||
nodeClass.SetMethod("GetUp", &Nz::Node::GetUp);
|
||||
nodeClass.BindMethod("GetBackward", &Nz::Node::GetBackward);
|
||||
nodeClass.BindMethod("GetDown", &Nz::Node::GetDown);
|
||||
nodeClass.BindMethod("GetForward", &Nz::Node::GetForward);
|
||||
nodeClass.BindMethod("GetInheritPosition", &Nz::Node::GetInheritPosition);
|
||||
nodeClass.BindMethod("GetInheritRotation", &Nz::Node::GetInheritRotation);
|
||||
nodeClass.BindMethod("GetInheritScale", &Nz::Node::GetInheritScale);
|
||||
nodeClass.BindMethod("GetInitialPosition", &Nz::Node::GetInitialPosition);
|
||||
nodeClass.BindMethod("GetInitialRotation", &Nz::Node::GetInitialRotation);
|
||||
nodeClass.BindMethod("GetInitialScale", &Nz::Node::GetInitialScale);
|
||||
nodeClass.BindMethod("GetLeft", &Nz::Node::GetLeft);
|
||||
nodeClass.BindMethod("GetNodeType", &Nz::Node::GetNodeType);
|
||||
nodeClass.BindMethod("GetPosition", &Nz::Node::GetPosition, Nz::CoordSys_Global);
|
||||
nodeClass.BindMethod("GetRight", &Nz::Node::GetRight);
|
||||
nodeClass.BindMethod("GetRotation", &Nz::Node::GetRotation, Nz::CoordSys_Global);
|
||||
nodeClass.BindMethod("GetScale", &Nz::Node::GetScale, Nz::CoordSys_Global);
|
||||
nodeClass.BindMethod("GetUp", &Nz::Node::GetUp);
|
||||
|
||||
nodeClass.SetMethod("SetInitialPosition", (void(Nz::Node::*)(const Nz::Vector3f&)) &Nz::Node::SetInitialPosition);
|
||||
nodeClass.SetMethod("SetInitialRotation", (void(Nz::Node::*)(const Nz::Quaternionf&)) &Nz::Node::SetInitialRotation);
|
||||
nodeClass.BindMethod("SetInitialPosition", (void(Nz::Node::*)(const Nz::Vector3f&)) &Nz::Node::SetInitialPosition);
|
||||
nodeClass.BindMethod("SetInitialRotation", (void(Nz::Node::*)(const Nz::Quaternionf&)) &Nz::Node::SetInitialRotation);
|
||||
|
||||
nodeClass.SetMethod("SetPosition", (void(Nz::Node::*)(const Nz::Vector3f&, Nz::CoordSys)) &Nz::Node::SetPosition, Nz::CoordSys_Local);
|
||||
nodeClass.SetMethod("SetRotation", (void(Nz::Node::*)(const Nz::Quaternionf&, Nz::CoordSys)) &Nz::Node::SetRotation, Nz::CoordSys_Local);
|
||||
nodeClass.BindMethod("SetPosition", (void(Nz::Node::*)(const Nz::Vector3f&, Nz::CoordSys)) &Nz::Node::SetPosition, Nz::CoordSys_Local);
|
||||
nodeClass.BindMethod("SetRotation", (void(Nz::Node::*)(const Nz::Quaternionf&, Nz::CoordSys)) &Nz::Node::SetRotation, Nz::CoordSys_Local);
|
||||
|
||||
nodeClass.SetMethod("Move", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
nodeClass.BindMethod("Move", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
{
|
||||
int argIndex = 1;
|
||||
|
||||
|
|
@ -145,7 +145,7 @@ namespace Ndk
|
|||
return 0;
|
||||
});
|
||||
|
||||
nodeClass.SetMethod("Rotate", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
nodeClass.BindMethod("Rotate", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
{
|
||||
int argIndex = 1;
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ namespace Ndk
|
|||
return 0;
|
||||
});
|
||||
|
||||
nodeClass.SetMethod("Scale", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
nodeClass.BindMethod("Scale", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 4U);
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ namespace Ndk
|
|||
return 0;
|
||||
});
|
||||
|
||||
nodeClass.SetMethod("SetScale", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
nodeClass.BindMethod("SetScale", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 4U);
|
||||
|
||||
|
|
@ -219,7 +219,7 @@ namespace Ndk
|
|||
return 0;
|
||||
});
|
||||
|
||||
nodeClass.SetMethod("SetInitialScale", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
nodeClass.BindMethod("SetInitialScale", [] (Nz::LuaInstance& lua, Nz::Node& node) -> int
|
||||
{
|
||||
unsigned int argCount = std::min(lua.GetStackTop(), 4U);
|
||||
|
||||
|
|
|
|||
|
|
@ -36,6 +36,15 @@ namespace Nz
|
|||
|
||||
LuaClass(const String& name);
|
||||
|
||||
void BindMethod(const String& name, ClassFunc method);
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs> std::enable_if_t<std::is_base_of<P, T>::value> BindMethod(const String& name, R(P::*func)(Args...), DefArgs&&... defArgs);
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs> std::enable_if_t<std::is_base_of<P, T>::value> BindMethod(const String& name, R(P::*func)(Args...) const, DefArgs&&... defArgs);
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs> std::enable_if_t<std::is_base_of<P, typename PointedType<T>::type>::value> BindMethod(const String& name, R(P::*func)(Args...), DefArgs&&... defArgs);
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs> std::enable_if_t<std::is_base_of<P, typename PointedType<T>::type>::value> BindMethod(const String& name, R(P::*func)(Args...) const, DefArgs&&... defArgs);
|
||||
|
||||
void BindStaticMethod(const String& name, StaticFunc func);
|
||||
template<typename R, typename... Args, typename... DefArgs> void BindStaticMethod(const String& name, R(*func)(Args...), DefArgs&&... defArgs);
|
||||
|
||||
template<class P> void Inherit(LuaClass<P>& parent);
|
||||
template<class P> void Inherit(LuaClass<P>& parent, ConvertToParent<P> convertFunc);
|
||||
|
||||
|
|
@ -46,15 +55,8 @@ namespace Nz
|
|||
void SetConstructor(ConstructorFunc constructor);
|
||||
void SetFinalizer(FinalizerFunc finalizer);
|
||||
void SetGetter(ClassIndexFunc getter);
|
||||
void SetMethod(const String& name, ClassFunc method);
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs> std::enable_if_t<std::is_base_of<P, T>::value> SetMethod(const String& name, R(P::*func)(Args...), DefArgs&&... defArgs);
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs> std::enable_if_t<std::is_base_of<P, T>::value> SetMethod(const String& name, R(P::*func)(Args...) const, DefArgs&&... defArgs);
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs> std::enable_if_t<std::is_base_of<P, typename PointedType<T>::type>::value> SetMethod(const String& name, R(P::*func)(Args...), DefArgs&&... defArgs);
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs> std::enable_if_t<std::is_base_of<P, typename PointedType<T>::type>::value> SetMethod(const String& name, R(P::*func)(Args...) const, DefArgs&&... defArgs);
|
||||
void SetSetter(ClassIndexFunc setter);
|
||||
void SetStaticGetter(StaticIndexFunc getter);
|
||||
void SetStaticMethod(const String& name, StaticFunc func);
|
||||
template<typename R, typename... Args, typename... DefArgs> void SetStaticMethod(const String& name, R(*func)(Args...), DefArgs&&... defArgs);
|
||||
void SetStaticSetter(StaticIndexFunc getter);
|
||||
|
||||
private:
|
||||
|
|
|
|||
|
|
@ -213,18 +213,18 @@ namespace Nz
|
|||
}
|
||||
|
||||
template<class T>
|
||||
void LuaClass<T>::SetMethod(const String& name, ClassFunc method)
|
||||
void LuaClass<T>::BindMethod(const String& name, ClassFunc method)
|
||||
{
|
||||
m_methods[name] = method;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs>
|
||||
std::enable_if_t<std::is_base_of<P, T>::value> LuaClass<T>::SetMethod(const String& name, R(P::*func)(Args...), DefArgs&&... defArgs)
|
||||
std::enable_if_t<std::is_base_of<P, T>::value> LuaClass<T>::BindMethod(const String& name, R(P::*func)(Args...), DefArgs&&... defArgs)
|
||||
{
|
||||
typename LuaImplMethodProxy<Args...>::template Impl<DefArgs...> handler(std::forward<DefArgs>(defArgs)...);
|
||||
|
||||
SetMethod(name, [func, handler] (LuaInstance& lua, T& object) -> int
|
||||
BindMethod(name, [func, handler] (LuaInstance& lua, T& object) -> int
|
||||
{
|
||||
handler.ProcessArgs(lua);
|
||||
|
||||
|
|
@ -234,11 +234,11 @@ namespace Nz
|
|||
|
||||
template<class T>
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs>
|
||||
std::enable_if_t<std::is_base_of<P, T>::value> LuaClass<T>::SetMethod(const String& name, R(P::*func)(Args...) const, DefArgs&&... defArgs)
|
||||
std::enable_if_t<std::is_base_of<P, T>::value> LuaClass<T>::BindMethod(const String& name, R(P::*func)(Args...) const, DefArgs&&... defArgs)
|
||||
{
|
||||
typename LuaImplMethodProxy<Args...>::template Impl<DefArgs...> handler(std::forward<DefArgs>(defArgs)...);
|
||||
|
||||
SetMethod(name, [func, handler] (LuaInstance& lua, T& object) -> int
|
||||
BindMethod(name, [func, handler] (LuaInstance& lua, T& object) -> int
|
||||
{
|
||||
handler.ProcessArgs(lua);
|
||||
|
||||
|
|
@ -248,11 +248,11 @@ namespace Nz
|
|||
|
||||
template<class T>
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs>
|
||||
std::enable_if_t<std::is_base_of<P, typename PointedType<T>::type>::value> LuaClass<T>::SetMethod(const String& name, R(P::*func)(Args...), DefArgs&&... defArgs)
|
||||
std::enable_if_t<std::is_base_of<P, typename PointedType<T>::type>::value> LuaClass<T>::BindMethod(const String& name, R(P::*func)(Args...), DefArgs&&... defArgs)
|
||||
{
|
||||
typename LuaImplMethodProxy<Args...>::template Impl<DefArgs...> handler(std::forward<DefArgs>(defArgs)...);
|
||||
|
||||
SetMethod(name, [func, handler] (LuaInstance& lua, T& object) -> int
|
||||
BindMethod(name, [func, handler] (LuaInstance& lua, T& object) -> int
|
||||
{
|
||||
handler.ProcessArgs(lua);
|
||||
|
||||
|
|
@ -262,11 +262,11 @@ namespace Nz
|
|||
|
||||
template<class T>
|
||||
template<typename R, typename P, typename... Args, typename... DefArgs>
|
||||
std::enable_if_t<std::is_base_of<P, typename PointedType<T>::type>::value> LuaClass<T>::SetMethod(const String& name, R(P::*func)(Args...) const, DefArgs&&... defArgs)
|
||||
std::enable_if_t<std::is_base_of<P, typename PointedType<T>::type>::value> LuaClass<T>::BindMethod(const String& name, R(P::*func)(Args...) const, DefArgs&&... defArgs)
|
||||
{
|
||||
typename LuaImplMethodProxy<Args...>::template Impl<DefArgs...> handler(std::forward<DefArgs>(defArgs)...);
|
||||
|
||||
SetMethod(name, [func, handler] (LuaInstance& lua, T& object) -> int
|
||||
BindMethod(name, [func, handler] (LuaInstance& lua, T& object) -> int
|
||||
{
|
||||
handler.ProcessArgs(lua);
|
||||
|
||||
|
|
@ -287,18 +287,18 @@ namespace Nz
|
|||
}
|
||||
|
||||
template<class T>
|
||||
void LuaClass<T>::SetStaticMethod(const String& name, StaticFunc method)
|
||||
void LuaClass<T>::BindStaticMethod(const String& name, StaticFunc method)
|
||||
{
|
||||
m_staticMethods[name] = method;
|
||||
}
|
||||
|
||||
template<class T>
|
||||
template<typename R, typename... Args, typename... DefArgs>
|
||||
void LuaClass<T>::SetStaticMethod(const String& name, R(*func)(Args...), DefArgs&&... defArgs)
|
||||
void LuaClass<T>::BindStaticMethod(const String& name, R(*func)(Args...), DefArgs&&... defArgs)
|
||||
{
|
||||
typename LuaImplFunctionProxy<Args...>::template Impl<DefArgs...> handler(std::forward<DefArgs>(defArgs)...);
|
||||
|
||||
SetStaticMethod(name, [func, handler] (LuaInstance& lua) -> int
|
||||
BindStaticMethod(name, [func, handler] (LuaInstance& lua) -> int
|
||||
{
|
||||
handler.ProcessArgs(lua);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue