Added Wren scripting with module system 📚

Added Input pressed, released system
Added interface button support with wren onclick callback
This commit is contained in:
Antoine Pilote
2021-06-09 22:15:53 -04:00
parent aa2ebd04c8
commit 19db72aa22
1185 changed files with 320199 additions and 486 deletions

View File

@@ -0,0 +1,38 @@
#pragma once
#include "wren.h"
#include <string>
#include <src/Core/Logger.h>
#include "ScriptModule.h"
#include <iostream>
#include <wren.h>
namespace ScriptAPI
{
class EngineModule : public ScriptModule
{
std::string ModuleName = "Engine";
std::string WrenAPI = "class Engine { \n"
"foreign static Log(msg) \n"
"}"
"";
std::string GetModuleName() override
{
return "Engine";
}
void RegisterModule(WrenVM* vm) override
{
RegisterMethod("Log(_)", (void*)Log);
WrenInterpretResult result = wrenInterpret(vm, "main", WrenAPI.c_str());
}
static void Log(WrenVM* vm)
{
std::string msg = wrenGetSlotString(vm, 1);
Logger::Log(msg);
}
};
}