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

@@ -28,6 +28,8 @@ namespace ScriptAPI
{
RegisterMethod("GetEntityID(_)", (void*)GetEntity);
RegisterMethod("EntityHasComponent(_,_)", (void*)EntityHasComponent);
RegisterMethod("SetLightIntensity_(_,_)", (void*)SetLightIntensity);
RegisterMethod("GetLightIntensity_(_)", (void*)GetLightIntensity);
}
static void GetEntity(WrenVM* vm)
@@ -74,5 +76,30 @@ namespace ScriptAPI
wrenSetSlotBool(vm, 0, result);
}
}
static void SetLightIntensity(WrenVM* vm)
{
int handle = wrenGetSlotDouble(vm, 1);
float intensity = wrenGetSlotDouble(vm, 2);
Entity ent = Entity((entt::entity)handle, Engine::GetCurrentScene().get());
auto& light = ent.GetComponent<LightComponent>();
light.Strength = intensity;
}
static void GetLightIntensity(WrenVM* vm)
{
int handle = wrenGetSlotDouble(vm, 1);
float intensity = wrenGetSlotDouble(vm, 2);
Entity ent = Entity((entt::entity)handle, Engine::GetCurrentScene().get());
auto& light = ent.GetComponent<LightComponent>();
wrenSetSlotDouble(vm, 0, light.Strength);
}
static void SetCameraDirection(WrenVM* vm)
{
}
};
}