Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
4687d7f
Comeback of the workflows
Mar 28, 2025
51cb441
Initial C# Script Engine work
Mar 28, 2025
b81b6f2
Hide the StarEngine-ScriptCore dlls
Mar 28, 2025
de15738
Choosing Release instead of Dist to build
Mar 28, 2025
1fe3016
cleaning
Mar 29, 2025
4722831
Merge branch 'main' into csharp
sheazywi Mar 29, 2025
a51f19b
Merge branch 'csharp' of https://github.com/starbounded-dev/StarEngin…
Mar 29, 2025
b2a2346
Calling C++ to C#
Mar 29, 2025
559abb1
Handle Internal Calls easier + refactoring
Mar 29, 2025
6570649
Rename namespace
Mar 29, 2025
ba4aa8f
Remove main and made it more universal
Mar 30, 2025
b586924
Implementing it to the Engine
Mar 30, 2025
670fffa
Forgot to add serialization
Mar 30, 2025
1b7b0d7
Now working in StarEditor
Mar 30, 2025
93bdceb
Update the rigidbody
Mar 30, 2025
d0d85fa
Update some stuff
Mar 30, 2025
bf69893
Separated "game" scripts into separate Sandbox module
Apr 8, 2025
7ca6ec8
change up smt
Apr 8, 2025
f58dcae
tired of this stupid error
Apr 8, 2025
ca1fdcb
Retrieving public C# Entity class fields
Apr 9, 2025
e367e47
update most of the code
Apr 9, 2025
ff76f79
now fixed, but still doesnt want to run
Apr 9, 2025
1de22b3
make it look readable
Apr 9, 2025
ea2e8b3
update som, trying to fix it
Apr 20, 2025
4ab46ce
Storing/copying C# field values to runtime
Apr 20, 2025
f54d517
Serializing script fields
Apr 20, 2025
5780091
update the scene and speed in player.cs
Apr 20, 2025
71d7020
Added FindEntityByName and Entity.As to retrieve script class instance
Apr 20, 2025
7d6f0cc
added missing function that i removed
Apr 21, 2025
fd2f639
Added file watching for C# app assembly to automatically reload chang…
Apr 26, 2025
9c3aea3
Pausing and Stepping
Apr 26, 2025
91791b1
Added C# debugging support & Added Buffer and ScopedBuffer classes
Apr 26, 2025
8a74991
More Script Engine cleanup + handling invalid state
Apr 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
10 changes: 5 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ jobs:
run: premake5 vs2022

- name: Build project with MSBuild
run: MSBuild /m /p:Configuration=Dist StarEngine.sln
run: MSBuild /m /p:Configuration=Release StarEngine.sln

- name: Upload executable
uses: actions/upload-artifact@v4
with:
name: StarEngine-Windows
path: |
bin/Dist-windows-x86_64/StarEditor/StarEditor.exe
bin/Dist-windows-x86_64/StarEditor/assets
bin/Dist-windows-x86_64/StarEditor/Resources
bin/Dist-windows-x86_64/StarEditor/imgui.ini
bin/Release-windows-x86_64/StarEditor/StarEditor.exe
bin/Release-windows-x86_64/StarEditor/assets
bin/Release-windows-x86_64/StarEditor/Resources
bin/Release-windows-x86_64/StarEditor/imgui.ini
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Binaries
**/bin/
bin-int/
Intermediates/

# StarEngine files
*.log
Expand All @@ -14,6 +15,7 @@ bin-int/
**.vcxproj
**.vcxproj.filters
**.vcxproj.user
**.csproj

# Directories
StarEngine/vendor/VulkanSDK
Expand All @@ -22,3 +24,6 @@ scripts/__pycache__

StarEngine/vendor/VulkanSDK/VulkanSDK-1.2.170.0-Installer.exe
vendor/premake/bin/
StarEditor/Resources/Scripts/StarEngine-ScriptCore.dll
StarEditor/Resources/Scripts/StarEngine-ScriptCore.pdb
StarEditor/SandboxProject/Assets/Scripts/Binaries
13 changes: 12 additions & 1 deletion Dependencies.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ IncludeDir["GLAD"] = "%{wks.location}/StarEngine/vendor/GLAD/include"
IncludeDir["ImGui"] = "%{wks.location}/StarEngine/vendor/imgui"
IncludeDir["ImGuizmo"] = "%{wks.location}/StarEngine/vendor/imguizmo"
IncludeDir["glm"] = "%{wks.location}/StarEngine/vendor/glm"
IncludeDir["filewatch"] = "%{wks.location}/StarEngine/vendor/filewatch"
IncludeDir["entt"] = "%{wks.location}/StarEngine/vendor/entt/include"
IncludeDir["mono"] = "%{wks.location}/StarEngine/vendor/mono/include"
IncludeDir["shaderc"] = "%{wks.location}/StarEngine/vendor/shaderc/include"
IncludeDir["SPIRV_Cross"] = "%{wks.location}/StarEngine/vendor/SPIRV-Cross"
IncludeDir["VulkanSDK"] = "%{VULKAN_SDK}/Include"

