Framebuffer resize queued to next frame to fix flickering Wren VM init moved to on play event Added new Wren modules Added missing components to the editor Changed how the wren scripts gets initialized
39 lines
700 B
C++
39 lines
700 B
C++
#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, 1);
|
|
float y = wrenGetSlotDouble(vm, 2);
|
|
float z = wrenGetSlotDouble(vm, 3);
|
|
float result = glm::sqrt((x * x) + (y * y) + (z * z));
|
|
wrenSetSlotDouble(vm, 0, result);
|
|
}
|
|
};
|
|
|
|
|
|
} |