feat: expand editor scripting asset and viewport flow

This commit is contained in:
2026-04-03 13:22:30 +08:00
parent ed8c27fde2
commit a05d0b80a2
124 changed files with 10397 additions and 1737 deletions

View File

@@ -0,0 +1,94 @@
namespace XCEngine
{
public static class Input
{
public static bool GetKey(KeyCode key)
{
return InternalCalls.Input_GetKey((int)key);
}
public static bool GetKeyDown(KeyCode key)
{
return InternalCalls.Input_GetKeyDown((int)key);
}
public static bool GetKeyUp(KeyCode key)
{
return InternalCalls.Input_GetKeyUp((int)key);
}
public static bool GetMouseButton(int button)
{
return InternalCalls.Input_GetMouseButton(button);
}
public static bool GetMouseButtonDown(int button)
{
return InternalCalls.Input_GetMouseButtonDown(button);
}
public static bool GetMouseButtonUp(int button)
{
return InternalCalls.Input_GetMouseButtonUp(button);
}
public static bool GetButton(string buttonName)
{
return InternalCalls.Input_GetButton(buttonName);
}
public static bool GetButtonDown(string buttonName)
{
return InternalCalls.Input_GetButtonDown(buttonName);
}
public static bool GetButtonUp(string buttonName)
{
return InternalCalls.Input_GetButtonUp(buttonName);
}
public static float GetAxis(string axisName)
{
return InternalCalls.Input_GetAxis(axisName);
}
public static float GetAxisRaw(string axisName)
{
return InternalCalls.Input_GetAxisRaw(axisName);
}
public static bool anyKey
{
get
{
return InternalCalls.Input_GetAnyKey();
}
}
public static bool anyKeyDown
{
get
{
return InternalCalls.Input_GetAnyKeyDown();
}
}
public static Vector3 mousePosition
{
get
{
InternalCalls.Input_GetMousePosition(out Vector3 position);
return position;
}
}
public static Vector2 mouseScrollDelta
{
get
{
InternalCalls.Input_GetMouseScrollDelta(out Vector2 delta);
return delta;
}
}
}
}

View File

@@ -17,6 +17,54 @@ namespace XCEngine
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern float Time_GetDeltaTime();
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern float Time_GetFixedDeltaTime();
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetKey(int keyCode);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetKeyDown(int keyCode);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetKeyUp(int keyCode);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetMouseButton(int button);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetMouseButtonDown(int button);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetMouseButtonUp(int button);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetButton(string buttonName);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetButtonDown(string buttonName);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetButtonUp(string buttonName);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern float Input_GetAxis(string axisName);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern float Input_GetAxisRaw(string axisName);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetAnyKey();
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern bool Input_GetAnyKeyDown();
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void Input_GetMousePosition(out Vector3 position);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern void Input_GetMouseScrollDelta(out Vector2 delta);
[MethodImpl(MethodImplOptions.InternalCall)]
internal static extern string GameObject_GetName(ulong gameObjectUUID);

View File

@@ -0,0 +1,93 @@
namespace XCEngine
{
public enum KeyCode
{
None = 0,
A = 4,
B = 5,
C = 6,
D = 7,
E = 8,
F = 9,
G = 10,
H = 11,
I = 12,
J = 13,
K = 14,
L = 15,
M = 16,
N = 17,
O = 18,
P = 19,
Q = 20,
R = 21,
S = 22,
T = 23,
U = 24,
V = 25,
W = 26,
X = 27,
Y = 28,
Z = 29,
F1 = 58,
F2 = 59,
F3 = 60,
F4 = 61,
F5 = 62,
F6 = 63,
F7 = 64,
F8 = 65,
F9 = 66,
F10 = 67,
F11 = 68,
F12 = 69,
Space = 49,
Tab = 48,
Return = 36,
Escape = 53,
LeftShift = 56,
RightShift = 60,
LeftControl = 59,
RightControl = 62,
LeftAlt = 58,
RightAlt = 61,
UpArrow = 126,
DownArrow = 125,
LeftArrow = 123,
RightArrow = 124,
Home = 115,
End = 119,
PageUp = 116,
PageDown = 121,
Delete = 51,
Backspace = 51,
Alpha0 = 39,
Alpha1 = 30,
Alpha2 = 31,
Alpha3 = 32,
Alpha4 = 33,
Alpha5 = 34,
Alpha6 = 35,
Alpha7 = 37,
Alpha8 = 38,
Alpha9 = 40,
Minus = 43,
Equals = 46,
LeftBracket = 47,
RightBracket = 54,
Semicolon = 42,
Quote = 40,
Comma = 54,
Period = 55,
Slash = 44,
Backslash = 45,
BackQuote = 41
}
}

View File

@@ -3,5 +3,6 @@ namespace XCEngine
public static class Time
{
public static float deltaTime => InternalCalls.Time_GetDeltaTime();
public static float fixedDeltaTime => InternalCalls.Time_GetFixedDeltaTime();
}
}