Skip to content

Commit cecc1ef

Browse files
committed
GameFramework: Using foldering
1 parent 0e9a935 commit cecc1ef

File tree

5 files changed

+110
-33
lines changed

5 files changed

+110
-33
lines changed

src/Managed/Console.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
4+
namespace Exeon
5+
{
6+
public class Console
7+
{
8+
[MethodImpl(MethodImplOptions.InternalCall)]
9+
public static extern void Debug(string msg);
10+
}
11+
}

src/Managed/ExeonScript.cs

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,13 @@
33

44
namespace Exeon
55
{
6-
public class Console
7-
{
8-
[MethodImpl(MethodImplOptions.InternalCall)]
9-
public static extern void Debug(string msg);
10-
}
11-
12-
public class SceneManager
13-
{
14-
[MethodImpl(MethodImplOptions.InternalCall)]
15-
private static extern UIntPtr GetScene_Impl(string name);
16-
public static Scene GetScene(string name)
17-
{
18-
return new Scene(GetScene_Impl(name));
19-
}
20-
}
21-
226
public class ExeonScript
237
{
248
public static void Init()
259
{
2610
Scene sampleScene = SceneManager.GetScene("SampleScene");
2711

28-
29-
}
30-
}
31-
32-
public class Scene
33-
{
34-
private UIntPtr nativePtr;
35-
36-
public Scene(UIntPtr ptr)
37-
{
38-
nativePtr = ptr;
39-
}
40-
41-
private static extern bool ObjectExists_Impl(UIntPtr ptr, string name);
42-
public bool ObjectExists(string name)
43-
{
44-
return ObjectExists_Impl(this.nativePtr, name);
12+
Console.Debug(sampleScene.ObjectExists("Sponza Atrium").ToString());
4513
}
4614
}
4715
}

src/Managed/Math/Vector3.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
using System;
2+
3+
namespace Exeon
4+
{
5+
public class Vector3
6+
{
7+
public float x, y, z;
8+
9+
public Vector3()
10+
{
11+
this.x = 0;
12+
this.y = 0;
13+
this.z = 0;
14+
}
15+
16+
public Vector3(float x, float y, float z)
17+
{
18+
this.x = x;
19+
this.y = y;
20+
this.z = z;
21+
}
22+
23+
public Vector3(Vector3 v)
24+
{
25+
this.x = v.x;
26+
this.y = v.y;
27+
this.z = v.z;
28+
}
29+
30+
public static Vector3 operator +(Vector3 a, Vector3 b)
31+
{
32+
return new Vector3(a.x + b.x, a.y + b.y, a.z + b.z);
33+
}
34+
35+
public static Vector3 operator +(Vector3 a, float b)
36+
{
37+
return new Vector3(a.x + b, a.y + b, a.z + b);
38+
}
39+
40+
public static Vector3 operator -(Vector3 a, Vector3 b)
41+
{
42+
return new Vector3(a.x - b.x, a.y - b.y, a.z - b.z);
43+
}
44+
45+
public static Vector3 operator -(Vector3 a, float b)
46+
{
47+
return new Vector3(a.x - b, a.y - b, a.z - b);
48+
}
49+
50+
public static Vector3 operator *(Vector3 a, Vector3 b)
51+
{
52+
return new Vector3(a.x * b.x, a.y * b.y, a.z * b.z);
53+
}
54+
55+
public static Vector3 operator *(Vector3 a, float b)
56+
{
57+
return new Vector3(a.x * b, a.y * b, a.z * b);
58+
}
59+
}
60+
}

src/Managed/Scene/Scene.cs

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

src/Managed/Scene/SceneManager.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
using Exeon;
4+
5+
namespace Exeon
6+
{
7+
public class SceneManager
8+
{
9+
[MethodImpl(MethodImplOptions.InternalCall)]
10+
private static extern UIntPtr GetScene_Impl(string name);
11+
public static Scene GetScene(string name)
12+
{
13+
return new Scene(GetScene_Impl(name));
14+
}
15+
}
16+
}

0 commit comments

Comments
 (0)