Major scripting update🕹

- Added Input wren module
- Added Math wren module
- Added Entity wren module
- Changed camera API
This commit is contained in:
Antoine Pilote
2021-06-10 22:23:53 -04:00
parent 41742ce0ad
commit 855bb1edd6
15 changed files with 473 additions and 43 deletions

View File

@@ -0,0 +1,39 @@
#pragma once
#include "wren.h"
#include <string>
#include <src/Core/Logger.h>
#include "ScriptModule.h"
#include <iostream>
#include <wren.h>
#include "../Core/Maths.h"
namespace ScriptAPI
{
class MathModule : public ScriptModule
{
std::string ModuleName = "Math";
std::string GetModuleName() override
{
return "Math";
}
void RegisterModule(WrenVM* vm) override
{
RegisterMethod("Sqrt_(_,_,_)", (void*)Sqrt);
}
static void Sqrt(WrenVM* vm)
{
float x = wrenGetSlotDouble(vm, 0);
float y = wrenGetSlotDouble(vm, 0);
float z = wrenGetSlotDouble(vm, 0);
float result = glm::sqrt((x * x) + (y * y) + (z * z));
wrenSetSlotDouble(vm, 0, result);
}
};
}