LibraryDir = {}

LibraryDir["VulkanSDK"] = "%{VULKAN_SDK}/Lib"
LibraryDir["Mono"] = "%{wks.location}/StarEngine/vendor/mono/lib/%{cfg.buildcfg}"

Library = {}
Library["mono"] = "%{LibraryDir.Mono}/libmono-static-sgen.lib"
Library["Vulkan"] = "%{LibraryDir.VulkanSDK}/vulkan-1.lib"
Library["VulkanUtils"] = "%{LibraryDir.VulkanSDK}/VkLayer_utils.lib"

Expand All @@ -31,4 +35,11 @@ Library["SPIRV_Tools_Debug"] = "%{LibraryDir.VulkanSDK}/SPIRV-Toolsd.lib"

Library["ShaderC_Release"] = "%{LibraryDir.VulkanSDK}/shaderc_shared.lib"
Library["SPIRV_Cross_Release"] = "%{LibraryDir.VulkanSDK}/spirv-cross-core.lib"
Library["SPIRV_Cross_GLSL_Release"] = "%{LibraryDir.VulkanSDK}/spirv-cross-glsl.lib"
Library["SPIRV_Cross_GLSL_Release"] = "%{LibraryDir.VulkanSDK}/spirv-cross-glsl.lib"


-- Windows
Library["WinSock"] = "Ws2_32.lib"
Library["WinMM"] = "Winmm.lib"
Library["WinVersion"] = "Version.lib"
Library["BCrypt"] = "Bcrypt.lib"
Binary file added StarEditor/Resources/Icons/PauseButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added StarEditor/Resources/Icons/StepButton.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 50 additions & 0 deletions StarEditor/SandboxProject/Assets/Scripts/Source/Camera.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using StarEngine;

namespace Sandbox
{
public class Camera : Entity
{
public Entity OtherEntity;

public float DistanceFromPlayer = 5.0f;

private Entity m_Player;

void OnCreate()
{
m_Player = FindEntityByName("Player");
}

void OnUpdate(float ts)
{
if (m_Player != null)
Translation = new Vector3(m_Player.Translation.XY, DistanceFromPlayer);

float speed = 1.0f;
Vector3 velocity = Vector3.Zero;

if (Input.IsKeyDown(KeyCode.Up))
velocity.Y = 1.0f;
else if (Input.IsKeyDown(KeyCode.Down))
velocity.Y = -1.0f;

if (Input.IsKeyDown(KeyCode.Left))
velocity.X = -1.0f;
else if (Input.IsKeyDown(KeyCode.Right))
velocity.X = 1.0f;

velocity *= speed;

Vector3 translation = Translation;
translation += velocity * ts;
Translation = translation;
}

}
}
66 changes: 66 additions & 0 deletions StarEditor/SandboxProject/Assets/Scripts/Source/Player.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using StarEngine;

namespace Sandbox
{
public class Player : Entity
{
private TransformComponent m_Transform;
private RigidBody2DComponent m_RigidBody;

public float Speed = 1.0f;
public float Time = 0.0f;

void OnCreate()
{
Console.WriteLine($"Player.OnCreate - {ID}");

m_Transform = GetComponent<TransformComponent>();
m_RigidBody = GetComponent<RigidBody2DComponent>();
}

void OnUpdate(float ts)
{
Time += ts;
// Console.WriteLine($"Player.OnUpdate: {ts}");

float speed = Speed;
Vector3 velocity = Vector3.Zero;

if (Input.IsKeyDown(KeyCode.W))
velocity.Y = 1.0f;
else if (Input.IsKeyDown(KeyCode.S))
velocity.Y = -1.0f;

if (Input.IsKeyDown(KeyCode.A))
velocity.X = -1.0f;
else if (Input.IsKeyDown(KeyCode.D))
velocity.X = 1.0f;

Entity cameraEntity = FindEntityByName("Camera");
if (cameraEntity != null)
{
Camera camera = cameraEntity.As<Camera>();

if (Input.IsKeyDown(KeyCode.Q))
camera.DistanceFromPlayer += speed * 2.0f * ts;
else if (Input.IsKeyDown(KeyCode.E))
camera.DistanceFromPlayer -= speed * 2.0f * ts;
}

velocity *= speed * ts;

m_RigidBody.ApplyLinearImpulse(velocity.XY, true);

//Vector3 translation = m_Transform.Translation;
//translation += velocity * ts;
//m_Transform.Translation = translation;
}

}
}
3 changes: 3 additions & 0 deletions StarEditor/SandboxProject/Assets/Scripts/Win-GenProjects.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
@echo off
call ..\..\..\..\vendor\premake\bin\premake5.exe vs2022
PAUSE
55 changes: 55 additions & 0 deletions StarEditor/SandboxProject/Assets/Scripts/premake5.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
local StarEngineRootDir = '../../../..'
include (StarEngineRootDir .. "/vendor/premake/premake_customization/solution_items.lua")

