Skip to content

Commit 24415ad

Browse files
committed
GameFramework: Started with GameObject integration
1 parent cecc1ef commit 24415ad

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
using Exeon;
4+
5+
namespace Exeon
6+
{
7+
public class GameObject
8+
{
9+
[MethodImpl(MethodImplOptions.InternalCall)]
10+
private static extern UIntPtr GetTransform_Impl(UIntPtr ptr);
11+
12+
private Transform GetTransform() {
13+
UIntPtr ptr = GetTransform_Impl(this.nativePtr);
14+
return new Transform(ptr);
15+
}
16+
17+
private UIntPtr nativePtr;
18+
public GameObject(UIntPtr ptr)
19+
{
20+
this.nativePtr = ptr;
21+
}
22+
23+
public Transform transform {
24+
get => GetTransform();
25+
}
26+
}
27+
}

src/Managed/Math/Transform.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
using Exeon;
4+
5+
namespace Exeon
6+
{
7+
public class Transform
8+
{
9+
10+
[MethodImpl(MethodImplOptions.InternalCall)]
11+
private static extern Vector3 GetLocation_Impl(UIntPtr ptr);
12+
13+
private UIntPtr nativePtr;
14+
public Transform(UIntPtr ptr)
15+
{
16+
this.nativePtr = ptr;
17+
}
18+
19+
public Vector3 Location
20+
{
21+
get => GetLocation_Impl(this.nativePtr);
22+
}
23+
}
24+
}

src/Managed/Scene/Scene.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,18 @@ public Scene(UIntPtr ptr)
1414

1515
[MethodImpl(MethodImplOptions.InternalCall)]
1616
private static extern bool ObjectExists_Impl(UIntPtr ptr, string name);
17+
[MethodImpl(MethodImplOptions.InternalCall)]
18+
private static extern UIntPtr GetObject_Impl(UIntPtr ptr, string name);
19+
1720
public bool ObjectExists(string name)
1821
{
1922
return ObjectExists_Impl(this.nativePtr, name);
2023
}
24+
25+
public GameObject GetObject(string name)
26+
{
27+
UIntPtr ptr = GetObject_Impl(this.nativePtr, name);
28+
return new GameObject(ptr);
29+
}
2130
}
2231
}

0 commit comments

Comments
 (0)