Sdk/LuaAPI: Add Application binding

Former-commit-id: fd926aaaf6a8df85c93a2ceae14db7bc49516759
This commit is contained in:
Lynix 2016-04-01 18:58:22 +02:00
parent 6669733af3
commit 50f25e6bcc
3 changed files with 17 additions and 0 deletions

View File

@ -26,6 +26,7 @@ namespace Ndk
nodeClass("Node"),
// SDK
application("Application"),
nodeComponent("NodeComponent"),
entityClass("Entity"),
velocityComponent("VelocityComponent"),

View File

@ -12,6 +12,7 @@
#include <Nazara/Math.hpp>
#include <Nazara/Network.hpp>
#include <Nazara/Utility.hpp>
#include <NDK/Application.hpp>
#include <NDK/Components.hpp>
#include <NDK/Entity.hpp>
#include <NDK/Systems.hpp>
@ -80,6 +81,7 @@ namespace Ndk
Nz::LuaClass<Nz::Node> nodeClass;
// SDK
Nz::LuaClass<Application*> application;
Nz::LuaClass<EntityHandle> entityClass;
Nz::LuaClass<NodeComponentHandle> nodeComponent;
Nz::LuaClass<VelocityComponentHandle> velocityComponent;

View File

@ -44,6 +44,19 @@ namespace Ndk
void LuaBinding::BindSDK()
{
/*********************************** Ndk::Application **********************************/
#ifndef NDK_SERVER
//application.SetMethod("AddWindow", &Application::AddWindow);
#endif
application.SetMethod("AddWorld", [] (Nz::LuaInstance& instance, Application* application) -> int
{
instance.Push(application->AddWorld().CreateHandle());
return 1;
});
application.SetMethod("GetUpdateTime", &Application::GetUpdateTime);
application.SetMethod("Quit", &Application::Quit);
/*********************************** Ndk::Console **********************************/
consoleClass.Inherit<Nz::Node>(nodeClass, [] (ConsoleHandle* handle) -> Nz::Node*
@ -206,6 +219,7 @@ namespace Ndk
void LuaBinding::RegisterSDK(Nz::LuaInstance& instance)
{
// Classes
application.Register(instance);
entityClass.Register(instance);
nodeComponent.Register(instance);
velocityComponent.Register(instance);