workspace "Sandbox"
architecture "x86_64"
startproject "Sandbox"

configurations
{
"Debug",
"Release",
"Dist"
}

flags
{
"MultiProcessorCompile"
}

outputdir = "%{cfg.buildcfg}-%{cfg.system}-%{cfg.architecture}"

project "Sandbox"
kind "SharedLib"
language "C#"
dotnetframework "4.7.2"

targetdir ("Binaries")
objdir ("Intermediates")

files
{
"Source/**.cs",
"Properties/**.cs"
}

links
{
"StarEngine-ScriptCore"
}

filter "configurations:Debug"
optimize "Off"
symbols "Default"

filter "configurations:Release"
optimize "On"
symbols "Default"

filter "configurations:Dist"
optimize "Full"
symbols "Off"

group "StarEngine"
include (StarEngineRootDir .. "/StarEngine-ScriptCore")
group ""
30 changes: 26 additions & 4 deletions StarEditor/assets/scene/Physics2D.starscene
Original file line number Diff line number Diff line change
@@ -1,5 +1,25 @@
Scene: Untitled
Entities:
- Entity: 14040563719264005740
TagComponent:
Tag: Player
TransformComponent:
Translation: [0, 5, 0]
Rotation: [0, 0, 0]
Scale: [1, 1, 1]
SpriteRendererComponent:
Color: [1, 1, 1, 1]
TilingFactor: 1
RigidBody2DComponent:
BodyType: Dynamic
FixedRotation: false
BoxCollider2DComponent:
Offset: [0, 0]
Size: [0.5, 0.5]
Density: 1
Friction: 0.5
Restitution: 0
RestitutionThreshold: 0.5
- Entity: 16241606122818465121
TagComponent:
Tag: Camera
Expand Down Expand Up @@ -27,7 +47,8 @@ Entities:
Scale: [1, 1, 1]
SpriteRendererComponent:
Color: [1, 1, 1, 1]
Rigidbody2DComponent:
TilingFactor: 1
RigidBody2DComponent:
BodyType: Dynamic
FixedRotation: false
BoxCollider2DComponent:
Expand All @@ -46,9 +67,10 @@ Entities:
Scale: [10, 1, 1]
SpriteRendererComponent:
Color: [1, 1, 1, 1]
Rigidbody2DComponent:
TilingFactor: 1
RigidBody2DComponent:
BodyType: Static
FixedRotation: false
FixedRotation: true
BoxCollider2DComponent:
Offset: [0, 0]
Size: [0.5, 0.5]
Expand All @@ -67,7 +89,7 @@ Entities:
Color: [0.934362948, 0.497845858, 0, 1]
Thickness: 1
Fade: 0.00499999989
Rigidbody2DComponent:
RigidBody2DComponent:
BodyType: Dynamic
FixedRotation: false
CircleCollider2DComponent:
Expand Down
Binary file added StarEditor/mono/lib/mono/4.5/Accessibility.dll
Binary file not shown.
Binary file not shown.
Binary file added StarEditor/mono/lib/mono/4.5/CustomMarshalers.dll
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added StarEditor/mono/lib/mono/4.5/I18N.CJK.dll
Binary file not shown.
Binary file added StarEditor/mono/lib/mono/4.5/I18N.MidEast.dll
Binary file not shown.
Binary file added StarEditor/mono/lib/mono/4.5/I18N.Other.dll
Binary file not shown.
Binary file added StarEditor/mono/lib/mono/4.5/I18N.Rare.dll
Binary file not shown.
Binary file added StarEditor/mono/lib/mono/4.5/I18N.West.dll
Binary file not shown.
Binary file added StarEditor/mono/lib/mono/4.5/I18N.dll
Binary file not shown.
Binary file added StarEditor/mono/lib/mono/4.5/IBM.Data.DB2.dll
Binary file not shown.
Binary file not shown.
Loading
Loading