Sdk/Lua: Fix binding initialization
This commit is contained in:
parent
d509520904
commit
a8280469a3
|
|
@ -19,14 +19,15 @@ namespace Ndk
|
|||
core = LuaBinding_Base::BindCore(*this);
|
||||
math = LuaBinding_Base::BindMath(*this);
|
||||
network = LuaBinding_Base::BindNetwork(*this);
|
||||
sdk = LuaBinding_Base::BindSDK(*this);
|
||||
utility = LuaBinding_Base::BindUtility(*this);
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
audio = LuaBinding_Base::BindAudio(*this);
|
||||
graphics = LuaBinding_Base::BindGraphics(*this);
|
||||
renderer = LuaBinding_Base::BindRenderer(*this);
|
||||
graphics = LuaBinding_Base::BindGraphics(*this);
|
||||
#endif
|
||||
|
||||
sdk = LuaBinding_Base::BindSDK(*this);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -14,6 +14,38 @@ namespace Ndk
|
|||
LuaBinding_Audio::LuaBinding_Audio(LuaBinding& binding) :
|
||||
LuaBinding_Base(binding)
|
||||
{
|
||||
/*********************************** Nz::SoundEmitter **********************************/
|
||||
soundEmitter.Reset("SoundEmitter");
|
||||
{
|
||||
soundEmitter.BindMethod("EnableLooping", &Nz::SoundEmitter::EnableLooping);
|
||||
soundEmitter.BindMethod("EnableSpatialization", &Nz::SoundEmitter::EnableSpatialization);
|
||||
|
||||
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.BindMethod("IsLooping", &Nz::SoundEmitter::IsLooping);
|
||||
soundEmitter.BindMethod("IsSpatialized", &Nz::SoundEmitter::IsSpatialized);
|
||||
|
||||
soundEmitter.BindMethod("Pause", &Nz::SoundEmitter::Pause);
|
||||
soundEmitter.BindMethod("Play", &Nz::SoundEmitter::Play);
|
||||
|
||||
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.BindMethod("Stop", &Nz::SoundEmitter::Stop);
|
||||
}
|
||||
|
||||
/*********************************** Nz::Music **********************************/
|
||||
music.Reset("Music");
|
||||
{
|
||||
|
|
@ -149,38 +181,6 @@ namespace Ndk
|
|||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
/*********************************** Nz::SoundEmitter **********************************/
|
||||
soundEmitter.Reset("SoundEmitter");
|
||||
{
|
||||
soundEmitter.BindMethod("EnableLooping", &Nz::SoundEmitter::EnableLooping);
|
||||
soundEmitter.BindMethod("EnableSpatialization", &Nz::SoundEmitter::EnableSpatialization);
|
||||
|
||||
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.BindMethod("IsLooping", &Nz::SoundEmitter::IsLooping);
|
||||
soundEmitter.BindMethod("IsSpatialized", &Nz::SoundEmitter::IsSpatialized);
|
||||
|
||||
soundEmitter.BindMethod("Pause", &Nz::SoundEmitter::Pause);
|
||||
soundEmitter.BindMethod("Play", &Nz::SoundEmitter::Play);
|
||||
|
||||
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.BindMethod("Stop", &Nz::SoundEmitter::Stop);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -14,6 +14,50 @@ namespace Ndk
|
|||
LuaBinding_Core::LuaBinding_Core(LuaBinding& binding) :
|
||||
LuaBinding_Base(binding)
|
||||
{
|
||||
/*********************************** Nz::Stream ***********************************/
|
||||
stream.Reset("Stream");
|
||||
{
|
||||
stream.BindMethod("EnableTextMode", &Nz::Stream::EnableTextMode);
|
||||
stream.BindMethod("Flush", &Nz::Stream::Flush);
|
||||
stream.BindMethod("GetCursorPos", &Nz::Stream::GetCursorPos);
|
||||
stream.BindMethod("GetDirectory", &Nz::Stream::GetDirectory);
|
||||
stream.BindMethod("GetPath", &Nz::Stream::GetPath);
|
||||
stream.BindMethod("GetOpenMode", &Nz::Stream::GetOpenMode);
|
||||
stream.BindMethod("GetStreamOptions", &Nz::Stream::GetStreamOptions);
|
||||
stream.BindMethod("GetSize", &Nz::Stream::GetSize);
|
||||
stream.BindMethod("ReadLine", &Nz::Stream::ReadLine, 0U);
|
||||
stream.BindMethod("IsReadable", &Nz::Stream::IsReadable);
|
||||
stream.BindMethod("IsSequential", &Nz::Stream::IsSequential);
|
||||
stream.BindMethod("IsTextModeEnabled", &Nz::Stream::IsTextModeEnabled);
|
||||
stream.BindMethod("IsWritable", &Nz::Stream::IsWritable);
|
||||
stream.BindMethod("SetCursorPos", &Nz::Stream::SetCursorPos);
|
||||
|
||||
stream.BindMethod("Read", [] (Nz::LuaInstance& lua, Nz::Stream& instance, std::size_t /*argumentCount*/) -> int {
|
||||
int argIndex = 2;
|
||||
|
||||
std::size_t length = lua.Check<std::size_t>(&argIndex);
|
||||
|
||||
std::unique_ptr<char[]> buffer(new char[length]);
|
||||
std::size_t readLength = instance.Read(buffer.get(), length);
|
||||
|
||||
lua.PushString(Nz::String(buffer.get(), readLength));
|
||||
return 1;
|
||||
});
|
||||
|
||||
stream.BindMethod("Write", [] (Nz::LuaInstance& lua, Nz::Stream& instance, std::size_t /*argumentCount*/) -> int {
|
||||
int argIndex = 2;
|
||||
|
||||
std::size_t bufferSize = 0;
|
||||
const char* buffer = lua.CheckString(argIndex, &bufferSize);
|
||||
|
||||
if (instance.IsTextModeEnabled())
|
||||
lua.Push(instance.Write(Nz::String(buffer, bufferSize)));
|
||||
else
|
||||
lua.Push(instance.Write(buffer, bufferSize));
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
/*********************************** Nz::Clock **********************************/
|
||||
clock.Reset("Clock");
|
||||
{
|
||||
|
|
@ -249,50 +293,6 @@ namespace Ndk
|
|||
return 1;
|
||||
});
|
||||
}
|
||||
|
||||
/*********************************** Nz::Stream ***********************************/
|
||||
stream.Reset("Stream");
|
||||
{
|
||||
stream.BindMethod("EnableTextMode", &Nz::Stream::EnableTextMode);
|
||||
stream.BindMethod("Flush", &Nz::Stream::Flush);
|
||||
stream.BindMethod("GetCursorPos", &Nz::Stream::GetCursorPos);
|
||||
stream.BindMethod("GetDirectory", &Nz::Stream::GetDirectory);
|
||||
stream.BindMethod("GetPath", &Nz::Stream::GetPath);
|
||||
stream.BindMethod("GetOpenMode", &Nz::Stream::GetOpenMode);
|
||||
stream.BindMethod("GetStreamOptions", &Nz::Stream::GetStreamOptions);
|
||||
stream.BindMethod("GetSize", &Nz::Stream::GetSize);
|
||||
stream.BindMethod("ReadLine", &Nz::Stream::ReadLine, 0U);
|
||||
stream.BindMethod("IsReadable", &Nz::Stream::IsReadable);
|
||||
stream.BindMethod("IsSequential", &Nz::Stream::IsSequential);
|
||||
stream.BindMethod("IsTextModeEnabled", &Nz::Stream::IsTextModeEnabled);
|
||||
stream.BindMethod("IsWritable", &Nz::Stream::IsWritable);
|
||||
stream.BindMethod("SetCursorPos", &Nz::Stream::SetCursorPos);
|
||||
|
||||
stream.BindMethod("Read", [] (Nz::LuaInstance& lua, Nz::Stream& instance, std::size_t /*argumentCount*/) -> int {
|
||||
int argIndex = 2;
|
||||
|
||||
std::size_t length = lua.Check<std::size_t>(&argIndex);
|
||||
|
||||
std::unique_ptr<char[]> buffer(new char[length]);
|
||||
std::size_t readLength = instance.Read(buffer.get(), length);
|
||||
|
||||
lua.PushString(Nz::String(buffer.get(), readLength));
|
||||
return 1;
|
||||
});
|
||||
|
||||
stream.BindMethod("Write", [] (Nz::LuaInstance& lua, Nz::Stream& instance, std::size_t /*argumentCount*/) -> int {
|
||||
int argIndex = 2;
|
||||
|
||||
std::size_t bufferSize = 0;
|
||||
const char* buffer = lua.CheckString(argIndex, &bufferSize);
|
||||
|
||||
if (instance.IsTextModeEnabled())
|
||||
lua.Push(instance.Write(Nz::String(buffer, bufferSize)));
|
||||
else
|
||||
lua.Push(instance.Write(buffer, bufferSize));
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ namespace Ndk
|
|||
LuaBinding_Base(binding)
|
||||
{
|
||||
/*********************************** Nz::AbstractImage **********************************/
|
||||
abstractImage.Reset("AbstractImage");
|
||||
{
|
||||
abstractImage.BindMethod("GetBytesPerPixel", &Nz::AbstractImage::GetBytesPerPixel);
|
||||
abstractImage.BindMethod("GetDepth", &Nz::AbstractImage::GetDepth, static_cast<Nz::UInt8>(0));
|
||||
abstractImage.BindMethod("GetFormat", &Nz::AbstractImage::GetFormat);
|
||||
|
|
@ -93,8 +95,11 @@ namespace Ndk
|
|||
lua.Error("No matching overload for method Update");
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
|
||||
/*********************************** Nz::Font **********************************/
|
||||
font.Reset("Font");
|
||||
{
|
||||
font.SetConstructor([] (Nz::LuaInstance& /*lua*/, Nz::FontRef* instance, std::size_t /*argumentCount*/)
|
||||
{
|
||||
Nz::PlacementNew(instance, Nz::Font::New());
|
||||
|
|
@ -154,12 +159,18 @@ namespace Ndk
|
|||
|
||||
font.BindStaticMethod("SetDefaultGlyphBorder", &Nz::Font::SetDefaultGlyphBorder);
|
||||
font.BindStaticMethod("SetDefaultMinimumStepSize", &Nz::Font::SetDefaultMinimumStepSize);
|
||||
}
|
||||
|
||||
/*********************************** Nz::Keyboard **********************************/
|
||||
keyboard.Reset("Keyboard");
|
||||
{
|
||||
keyboard.BindStaticMethod("GetKeyName", &Nz::Keyboard::GetKeyName);
|
||||
keyboard.BindStaticMethod("IsKeyPressed", &Nz::Keyboard::IsKeyPressed);
|
||||
}
|
||||
|
||||
/*********************************** Nz::Node **********************************/
|
||||
node.Reset("Node");
|
||||
{
|
||||
node.BindMethod("GetBackward", &Nz::Node::GetBackward);
|
||||
//nodeClass.SetMethod("GetChilds", &Nz::Node::GetChilds);
|
||||
node.BindMethod("GetDown", &Nz::Node::GetDown);
|
||||
|
|
@ -317,6 +328,7 @@ namespace Ndk
|
|||
return 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* \brief Registers the classes that will be used by the Lua instance
|
||||
|
|
|
|||
Loading…
Reference in New Issue