Major scripting update🕹
- Added Input wren module - Added Math wren module - Added Entity wren module - Changed camera API
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user