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"), nodeClass("Node"),
// SDK // SDK
application("Application"),
nodeComponent("NodeComponent"), nodeComponent("NodeComponent"),
entityClass("Entity"), entityClass("Entity"),
velocityComponent("VelocityComponent"), velocityComponent("VelocityComponent"),

View File

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

View File

@ -44,6 +44,19 @@ namespace Ndk
void LuaBinding::BindSDK() 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 **********************************/ /*********************************** Ndk::Console **********************************/
consoleClass.Inherit<Nz::Node>(nodeClass, [] (ConsoleHandle* handle) -> Nz::Node* consoleClass.Inherit<Nz::Node>(nodeClass, [] (ConsoleHandle* handle) -> Nz::Node*
@ -206,6 +219,7 @@ namespace Ndk
void LuaBinding::RegisterSDK(Nz::LuaInstance& instance) void LuaBinding::RegisterSDK(Nz::LuaInstance& instance)
{ {
// Classes // Classes
application.Register(instance);
entityClass.Register(instance); entityClass.Register(instance);
nodeComponent.Register(instance); nodeComponent.Register(instance);
velocityComponent.Register(instance); velocityComponent.Register(instance);