Added ShowMouse and get global position to .net api, deferred onInit after all entities have been initialized
This commit is contained in:
@@ -6,6 +6,18 @@
|
||||
|
||||
namespace Nuake {
|
||||
|
||||
void ShowMouse(bool visible)
|
||||
{
|
||||
if (visible)
|
||||
{
|
||||
Input::ShowMouse();
|
||||
}
|
||||
else
|
||||
{
|
||||
Input::HideMouse();
|
||||
}
|
||||
}
|
||||
|
||||
bool IsKeyDown(int keyCode)
|
||||
{
|
||||
return Input::IsKeyDown(keyCode);
|
||||
@@ -25,6 +37,7 @@ namespace Nuake {
|
||||
|
||||
void InputNetAPI::RegisterMethods()
|
||||
{
|
||||
RegisterMethod("Input.ShowMouseIcall", &ShowMouse);
|
||||
RegisterMethod("Input.IsKeyDownIcall", &IsKeyDown);
|
||||
RegisterMethod("Input.IsKeyPressedIcall", &IsKeyPressed);
|
||||
|
||||
|
||||
@@ -115,6 +115,19 @@ namespace Nuake {
|
||||
}
|
||||
}
|
||||
|
||||
Coral::NativeArray<float> TransformGetGlobalPosition(int entityId)
|
||||
{
|
||||
Entity entity = { (entt::entity)(entityId), Engine::GetCurrentScene().get() };
|
||||
|
||||
if (entity.IsValid() && entity.HasComponent<TransformComponent>())
|
||||
{
|
||||
auto& component = entity.GetComponent<TransformComponent>();
|
||||
const auto& globalPosition = component.GetGlobalPosition();
|
||||
Coral::NativeArray<float> result = { globalPosition.x, globalPosition.y, globalPosition.z };
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
void TransformRotate(int entityId, float x, float y, float z)
|
||||
{
|
||||
Entity entity = { (entt::entity)(entityId), Engine::GetCurrentScene().get() };
|
||||
@@ -203,6 +216,7 @@ namespace Nuake {
|
||||
|
||||
// Components
|
||||
RegisterMethod("TransformComponent.SetPositionIcall", &TransformSetPosition);
|
||||
RegisterMethod("TransformComponent.GetGlobalPositionIcall", &TransformGetGlobalPosition);
|
||||
RegisterMethod("TransformComponent.RotateIcall", &TransformRotate);
|
||||
|
||||
RegisterMethod("CameraComponent.GetDirectionIcall", &CameraGetDirection);
|
||||
|
||||
Reference in New Issue
Block a user