Sdk/LuaAPI: Bind console
Former-commit-id: 70738fdc709b867bead746a0091dcb50a5ca67ea
This commit is contained in:
parent
1dd13046cd
commit
9a472a4a1c
|
|
@ -8,6 +8,7 @@
|
|||
#include <Nazara/Math/Quaternion.hpp>
|
||||
#include <Nazara/Math/Vector3.hpp>
|
||||
#include <Nazara/Network/IpAddress.hpp>
|
||||
#include <NDK/Application.hpp>
|
||||
#include <NDK/Components.hpp>
|
||||
#include <NDK/Entity.hpp>
|
||||
#include <NDK/World.hpp>
|
||||
|
|
@ -16,6 +17,7 @@
|
|||
#ifndef NDK_SERVER
|
||||
#include <Nazara/Audio/SoundBuffer.hpp>
|
||||
#include <Nazara/Graphics/Model.hpp>
|
||||
#include <NDK/Console.hpp>
|
||||
#endif
|
||||
|
||||
namespace Nz
|
||||
|
|
@ -315,6 +317,12 @@ namespace Nz
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::Application* ptr, TypeTag<Ndk::Application*>)
|
||||
{
|
||||
instance.PushInstance<Ndk::Application*>("Application", ptr);
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::EntityHandle handle, TypeTag<Ndk::EntityHandle>)
|
||||
{
|
||||
instance.PushInstance<Ndk::EntityHandle>("Entity", handle);
|
||||
|
|
@ -327,6 +335,12 @@ namespace Nz
|
|||
return 1;
|
||||
}
|
||||
|
||||
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::VelocityComponentHandle handle, TypeTag<Ndk::VelocityComponentHandle>)
|
||||
{
|
||||
instance.PushInstance<Ndk::VelocityComponentHandle>("VelocityComponent", handle);
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::World* ptr, TypeTag<Ndk::World*>)
|
||||
{
|
||||
instance.PushInstance<Ndk::WorldHandle>("World", ptr);
|
||||
|
|
@ -340,6 +354,12 @@ namespace Nz
|
|||
}
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::ConsoleHandle handle, TypeTag<Ndk::ConsoleHandle>)
|
||||
{
|
||||
instance.PushInstance<Ndk::ConsoleHandle>("Console", handle);
|
||||
return 1;
|
||||
}
|
||||
|
||||
inline int LuaImplReplyVal(const LuaInstance& instance, Ndk::GraphicsComponentHandle handle, TypeTag<Ndk::GraphicsComponentHandle>)
|
||||
{
|
||||
instance.PushInstance<Ndk::GraphicsComponentHandle>("GraphicsComponent", handle);
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ namespace Ndk
|
|||
modelClass("Model"),
|
||||
|
||||
// SDK
|
||||
consoleClass("Console"),
|
||||
graphicsComponent("GraphicsComponent")
|
||||
#endif
|
||||
{
|
||||
|
|
|
|||
|
|
@ -106,6 +106,7 @@ namespace Ndk
|
|||
Nz::LuaClass<Nz::ModelRef> modelClass;
|
||||
|
||||
// SDK
|
||||
Nz::LuaClass<ConsoleHandle> consoleClass;
|
||||
Nz::LuaClass<GraphicsComponentHandle> graphicsComponent;
|
||||
#endif
|
||||
};
|
||||
|
|
|
|||
|
|
@ -44,12 +44,34 @@ namespace Ndk
|
|||
|
||||
void LuaBinding::BindSDK()
|
||||
{
|
||||
/*********************************** Ndk::NodeComponent **********************************/
|
||||
nodeComponent.Inherit<Nz::Node>(nodeClass, [] (NodeComponentHandle* handle) -> Nz::Node*
|
||||
|
||||
/*********************************** Ndk::Console **********************************/
|
||||
consoleClass.Inherit<Nz::Node>(nodeClass, [] (ConsoleHandle* handle) -> Nz::Node*
|
||||
{
|
||||
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.SetMethod("GetTextFont", &Console::GetTextFont);
|
||||
|
||||
consoleClass.SetMethod("IsVisible", &Console::IsVisible);
|
||||
|
||||
consoleClass.SetMethod("SendCharacter", &Console::SendCharacter);
|
||||
//consoleClass.SetMethod("SendEvent", &Console::SendEvent);
|
||||
|
||||
consoleClass.SetMethod("SetCharacterSize", &Console::SetCharacterSize);
|
||||
consoleClass.SetMethod("SetSize", &Console::SetSize);
|
||||
//consoleClass.SetMethod("SetTextFont", &Console::SetTextFont);
|
||||
|
||||
consoleClass.SetMethod("Show", &Console::Show, true);
|
||||
|
||||
/*********************************** Ndk::Entity **********************************/
|
||||
entityClass.SetMethod("Enable", &Entity::Enable);
|
||||
entityClass.SetMethod("GetId", &Entity::GetId);
|
||||
|
|
@ -109,6 +131,12 @@ namespace Ndk
|
|||
return binding.getter(lua, handle->GetComponent(componentIndex));
|
||||
});
|
||||
|
||||
/*********************************** Ndk::NodeComponent **********************************/
|
||||
nodeComponent.Inherit<Nz::Node>(nodeClass, [] (NodeComponentHandle* handle) -> Nz::Node*
|
||||
{
|
||||
return handle->GetObject();
|
||||
});
|
||||
|
||||
/*********************************** Ndk::World **********************************/
|
||||
worldClass.SetMethod("CreateEntity", &World::CreateEntity);
|
||||
worldClass.SetMethod("CreateEntities", &World::CreateEntities);
|
||||
|
|
@ -152,6 +180,7 @@ namespace Ndk
|
|||
worldClass.Register(instance);
|
||||
|
||||
#ifndef NDK_SERVER
|
||||
consoleClass.Register(instance);
|
||||
graphicsComponent.Register(instance);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue